@drawbridge/components 0.1.46 → 0.1.48
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/dist/bridge/cart-drawer.js +152 -0
- package/dist/bridge/cart-drawer.mjs +123 -0
- package/dist/bridge/fields.js +278 -0
- package/dist/bridge/fields.mjs +276 -1
- package/dist/bridge/form-subdomain-checkout.js +687 -0
- package/dist/bridge/form-subdomain-checkout.mjs +665 -0
- package/dist/bridge/form-subdomain-shop-modal.js +234 -274
- package/dist/bridge/form-subdomain-shop-modal.mjs +233 -275
- package/dist/bridge/form-subdomain-shop.js +4 -1
- package/dist/bridge/form-subdomain-shop.mjs +4 -1
- package/dist/bridge/form-subdomain.js +24 -5
- package/dist/bridge/form-subdomain.mjs +25 -6
- package/dist/bridge/lib/age-gate.js +12 -0
- package/dist/bridge/lib/age-gate.mjs +11 -0
- package/dist/bridge/lib/cart.js +79 -0
- package/dist/bridge/lib/cart.mjs +48 -0
- package/dist/bridge/lib/checkout-kit.js +2 -32
- package/dist/bridge/lib/checkout-kit.mjs +2 -32
- package/dist/bridge/lib/entry.js +41 -0
- package/dist/bridge/lib/entry.mjs +40 -0
- package/dist/bridge/product-tile.js +13 -6
- package/dist/bridge/product-tile.mjs +13 -6
- package/dist/bridge/template-layout.js +263 -129
- package/dist/bridge/template-layout.mjs +264 -130
- package/dist/bridge/template-modal.js +39 -74
- package/dist/bridge/template-modal.mjs +40 -75
- package/dist/dashboard/avatar.js +2 -3
- package/dist/dashboard/avatar.mjs +2 -3
- package/dist/dashboard/buttons-subscription.js +1 -1
- package/dist/dashboard/buttons-subscription.mjs +1 -1
- package/dist/dashboard/campaign-form.js +179 -155
- package/dist/dashboard/campaign-form.mjs +179 -155
- package/dist/dashboard/campaign-share.js +347 -0
- package/dist/dashboard/campaign-share.mjs +314 -0
- package/dist/dashboard/card-affiliate.js +1 -1
- package/dist/dashboard/card-affiliate.mjs +1 -1
- package/dist/dashboard/card-campaign-switch.js +4 -1
- package/dist/dashboard/card-campaign-switch.mjs +4 -1
- package/dist/dashboard/card-order.js +22 -4
- package/dist/dashboard/card-order.mjs +22 -4
- package/dist/dashboard/embed-stripe.js +145 -0
- package/dist/dashboard/embed-stripe.mjs +116 -0
- package/dist/dashboard/form-admin-provider.js +71 -17
- package/dist/dashboard/form-admin-provider.mjs +71 -17
- package/dist/dashboard/form-file-upload.js +3 -2
- package/dist/dashboard/form-file-upload.mjs +4 -3
- package/dist/dashboard/form-organization-campaign-advertisements.js +47 -6
- package/dist/dashboard/form-organization-campaign-advertisements.mjs +47 -6
- package/dist/dashboard/form-organization-campaign-field-birthday.js +193 -0
- package/dist/dashboard/form-organization-campaign-field-birthday.mjs +164 -0
- package/dist/dashboard/form-organization-campaign-field-rating.js +246 -0
- package/dist/dashboard/form-organization-campaign-field-rating.mjs +217 -0
- package/dist/dashboard/form-organization-campaign-page.js +73 -39
- package/dist/dashboard/form-organization-campaign-page.mjs +73 -39
- package/dist/dashboard/form-organization-campaign.js +82 -0
- package/dist/dashboard/form-organization-campaign.mjs +81 -0
- package/dist/dashboard/form-organization-connection.js +48 -6
- package/dist/dashboard/form-organization-connection.mjs +48 -7
- package/dist/dashboard/form-organization-product.js +1461 -0
- package/dist/dashboard/form-organization-product.mjs +1425 -0
- package/dist/dashboard/form-organization-workflow.js +72 -1
- package/dist/dashboard/form-organization-workflow.mjs +69 -1
- package/dist/dashboard/form-otc.js +4 -5
- package/dist/dashboard/form-otc.mjs +4 -5
- package/dist/dashboard/form-stripe.js +12 -5
- package/dist/dashboard/form-stripe.mjs +12 -5
- package/dist/dashboard/input-combobox.js +6 -0
- package/dist/dashboard/input-combobox.mjs +6 -0
- package/dist/dashboard/input-fields.js +37 -161
- package/dist/dashboard/input-fields.mjs +37 -161
- package/dist/dashboard/input-file.js +21 -4
- package/dist/dashboard/input-file.mjs +21 -4
- package/dist/dashboard/input-font.js +2 -0
- package/dist/dashboard/input-font.mjs +2 -0
- package/dist/dashboard/input-gallery.js +201 -0
- package/dist/dashboard/input-gallery.mjs +172 -0
- package/dist/dashboard/input-group-ai.js +15 -3
- package/dist/dashboard/input-group-ai.mjs +15 -3
- package/dist/dashboard/lib/ab-tests.js +2 -2
- package/dist/dashboard/lib/ab-tests.mjs +2 -2
- package/dist/dashboard/lib/connection-controls.js +5 -2
- package/dist/dashboard/lib/connection-controls.mjs +3 -1
- package/dist/dashboard/lib/form-page.js +1 -1
- package/dist/dashboard/lib/form-page.mjs +1 -1
- package/dist/dashboard/lib/menu.js +19 -0
- package/dist/dashboard/lib/menu.mjs +18 -0
- package/dist/dashboard/lib/products.js +169 -0
- package/dist/dashboard/lib/products.mjs +135 -0
- package/dist/dashboard/lib/settings-paths.js +35 -0
- package/dist/dashboard/lib/settings-paths.mjs +11 -0
- package/dist/dashboard/lib/uppy.js +10 -1
- package/dist/dashboard/lib/uppy.mjs +11 -2
- package/dist/dashboard/menu.js +13 -2
- package/dist/dashboard/menu.mjs +13 -2
- package/dist/dashboard/order-sections.js +456 -6
- package/dist/dashboard/order-sections.mjs +453 -7
- package/dist/dashboard/preview.js +119 -52
- package/dist/dashboard/preview.mjs +119 -52
- package/dist/dashboard/provider-ui.js +9 -7
- package/dist/dashboard/provider-ui.mjs +9 -7
- package/dist/dashboard/recharts.js +10 -4
- package/dist/dashboard/recharts.mjs +10 -4
- package/dist/dashboard/shipping-rates.js +404 -0
- package/dist/dashboard/shipping-rates.mjs +371 -0
- package/dist/dashboard/template-buyer.js +301 -0
- package/dist/dashboard/template-buyer.mjs +267 -0
- package/dist/dashboard/template-dashboard.js +11 -1
- package/dist/dashboard/template-dashboard.mjs +11 -1
- package/dist/dashboard/template-design.js +209 -130
- package/dist/dashboard/template-design.mjs +210 -131
- package/dist/dashboard/template-ui.js +157 -55
- package/dist/dashboard/template-ui.mjs +158 -56
- package/dist/icons/flags.js +134 -0
- package/dist/icons/flags.mjs +115 -0
- package/dist/input-checkbox.js +28 -10
- package/dist/input-checkbox.mjs +28 -10
- package/dist/product.js +96 -24
- package/dist/product.mjs +97 -25
- package/dist/shared/carousel.js +14 -5
- package/dist/shared/carousel.mjs +14 -5
- package/dist/shared/lib/helpers.js +54 -6
- package/dist/shared/lib/helpers.mjs +53 -8
- package/dist/shared/order-summary.js +139 -0
- package/dist/shared/order-summary.mjs +110 -0
- package/package.json +84 -4
- package/types/bridge/cart-drawer.d.ts +31 -0
- package/types/bridge/fields.d.ts +14 -2
- package/types/bridge/form-subdomain-checkout.d.ts +20 -0
- package/types/bridge/form-subdomain-shop-modal.d.ts +27 -3
- package/types/bridge/form-subdomain.d.ts +13 -0
- package/types/bridge/lib/age-gate.d.ts +5 -0
- package/types/bridge/lib/cart.d.ts +44 -0
- package/types/bridge/lib/checkout-kit.d.ts +2 -10
- package/types/bridge/lib/entry.d.ts +5 -0
- package/types/bridge/product-tile.d.ts +2 -0
- package/types/dashboard/campaign-share.d.ts +16 -0
- package/types/dashboard/card-order.d.ts +6 -0
- package/types/dashboard/embed-stripe.d.ts +25 -0
- package/types/dashboard/form-admin-provider.d.ts +9 -2
- package/types/dashboard/form-file-upload.d.ts +2 -1
- package/types/dashboard/form-organization-campaign-advertisements.d.ts +3 -0
- package/types/dashboard/form-organization-campaign-field-birthday.d.ts +31 -0
- package/types/dashboard/form-organization-campaign-field-rating.d.ts +33 -0
- package/types/dashboard/form-organization-campaign-page.d.ts +8 -1
- package/types/dashboard/form-organization-campaign.d.ts +3 -0
- package/types/dashboard/form-organization-connection.d.ts +11 -0
- package/types/dashboard/form-organization-product.d.ts +24 -0
- package/types/dashboard/form-otc.d.ts +5 -1
- package/types/dashboard/form-stripe.d.ts +3 -2
- package/types/dashboard/input-combobox.d.ts +2 -0
- package/types/dashboard/input-file.d.ts +2 -0
- package/types/dashboard/input-gallery.d.ts +14 -0
- package/types/dashboard/lib/products.d.ts +14 -0
- package/types/dashboard/lib/settings-paths.d.ts +5 -0
- package/types/dashboard/order-sections.d.ts +24 -1
- package/types/dashboard/preview.d.ts +11 -3
- package/types/dashboard/shipping-rates.d.ts +26 -0
- package/types/dashboard/template-buyer.d.ts +50 -0
- package/types/icons/flags.d.ts +5 -0
- package/types/input-checkbox.d.ts +2 -0
- package/types/shared/lib/helpers.d.ts +4 -0
- package/types/shared/order-summary.d.ts +19 -0
|
@@ -0,0 +1,201 @@
|
|
|
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 input_gallery_exports = {};
|
|
29
|
+
__export(input_gallery_exports, {
|
|
30
|
+
default: () => input_gallery_default
|
|
31
|
+
});
|
|
32
|
+
module.exports = __toCommonJS(input_gallery_exports);
|
|
33
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
34
|
+
var import_react = require("react");
|
|
35
|
+
var import_react_hook_form = require("react-hook-form");
|
|
36
|
+
var import_react_query = require("@tanstack/react-query");
|
|
37
|
+
var import_dynamic = __toESM(require("next/dynamic"));
|
|
38
|
+
var import_input_group = __toESM(require("../input-group"));
|
|
39
|
+
var import_input_array = require("./input-array");
|
|
40
|
+
var import_input_file = __toESM(require("./input-file"));
|
|
41
|
+
var import_hooks = require("./lib/hooks");
|
|
42
|
+
var import_loader = require("../shared/loader");
|
|
43
|
+
var import_plus = __toESM(require("../icons/plus"));
|
|
44
|
+
var import_trash = __toESM(require("../icons/trash"));
|
|
45
|
+
const FormReposition = (0, import_dynamic.default)(() => import("./form-reposition"), { loading: () => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_loader.LoaderDynamic, {}), ssr: false });
|
|
46
|
+
const InputGallery = ({ endpoint, label = "Gallery", name = "gallery", onUpdate, organization, reposition: repositions = false }) => {
|
|
47
|
+
var _a, _b;
|
|
48
|
+
const queryClient = (0, import_react_query.useQueryClient)();
|
|
49
|
+
const modal = (0, import_hooks.useModal)({ queryClient });
|
|
50
|
+
const { control, formState, getValues, setValue } = (0, import_react_hook_form.useFormContext)();
|
|
51
|
+
const gallery = (0, import_react_hook_form.useWatch)({ control, name }) || [];
|
|
52
|
+
const taken = () => (getValues(name) || []).map((item) => {
|
|
53
|
+
var _a2;
|
|
54
|
+
return (_a2 = item == null ? void 0 : item.file) == null ? void 0 : _a2.id;
|
|
55
|
+
}).filter(Boolean);
|
|
56
|
+
const change = (path, value) => {
|
|
57
|
+
setValue(path, value, { shouldDirty: true });
|
|
58
|
+
onUpdate == null ? void 0 : onUpdate(getValues());
|
|
59
|
+
};
|
|
60
|
+
const reposition = (index) => {
|
|
61
|
+
var _a2, _b2;
|
|
62
|
+
const item = getValues(name + "." + index);
|
|
63
|
+
modal.open({
|
|
64
|
+
message: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
65
|
+
FormReposition,
|
|
66
|
+
{
|
|
67
|
+
...{
|
|
68
|
+
file: item == null ? void 0 : item.file,
|
|
69
|
+
onDone: (position) => {
|
|
70
|
+
change(name + "." + index + ".position", position);
|
|
71
|
+
modal.close();
|
|
72
|
+
},
|
|
73
|
+
page: getValues(),
|
|
74
|
+
position: item == null ? void 0 : item.position
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
),
|
|
78
|
+
title: ((_b2 = (_a2 = item == null ? void 0 : item.file) == null ? void 0 : _a2.mimetype) == null ? void 0 : _b2.includes("video")) ? "Reposition video" : "Reposition photo"
|
|
79
|
+
});
|
|
80
|
+
};
|
|
81
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
82
|
+
import_input_group.default,
|
|
83
|
+
{
|
|
84
|
+
...{
|
|
85
|
+
error: (_b = (_a = formState == null ? void 0 : formState.errors) == null ? void 0 : _a[name]) == null ? void 0 : _b.message,
|
|
86
|
+
input: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
87
|
+
import_input_array.InputArraySortable,
|
|
88
|
+
{
|
|
89
|
+
...{
|
|
90
|
+
control,
|
|
91
|
+
"data-guide": "form-input-gallery",
|
|
92
|
+
empty: "Gallery is empty",
|
|
93
|
+
name,
|
|
94
|
+
onSort: () => onUpdate == null ? void 0 : onUpdate(getValues()),
|
|
95
|
+
renderButton: (append) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
96
|
+
import_input_file.default,
|
|
97
|
+
{
|
|
98
|
+
...{
|
|
99
|
+
button: {
|
|
100
|
+
icon: import_plus.default,
|
|
101
|
+
text: "Add gallery item"
|
|
102
|
+
},
|
|
103
|
+
endpoint,
|
|
104
|
+
filters: {
|
|
105
|
+
id: {
|
|
106
|
+
$nin: taken()
|
|
107
|
+
}
|
|
108
|
+
},
|
|
109
|
+
onChange: (response) => {
|
|
110
|
+
append({ file: response });
|
|
111
|
+
onUpdate == null ? void 0 : onUpdate(getValues());
|
|
112
|
+
},
|
|
113
|
+
organization,
|
|
114
|
+
nullable: false,
|
|
115
|
+
value: null,
|
|
116
|
+
type: "media"
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
),
|
|
120
|
+
renderControls: ({ index, remove }) => [
|
|
121
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
122
|
+
import_input_array.InputArrayControl,
|
|
123
|
+
{
|
|
124
|
+
...{
|
|
125
|
+
onClick: () => {
|
|
126
|
+
remove(index);
|
|
127
|
+
onUpdate == null ? void 0 : onUpdate(getValues());
|
|
128
|
+
},
|
|
129
|
+
icon: import_trash.default
|
|
130
|
+
}
|
|
131
|
+
},
|
|
132
|
+
"gallery-control-remove-" + index
|
|
133
|
+
)
|
|
134
|
+
]
|
|
135
|
+
},
|
|
136
|
+
children: ({ field, handle, index, update }) => {
|
|
137
|
+
var _a2, _b2, _c, _d, _e, _f, _g, _h, _i;
|
|
138
|
+
const item = gallery[index] || field;
|
|
139
|
+
const editable = /^(image|video)\//.test(((_a2 = item == null ? void 0 : item.file) == null ? void 0 : _a2.mimetype) || "");
|
|
140
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
141
|
+
"div",
|
|
142
|
+
{
|
|
143
|
+
...{
|
|
144
|
+
className: "flex items-center min-w-0 flex-1 space-x-3"
|
|
145
|
+
},
|
|
146
|
+
children: [
|
|
147
|
+
handle,
|
|
148
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
149
|
+
import_input_group.default,
|
|
150
|
+
{
|
|
151
|
+
...{
|
|
152
|
+
error: ((_e = (_d = (_c = (_b2 = formState == null ? void 0 : formState.errors) == null ? void 0 : _b2[name]) == null ? void 0 : _c[index]) == null ? void 0 : _d.file) == null ? void 0 : _e.message) || ((_i = (_h = (_g = (_f = formState == null ? void 0 : formState.errors) == null ? void 0 : _f[name]) == null ? void 0 : _g[index]) == null ? void 0 : _h.description) == null ? void 0 : _i.message),
|
|
153
|
+
input: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
154
|
+
import_input_file.default,
|
|
155
|
+
{
|
|
156
|
+
...{
|
|
157
|
+
// The item's own description and crop.
|
|
158
|
+
description: item == null ? void 0 : item.description,
|
|
159
|
+
edited: Boolean(item == null ? void 0 : item.position),
|
|
160
|
+
endpoint,
|
|
161
|
+
filters: {
|
|
162
|
+
id: {
|
|
163
|
+
$nin: taken()
|
|
164
|
+
}
|
|
165
|
+
},
|
|
166
|
+
// Another file is another item: no description, no crop.
|
|
167
|
+
onChange: (response) => {
|
|
168
|
+
update(
|
|
169
|
+
index,
|
|
170
|
+
{
|
|
171
|
+
file: response
|
|
172
|
+
}
|
|
173
|
+
);
|
|
174
|
+
onUpdate == null ? void 0 : onUpdate(getValues());
|
|
175
|
+
},
|
|
176
|
+
onDescription: (text) => change(name + "." + index + ".description", text),
|
|
177
|
+
...repositions && editable && {
|
|
178
|
+
onEdit: () => reposition(index)
|
|
179
|
+
},
|
|
180
|
+
organization,
|
|
181
|
+
nullable: false,
|
|
182
|
+
value: item == null ? void 0 : item.file,
|
|
183
|
+
type: "media"
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
)
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
)
|
|
190
|
+
]
|
|
191
|
+
}
|
|
192
|
+
);
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
),
|
|
196
|
+
label
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
) });
|
|
200
|
+
};
|
|
201
|
+
var input_gallery_default = InputGallery;
|
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Fragment } from "react";
|
|
3
|
+
import { useFormContext, useWatch } from "react-hook-form";
|
|
4
|
+
import { useQueryClient } from "@tanstack/react-query";
|
|
5
|
+
import dynamic from "next/dynamic";
|
|
6
|
+
import InputGroup from "../input-group.mjs";
|
|
7
|
+
import { InputArrayControl, InputArraySortable } from "./input-array.mjs";
|
|
8
|
+
import InputFile from "./input-file.mjs";
|
|
9
|
+
import { useModal } from "./lib/hooks.mjs";
|
|
10
|
+
import { LoaderDynamic } from "../shared/loader.mjs";
|
|
11
|
+
import Plus from "../icons/plus.mjs";
|
|
12
|
+
import Trash from "../icons/trash.mjs";
|
|
13
|
+
const FormReposition = dynamic(() => import("./form-reposition.mjs"), { loading: () => /* @__PURE__ */ jsx(LoaderDynamic, {}), ssr: false });
|
|
14
|
+
const InputGallery = ({ endpoint, label = "Gallery", name = "gallery", onUpdate, organization, reposition: repositions = false }) => {
|
|
15
|
+
var _a, _b;
|
|
16
|
+
const queryClient = useQueryClient();
|
|
17
|
+
const modal = useModal({ queryClient });
|
|
18
|
+
const { control, formState, getValues, setValue } = useFormContext();
|
|
19
|
+
const gallery = useWatch({ control, name }) || [];
|
|
20
|
+
const taken = () => (getValues(name) || []).map((item) => {
|
|
21
|
+
var _a2;
|
|
22
|
+
return (_a2 = item == null ? void 0 : item.file) == null ? void 0 : _a2.id;
|
|
23
|
+
}).filter(Boolean);
|
|
24
|
+
const change = (path, value) => {
|
|
25
|
+
setValue(path, value, { shouldDirty: true });
|
|
26
|
+
onUpdate == null ? void 0 : onUpdate(getValues());
|
|
27
|
+
};
|
|
28
|
+
const reposition = (index) => {
|
|
29
|
+
var _a2, _b2;
|
|
30
|
+
const item = getValues(name + "." + index);
|
|
31
|
+
modal.open({
|
|
32
|
+
message: /* @__PURE__ */ jsx(
|
|
33
|
+
FormReposition,
|
|
34
|
+
{
|
|
35
|
+
...{
|
|
36
|
+
file: item == null ? void 0 : item.file,
|
|
37
|
+
onDone: (position) => {
|
|
38
|
+
change(name + "." + index + ".position", position);
|
|
39
|
+
modal.close();
|
|
40
|
+
},
|
|
41
|
+
page: getValues(),
|
|
42
|
+
position: item == null ? void 0 : item.position
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
),
|
|
46
|
+
title: ((_b2 = (_a2 = item == null ? void 0 : item.file) == null ? void 0 : _a2.mimetype) == null ? void 0 : _b2.includes("video")) ? "Reposition video" : "Reposition photo"
|
|
47
|
+
});
|
|
48
|
+
};
|
|
49
|
+
return /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsx(
|
|
50
|
+
InputGroup,
|
|
51
|
+
{
|
|
52
|
+
...{
|
|
53
|
+
error: (_b = (_a = formState == null ? void 0 : formState.errors) == null ? void 0 : _a[name]) == null ? void 0 : _b.message,
|
|
54
|
+
input: /* @__PURE__ */ jsx(
|
|
55
|
+
InputArraySortable,
|
|
56
|
+
{
|
|
57
|
+
...{
|
|
58
|
+
control,
|
|
59
|
+
"data-guide": "form-input-gallery",
|
|
60
|
+
empty: "Gallery is empty",
|
|
61
|
+
name,
|
|
62
|
+
onSort: () => onUpdate == null ? void 0 : onUpdate(getValues()),
|
|
63
|
+
renderButton: (append) => /* @__PURE__ */ jsx(
|
|
64
|
+
InputFile,
|
|
65
|
+
{
|
|
66
|
+
...{
|
|
67
|
+
button: {
|
|
68
|
+
icon: Plus,
|
|
69
|
+
text: "Add gallery item"
|
|
70
|
+
},
|
|
71
|
+
endpoint,
|
|
72
|
+
filters: {
|
|
73
|
+
id: {
|
|
74
|
+
$nin: taken()
|
|
75
|
+
}
|
|
76
|
+
},
|
|
77
|
+
onChange: (response) => {
|
|
78
|
+
append({ file: response });
|
|
79
|
+
onUpdate == null ? void 0 : onUpdate(getValues());
|
|
80
|
+
},
|
|
81
|
+
organization,
|
|
82
|
+
nullable: false,
|
|
83
|
+
value: null,
|
|
84
|
+
type: "media"
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
),
|
|
88
|
+
renderControls: ({ index, remove }) => [
|
|
89
|
+
/* @__PURE__ */ jsx(
|
|
90
|
+
InputArrayControl,
|
|
91
|
+
{
|
|
92
|
+
...{
|
|
93
|
+
onClick: () => {
|
|
94
|
+
remove(index);
|
|
95
|
+
onUpdate == null ? void 0 : onUpdate(getValues());
|
|
96
|
+
},
|
|
97
|
+
icon: Trash
|
|
98
|
+
}
|
|
99
|
+
},
|
|
100
|
+
"gallery-control-remove-" + index
|
|
101
|
+
)
|
|
102
|
+
]
|
|
103
|
+
},
|
|
104
|
+
children: ({ field, handle, index, update }) => {
|
|
105
|
+
var _a2, _b2, _c, _d, _e, _f, _g, _h, _i;
|
|
106
|
+
const item = gallery[index] || field;
|
|
107
|
+
const editable = /^(image|video)\//.test(((_a2 = item == null ? void 0 : item.file) == null ? void 0 : _a2.mimetype) || "");
|
|
108
|
+
return /* @__PURE__ */ jsxs(
|
|
109
|
+
"div",
|
|
110
|
+
{
|
|
111
|
+
...{
|
|
112
|
+
className: "flex items-center min-w-0 flex-1 space-x-3"
|
|
113
|
+
},
|
|
114
|
+
children: [
|
|
115
|
+
handle,
|
|
116
|
+
/* @__PURE__ */ jsx(
|
|
117
|
+
InputGroup,
|
|
118
|
+
{
|
|
119
|
+
...{
|
|
120
|
+
error: ((_e = (_d = (_c = (_b2 = formState == null ? void 0 : formState.errors) == null ? void 0 : _b2[name]) == null ? void 0 : _c[index]) == null ? void 0 : _d.file) == null ? void 0 : _e.message) || ((_i = (_h = (_g = (_f = formState == null ? void 0 : formState.errors) == null ? void 0 : _f[name]) == null ? void 0 : _g[index]) == null ? void 0 : _h.description) == null ? void 0 : _i.message),
|
|
121
|
+
input: /* @__PURE__ */ jsx(
|
|
122
|
+
InputFile,
|
|
123
|
+
{
|
|
124
|
+
...{
|
|
125
|
+
// The item's own description and crop.
|
|
126
|
+
description: item == null ? void 0 : item.description,
|
|
127
|
+
edited: Boolean(item == null ? void 0 : item.position),
|
|
128
|
+
endpoint,
|
|
129
|
+
filters: {
|
|
130
|
+
id: {
|
|
131
|
+
$nin: taken()
|
|
132
|
+
}
|
|
133
|
+
},
|
|
134
|
+
// Another file is another item: no description, no crop.
|
|
135
|
+
onChange: (response) => {
|
|
136
|
+
update(
|
|
137
|
+
index,
|
|
138
|
+
{
|
|
139
|
+
file: response
|
|
140
|
+
}
|
|
141
|
+
);
|
|
142
|
+
onUpdate == null ? void 0 : onUpdate(getValues());
|
|
143
|
+
},
|
|
144
|
+
onDescription: (text) => change(name + "." + index + ".description", text),
|
|
145
|
+
...repositions && editable && {
|
|
146
|
+
onEdit: () => reposition(index)
|
|
147
|
+
},
|
|
148
|
+
organization,
|
|
149
|
+
nullable: false,
|
|
150
|
+
value: item == null ? void 0 : item.file,
|
|
151
|
+
type: "media"
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
)
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
)
|
|
158
|
+
]
|
|
159
|
+
}
|
|
160
|
+
);
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
),
|
|
164
|
+
label
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
) });
|
|
168
|
+
};
|
|
169
|
+
var input_gallery_default = InputGallery;
|
|
170
|
+
export {
|
|
171
|
+
input_gallery_default as default
|
|
172
|
+
};
|
|
@@ -31,6 +31,7 @@ __export(input_group_ai_exports, {
|
|
|
31
31
|
});
|
|
32
32
|
module.exports = __toCommonJS(input_group_ai_exports);
|
|
33
33
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
34
|
+
var import_react = require("react");
|
|
34
35
|
var import_react_query = require("@tanstack/react-query");
|
|
35
36
|
var import_form_ai = require("./form-ai");
|
|
36
37
|
var import_error = __toESM(require("../shared/error"));
|
|
@@ -50,6 +51,7 @@ const InputGroupAI = ({
|
|
|
50
51
|
...rest
|
|
51
52
|
}) => {
|
|
52
53
|
const queryClient = (0, import_react_query.useQueryClient)();
|
|
54
|
+
const id = (0, import_react.useId)();
|
|
53
55
|
const classes = [
|
|
54
56
|
"input-group"
|
|
55
57
|
];
|
|
@@ -80,13 +82,21 @@ const InputGroupAI = ({
|
|
|
80
82
|
},
|
|
81
83
|
children: [
|
|
82
84
|
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
83
|
-
"
|
|
85
|
+
"div",
|
|
84
86
|
{
|
|
85
87
|
...{
|
|
86
88
|
className: "flex items-center justify-between"
|
|
87
89
|
},
|
|
88
90
|
children: [
|
|
89
|
-
|
|
91
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
92
|
+
"label",
|
|
93
|
+
{
|
|
94
|
+
...{
|
|
95
|
+
htmlFor: id
|
|
96
|
+
},
|
|
97
|
+
children: label
|
|
98
|
+
}
|
|
99
|
+
),
|
|
90
100
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
91
101
|
import_button.default,
|
|
92
102
|
{
|
|
@@ -128,7 +138,9 @@ const InputGroupAI = ({
|
|
|
128
138
|
]
|
|
129
139
|
}
|
|
130
140
|
),
|
|
131
|
-
input
|
|
141
|
+
(0, import_react.isValidElement)(input) ? (0, import_react.cloneElement)(input, {
|
|
142
|
+
id: input.props.id || id
|
|
143
|
+
}) : input
|
|
132
144
|
]
|
|
133
145
|
}
|
|
134
146
|
),
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { cloneElement, isValidElement, useId } from "react";
|
|
2
3
|
import { useQueryClient } from "@tanstack/react-query";
|
|
3
4
|
import { FormAiText } from "./form-ai.mjs";
|
|
4
5
|
import Error from "../shared/error.mjs";
|
|
@@ -18,6 +19,7 @@ const InputGroupAI = ({
|
|
|
18
19
|
...rest
|
|
19
20
|
}) => {
|
|
20
21
|
const queryClient = useQueryClient();
|
|
22
|
+
const id = useId();
|
|
21
23
|
const classes = [
|
|
22
24
|
"input-group"
|
|
23
25
|
];
|
|
@@ -48,13 +50,21 @@ const InputGroupAI = ({
|
|
|
48
50
|
},
|
|
49
51
|
children: [
|
|
50
52
|
/* @__PURE__ */ jsxs(
|
|
51
|
-
"
|
|
53
|
+
"div",
|
|
52
54
|
{
|
|
53
55
|
...{
|
|
54
56
|
className: "flex items-center justify-between"
|
|
55
57
|
},
|
|
56
58
|
children: [
|
|
57
|
-
|
|
59
|
+
/* @__PURE__ */ jsx(
|
|
60
|
+
"label",
|
|
61
|
+
{
|
|
62
|
+
...{
|
|
63
|
+
htmlFor: id
|
|
64
|
+
},
|
|
65
|
+
children: label
|
|
66
|
+
}
|
|
67
|
+
),
|
|
58
68
|
/* @__PURE__ */ jsx(
|
|
59
69
|
Button,
|
|
60
70
|
{
|
|
@@ -96,7 +106,9 @@ const InputGroupAI = ({
|
|
|
96
106
|
]
|
|
97
107
|
}
|
|
98
108
|
),
|
|
99
|
-
input
|
|
109
|
+
isValidElement(input) ? cloneElement(input, {
|
|
110
|
+
id: input.props.id || id
|
|
111
|
+
}) : input
|
|
100
112
|
]
|
|
101
113
|
}
|
|
102
114
|
),
|
|
@@ -72,7 +72,7 @@ const lines = (total) => total > 3 ? ["actions", "campaigns", "connections", "co
|
|
|
72
72
|
const variantAction = (row) => (row == null ? void 0 : row.disabled) ? "enable" : (row == null ? void 0 : row.leads) ? "disable" : "delete";
|
|
73
73
|
const variantHref = ({ campaign, main, organization, test, variant }) => {
|
|
74
74
|
const base = "/organizations/" + organization + "/campaigns/" + campaign;
|
|
75
|
-
return main || !test ? base + "/
|
|
75
|
+
return main || !test ? base + "/design" : base + "/tests/" + test + "/variants/" + variant;
|
|
76
76
|
};
|
|
77
77
|
const variantPage = ({ campaign, organization, test, variant }) => ({
|
|
78
78
|
back: test ? "/organizations/" + organization + "/campaigns/" + campaign + "/tests/" + test : void 0,
|
|
@@ -110,7 +110,7 @@ const variantSaved = ({ campaign, organization }) => [
|
|
|
110
110
|
];
|
|
111
111
|
const variantPreview = (campaign) => {
|
|
112
112
|
var _a, _b, _c;
|
|
113
|
-
return ((_a = campaign == null ? void 0 : campaign.share) == null ? void 0 : _a.url) + (((_c = (_b = campaign == null ? void 0 : campaign.tokens) == null ? void 0 : _b.admin) == null ? void 0 : _c.text) ? "?drwbrdg_pre=" + campaign.tokens.admin.text : "");
|
|
113
|
+
return ((_a = campaign == null ? void 0 : campaign.share) == null ? void 0 : _a.url) ? campaign.share.url + (((_c = (_b = campaign == null ? void 0 : campaign.tokens) == null ? void 0 : _b.admin) == null ? void 0 : _c.text) ? "?drwbrdg_pre=" + campaign.tokens.admin.text : "") : null;
|
|
114
114
|
};
|
|
115
115
|
// Annotate the CommonJS export names for ESM import in node:
|
|
116
116
|
0 && (module.exports = {
|
|
@@ -36,7 +36,7 @@ const lines = (total) => total > 3 ? ["actions", "campaigns", "connections", "co
|
|
|
36
36
|
const variantAction = (row) => (row == null ? void 0 : row.disabled) ? "enable" : (row == null ? void 0 : row.leads) ? "disable" : "delete";
|
|
37
37
|
const variantHref = ({ campaign, main, organization, test, variant }) => {
|
|
38
38
|
const base = "/organizations/" + organization + "/campaigns/" + campaign;
|
|
39
|
-
return main || !test ? base + "/
|
|
39
|
+
return main || !test ? base + "/design" : base + "/tests/" + test + "/variants/" + variant;
|
|
40
40
|
};
|
|
41
41
|
const variantPage = ({ campaign, organization, test, variant }) => ({
|
|
42
42
|
back: test ? "/organizations/" + organization + "/campaigns/" + campaign + "/tests/" + test : void 0,
|
|
@@ -74,7 +74,7 @@ const variantSaved = ({ campaign, organization }) => [
|
|
|
74
74
|
];
|
|
75
75
|
const variantPreview = (campaign) => {
|
|
76
76
|
var _a, _b, _c;
|
|
77
|
-
return ((_a = campaign == null ? void 0 : campaign.share) == null ? void 0 : _a.url) + (((_c = (_b = campaign == null ? void 0 : campaign.tokens) == null ? void 0 : _b.admin) == null ? void 0 : _c.text) ? "?drwbrdg_pre=" + campaign.tokens.admin.text : "");
|
|
77
|
+
return ((_a = campaign == null ? void 0 : campaign.share) == null ? void 0 : _a.url) ? campaign.share.url + (((_c = (_b = campaign == null ? void 0 : campaign.tokens) == null ? void 0 : _b.admin) == null ? void 0 : _c.text) ? "?drwbrdg_pre=" + campaign.tokens.admin.text : "") : null;
|
|
78
78
|
};
|
|
79
79
|
export {
|
|
80
80
|
WEEK,
|
|
@@ -18,7 +18,8 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
18
18
|
var connection_controls_exports = {};
|
|
19
19
|
__export(connection_controls_exports, {
|
|
20
20
|
connectionControls: () => connectionControls,
|
|
21
|
-
isConnected: () => isConnected
|
|
21
|
+
isConnected: () => isConnected,
|
|
22
|
+
savable: () => savable
|
|
22
23
|
});
|
|
23
24
|
module.exports = __toCommonJS(connection_controls_exports);
|
|
24
25
|
var import_reconnect = require("@drawbridge/drawbridge-utils/connections/reconnect");
|
|
@@ -31,8 +32,10 @@ const connectionControls = (connection) => {
|
|
|
31
32
|
remove: (connection == null ? void 0 : connection.id) ? ((_a = connection == null ? void 0 : connection.connect) == null ? void 0 : _a.manage) && !paused ? "manage" : "disconnect" : null
|
|
32
33
|
};
|
|
33
34
|
};
|
|
35
|
+
const savable = ({ actions, connected, inputs }) => !connected || (inputs || []).length > 0 || Boolean(actions == null ? void 0 : actions.update);
|
|
34
36
|
// Annotate the CommonJS export names for ESM import in node:
|
|
35
37
|
0 && (module.exports = {
|
|
36
38
|
connectionControls,
|
|
37
|
-
isConnected
|
|
39
|
+
isConnected,
|
|
40
|
+
savable
|
|
38
41
|
});
|
|
@@ -8,7 +8,9 @@ const connectionControls = (connection) => {
|
|
|
8
8
|
remove: (connection == null ? void 0 : connection.id) ? ((_a = connection == null ? void 0 : connection.connect) == null ? void 0 : _a.manage) && !paused ? "manage" : "disconnect" : null
|
|
9
9
|
};
|
|
10
10
|
};
|
|
11
|
+
const savable = ({ actions, connected, inputs }) => !connected || (inputs || []).length > 0 || Boolean(actions == null ? void 0 : actions.update);
|
|
11
12
|
export {
|
|
12
13
|
connectionControls,
|
|
13
|
-
isConnected
|
|
14
|
+
isConnected,
|
|
15
|
+
savable
|
|
14
16
|
};
|
|
@@ -51,7 +51,7 @@ const MAX_ADS = 5;
|
|
|
51
51
|
const adsLimit = (count) => count >= MAX_ADS ? "A campaign can have up to " + MAX_ADS + " advertisements." : null;
|
|
52
52
|
const advertisementsKey = (params) => ["campaign-advertisements", params == null ? void 0 : params.organization, params == null ? void 0 : params.campaign];
|
|
53
53
|
const AFTER = ["message", "missions", "advertisements"];
|
|
54
|
-
const once = ["email", "name", "note", "phone", "pickup"];
|
|
54
|
+
const once = ["birthday", "email", "name", "note", "phone", "pickup"];
|
|
55
55
|
const addedOnce = (slug, keys = []) => once.includes(slug) && (keys || []).includes(slug);
|
|
56
56
|
const planLocked = (section) => Boolean(section == null ? void 0 : section.task) && Boolean((section == null ? void 0 : section.locked) || (section == null ? void 0 : section.disabled));
|
|
57
57
|
const giveawayLocked = (section) => (section == null ? void 0 : section.type) === "order" && Boolean(section == null ? void 0 : section.giveaway);
|
|
@@ -4,7 +4,7 @@ const MAX_ADS = 5;
|
|
|
4
4
|
const adsLimit = (count) => count >= MAX_ADS ? "A campaign can have up to " + MAX_ADS + " advertisements." : null;
|
|
5
5
|
const advertisementsKey = (params) => ["campaign-advertisements", params == null ? void 0 : params.organization, params == null ? void 0 : params.campaign];
|
|
6
6
|
const AFTER = ["message", "missions", "advertisements"];
|
|
7
|
-
const once = ["email", "name", "note", "phone", "pickup"];
|
|
7
|
+
const once = ["birthday", "email", "name", "note", "phone", "pickup"];
|
|
8
8
|
const addedOnce = (slug, keys = []) => once.includes(slug) && (keys || []).includes(slug);
|
|
9
9
|
const planLocked = (section) => Boolean(section == null ? void 0 : section.task) && Boolean((section == null ? void 0 : section.locked) || (section == null ? void 0 : section.disabled));
|
|
10
10
|
const giveawayLocked = (section) => (section == null ? void 0 : section.type) === "order" && Boolean(section == null ? void 0 : section.giveaway);
|
|
@@ -17,6 +17,7 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
17
17
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
18
|
var menu_exports = {};
|
|
19
19
|
__export(menu_exports, {
|
|
20
|
+
headerSettings: () => headerSettings,
|
|
20
21
|
isActive: () => isActive,
|
|
21
22
|
menuRow: () => menuRow
|
|
22
23
|
});
|
|
@@ -43,8 +44,26 @@ const menuRow = (row = {}, path = "") => {
|
|
|
43
44
|
open
|
|
44
45
|
};
|
|
45
46
|
};
|
|
47
|
+
const headerSettings = ({ campaign, organization, params, path }) => {
|
|
48
|
+
var _a, _b, _c, _d;
|
|
49
|
+
if (!(params == null ? void 0 : params.organization)) return null;
|
|
50
|
+
const base = "/organizations/" + params.organization + (params.campaign ? "/campaigns/" + params.campaign : "");
|
|
51
|
+
const capabilities = (organization == null ? void 0 : organization.capabilities) || {};
|
|
52
|
+
const open = params.campaign ? (_a = capabilities == null ? void 0 : capabilities.campaigns) == null ? void 0 : _a.settings : capabilities.settings || capabilities.members || capabilities.exports;
|
|
53
|
+
const level = params.campaign ? campaign : organization;
|
|
54
|
+
const list = ((_b = level == null ? void 0 : level.tasks) == null ? void 0 : _b.list) || {};
|
|
55
|
+
if (!open) return null;
|
|
56
|
+
return {
|
|
57
|
+
// Lit on Settings and on the pages it opens ( Members, Exports ).
|
|
58
|
+
active: path === base + "/settings" || String(path).startsWith(base + "/settings/"),
|
|
59
|
+
// Members' next steps ride the organization's gear, as Members opens from it.
|
|
60
|
+
error: Boolean(((_c = list.settings) == null ? void 0 : _c.count) || !params.campaign && ((_d = list.members) == null ? void 0 : _d.count)),
|
|
61
|
+
href: base + "/settings"
|
|
62
|
+
};
|
|
63
|
+
};
|
|
46
64
|
// Annotate the CommonJS export names for ESM import in node:
|
|
47
65
|
0 && (module.exports = {
|
|
66
|
+
headerSettings,
|
|
48
67
|
isActive,
|
|
49
68
|
menuRow
|
|
50
69
|
});
|
|
@@ -20,7 +20,25 @@ const menuRow = (row = {}, path = "") => {
|
|
|
20
20
|
open
|
|
21
21
|
};
|
|
22
22
|
};
|
|
23
|
+
const headerSettings = ({ campaign, organization, params, path }) => {
|
|
24
|
+
var _a, _b, _c, _d;
|
|
25
|
+
if (!(params == null ? void 0 : params.organization)) return null;
|
|
26
|
+
const base = "/organizations/" + params.organization + (params.campaign ? "/campaigns/" + params.campaign : "");
|
|
27
|
+
const capabilities = (organization == null ? void 0 : organization.capabilities) || {};
|
|
28
|
+
const open = params.campaign ? (_a = capabilities == null ? void 0 : capabilities.campaigns) == null ? void 0 : _a.settings : capabilities.settings || capabilities.members || capabilities.exports;
|
|
29
|
+
const level = params.campaign ? campaign : organization;
|
|
30
|
+
const list = ((_b = level == null ? void 0 : level.tasks) == null ? void 0 : _b.list) || {};
|
|
31
|
+
if (!open) return null;
|
|
32
|
+
return {
|
|
33
|
+
// Lit on Settings and on the pages it opens ( Members, Exports ).
|
|
34
|
+
active: path === base + "/settings" || String(path).startsWith(base + "/settings/"),
|
|
35
|
+
// Members' next steps ride the organization's gear, as Members opens from it.
|
|
36
|
+
error: Boolean(((_c = list.settings) == null ? void 0 : _c.count) || !params.campaign && ((_d = list.members) == null ? void 0 : _d.count)),
|
|
37
|
+
href: base + "/settings"
|
|
38
|
+
};
|
|
39
|
+
};
|
|
23
40
|
export {
|
|
41
|
+
headerSettings,
|
|
24
42
|
isActive,
|
|
25
43
|
menuRow
|
|
26
44
|
};
|