@drawbridge/components 0.1.15 → 0.1.16
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/lib/url.js +3 -3
- package/dist/bridge/lib/url.mjs +3 -3
- package/dist/bridge/share-button.js +12 -2
- package/dist/bridge/share-button.mjs +12 -2
- package/dist/bridge/template-layout.js +1 -1
- package/dist/bridge/template-layout.mjs +1 -1
- package/dist/dashboard/answer-rows.js +77 -0
- package/dist/dashboard/answer-rows.mjs +41 -0
- package/dist/dashboard/card-order.js +186 -243
- package/dist/dashboard/card-order.mjs +186 -243
- package/dist/dashboard/form-organization-campaign-field-list.js +8 -49
- package/dist/dashboard/form-organization-campaign-field-list.mjs +8 -49
- package/dist/dashboard/form-organization-workflow.js +70 -120
- package/dist/dashboard/form-organization-workflow.mjs +68 -120
- package/dist/dashboard/item-row.js +92 -0
- package/dist/dashboard/item-row.mjs +63 -0
- package/dist/dashboard/lib/sms.js +3 -0
- package/dist/dashboard/lib/sms.mjs +2 -0
- package/dist/dashboard/order-sections.js +220 -0
- package/dist/dashboard/order-sections.mjs +185 -0
- package/dist/dashboard/preview.js +29 -2
- package/dist/dashboard/preview.mjs +28 -2
- package/dist/shared/lib/helpers.js +7 -0
- package/dist/shared/lib/helpers.mjs +7 -0
- package/package.json +19 -4
- package/types/bridge/lib/url.d.ts +5 -4
- package/types/dashboard/answer-rows.d.ts +30 -0
- package/types/dashboard/card-order.d.ts +16 -14
- package/types/dashboard/form-organization-workflow.d.ts +2 -0
- package/types/dashboard/item-row.d.ts +25 -0
- package/types/dashboard/order-sections.d.ts +36 -0
- package/types/shared/lib/helpers.d.ts +1 -1
package/dist/bridge/lib/url.js
CHANGED
|
@@ -58,9 +58,9 @@ const submissionEndpoint = ({ affiliate, id, slug, subdomain, token }) => {
|
|
|
58
58
|
const query = params.toString();
|
|
59
59
|
return "/subdomain/" + subdomain + "/page/" + slug + "/submission/" + encodeURIComponent(id) + (query ? "?" + query : "");
|
|
60
60
|
};
|
|
61
|
-
const leadEndpoint = ({
|
|
62
|
-
if (typeof
|
|
63
|
-
return "/subdomain/" + subdomain + "/page/" + slug + "/lead/" +
|
|
61
|
+
const leadEndpoint = ({ code, slug, subdomain, token }) => {
|
|
62
|
+
if (typeof code !== "string" || !/^[0-9a-z]{12}$/.test(code)) return null;
|
|
63
|
+
return "/subdomain/" + subdomain + "/page/" + slug + "/lead/" + code + (token ? "?drwbrdg_pre=" + encodeURIComponent(token) : "");
|
|
64
64
|
};
|
|
65
65
|
const missionEndpoint = ({ action, slug, subdomain, type }) => "/subdomain/" + subdomain + "/page/" + slug + "/mission/" + type + "/" + action;
|
|
66
66
|
// Annotate the CommonJS export names for ESM import in node:
|
package/dist/bridge/lib/url.mjs
CHANGED
|
@@ -32,9 +32,9 @@ const submissionEndpoint = ({ affiliate, id, slug, subdomain, token }) => {
|
|
|
32
32
|
const query = params.toString();
|
|
33
33
|
return "/subdomain/" + subdomain + "/page/" + slug + "/submission/" + encodeURIComponent(id) + (query ? "?" + query : "");
|
|
34
34
|
};
|
|
35
|
-
const leadEndpoint = ({
|
|
36
|
-
if (typeof
|
|
37
|
-
return "/subdomain/" + subdomain + "/page/" + slug + "/lead/" +
|
|
35
|
+
const leadEndpoint = ({ code, slug, subdomain, token }) => {
|
|
36
|
+
if (typeof code !== "string" || !/^[0-9a-z]{12}$/.test(code)) return null;
|
|
37
|
+
return "/subdomain/" + subdomain + "/page/" + slug + "/lead/" + code + (token ? "?drwbrdg_pre=" + encodeURIComponent(token) : "");
|
|
38
38
|
};
|
|
39
39
|
const missionEndpoint = ({ action, slug, subdomain, type }) => "/subdomain/" + subdomain + "/page/" + slug + "/mission/" + type + "/" + action;
|
|
40
40
|
export {
|
|
@@ -50,15 +50,18 @@ const ShareButton = ({
|
|
|
50
50
|
const brandButton = style && (0, import_styles.buttonStyle)(style);
|
|
51
51
|
const icon = {
|
|
52
52
|
bgStyle: { fill: (brandButton == null ? void 0 : brandButton.backgroundColor) || "var(--color-black)" },
|
|
53
|
+
className: "w-full h-auto max-w-[40px]",
|
|
53
54
|
iconFillColor: (brandButton == null ? void 0 : brandButton.color) || "var(--color-white)",
|
|
54
55
|
round: true,
|
|
55
56
|
size: iconSize
|
|
56
57
|
};
|
|
58
|
+
const className = "w-full justify-center";
|
|
57
59
|
const icons = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_react.Fragment, { children: [
|
|
58
60
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
59
61
|
import_react_share.FacebookShareButton,
|
|
60
62
|
{
|
|
61
63
|
...{
|
|
64
|
+
className,
|
|
62
65
|
disabled,
|
|
63
66
|
onClick,
|
|
64
67
|
url: values == null ? void 0 : values.url
|
|
@@ -75,6 +78,7 @@ const ShareButton = ({
|
|
|
75
78
|
import_react_share.XShareButton,
|
|
76
79
|
{
|
|
77
80
|
...{
|
|
81
|
+
className,
|
|
78
82
|
disabled,
|
|
79
83
|
onClick,
|
|
80
84
|
title: values == null ? void 0 : values.headline,
|
|
@@ -92,6 +96,7 @@ const ShareButton = ({
|
|
|
92
96
|
import_react_share.LinkedinShareButton,
|
|
93
97
|
{
|
|
94
98
|
...{
|
|
99
|
+
className,
|
|
95
100
|
disabled,
|
|
96
101
|
onClick,
|
|
97
102
|
summary: values == null ? void 0 : values.description,
|
|
@@ -110,6 +115,7 @@ const ShareButton = ({
|
|
|
110
115
|
import_react_share.RedditShareButton,
|
|
111
116
|
{
|
|
112
117
|
...{
|
|
118
|
+
className,
|
|
113
119
|
disabled,
|
|
114
120
|
onClick,
|
|
115
121
|
title: values == null ? void 0 : values.headline,
|
|
@@ -127,6 +133,7 @@ const ShareButton = ({
|
|
|
127
133
|
import_react_share.WhatsappShareButton,
|
|
128
134
|
{
|
|
129
135
|
...{
|
|
136
|
+
className,
|
|
130
137
|
disabled,
|
|
131
138
|
onClick,
|
|
132
139
|
title: values == null ? void 0 : values.headline,
|
|
@@ -144,6 +151,7 @@ const ShareButton = ({
|
|
|
144
151
|
import_react_share.TelegramShareButton,
|
|
145
152
|
{
|
|
146
153
|
...{
|
|
154
|
+
className,
|
|
147
155
|
disabled,
|
|
148
156
|
onClick,
|
|
149
157
|
title: values == null ? void 0 : values.headline,
|
|
@@ -161,6 +169,7 @@ const ShareButton = ({
|
|
|
161
169
|
import_react_share.ThreadsShareButton,
|
|
162
170
|
{
|
|
163
171
|
...{
|
|
172
|
+
className,
|
|
164
173
|
disabled,
|
|
165
174
|
onClick,
|
|
166
175
|
title: values == null ? void 0 : values.headline,
|
|
@@ -179,6 +188,7 @@ const ShareButton = ({
|
|
|
179
188
|
{
|
|
180
189
|
...{
|
|
181
190
|
body: values == null ? void 0 : values.description,
|
|
191
|
+
className,
|
|
182
192
|
disabled,
|
|
183
193
|
onClick,
|
|
184
194
|
subject: values == null ? void 0 : values.headline,
|
|
@@ -228,8 +238,8 @@ const ShareButton = ({
|
|
|
228
238
|
"div",
|
|
229
239
|
{
|
|
230
240
|
...{
|
|
231
|
-
// Eight 40px buttons
|
|
232
|
-
className: "
|
|
241
|
+
// Eight equal columns: 40px buttons at 11px on a 400px panel, smaller on a phone, never cut off.
|
|
242
|
+
className: "grid grid-cols-8 items-center gap-[11px]"
|
|
233
243
|
},
|
|
234
244
|
children: icons
|
|
235
245
|
}
|
|
@@ -35,15 +35,18 @@ const ShareButton = ({
|
|
|
35
35
|
const brandButton = style && buttonStyle(style);
|
|
36
36
|
const icon = {
|
|
37
37
|
bgStyle: { fill: (brandButton == null ? void 0 : brandButton.backgroundColor) || "var(--color-black)" },
|
|
38
|
+
className: "w-full h-auto max-w-[40px]",
|
|
38
39
|
iconFillColor: (brandButton == null ? void 0 : brandButton.color) || "var(--color-white)",
|
|
39
40
|
round: true,
|
|
40
41
|
size: iconSize
|
|
41
42
|
};
|
|
43
|
+
const className = "w-full justify-center";
|
|
42
44
|
const icons = /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
43
45
|
/* @__PURE__ */ jsx(
|
|
44
46
|
FacebookShareButton,
|
|
45
47
|
{
|
|
46
48
|
...{
|
|
49
|
+
className,
|
|
47
50
|
disabled,
|
|
48
51
|
onClick,
|
|
49
52
|
url: values == null ? void 0 : values.url
|
|
@@ -60,6 +63,7 @@ const ShareButton = ({
|
|
|
60
63
|
XShareButton,
|
|
61
64
|
{
|
|
62
65
|
...{
|
|
66
|
+
className,
|
|
63
67
|
disabled,
|
|
64
68
|
onClick,
|
|
65
69
|
title: values == null ? void 0 : values.headline,
|
|
@@ -77,6 +81,7 @@ const ShareButton = ({
|
|
|
77
81
|
LinkedinShareButton,
|
|
78
82
|
{
|
|
79
83
|
...{
|
|
84
|
+
className,
|
|
80
85
|
disabled,
|
|
81
86
|
onClick,
|
|
82
87
|
summary: values == null ? void 0 : values.description,
|
|
@@ -95,6 +100,7 @@ const ShareButton = ({
|
|
|
95
100
|
RedditShareButton,
|
|
96
101
|
{
|
|
97
102
|
...{
|
|
103
|
+
className,
|
|
98
104
|
disabled,
|
|
99
105
|
onClick,
|
|
100
106
|
title: values == null ? void 0 : values.headline,
|
|
@@ -112,6 +118,7 @@ const ShareButton = ({
|
|
|
112
118
|
WhatsappShareButton,
|
|
113
119
|
{
|
|
114
120
|
...{
|
|
121
|
+
className,
|
|
115
122
|
disabled,
|
|
116
123
|
onClick,
|
|
117
124
|
title: values == null ? void 0 : values.headline,
|
|
@@ -129,6 +136,7 @@ const ShareButton = ({
|
|
|
129
136
|
TelegramShareButton,
|
|
130
137
|
{
|
|
131
138
|
...{
|
|
139
|
+
className,
|
|
132
140
|
disabled,
|
|
133
141
|
onClick,
|
|
134
142
|
title: values == null ? void 0 : values.headline,
|
|
@@ -146,6 +154,7 @@ const ShareButton = ({
|
|
|
146
154
|
ThreadsShareButton,
|
|
147
155
|
{
|
|
148
156
|
...{
|
|
157
|
+
className,
|
|
149
158
|
disabled,
|
|
150
159
|
onClick,
|
|
151
160
|
title: values == null ? void 0 : values.headline,
|
|
@@ -164,6 +173,7 @@ const ShareButton = ({
|
|
|
164
173
|
{
|
|
165
174
|
...{
|
|
166
175
|
body: values == null ? void 0 : values.description,
|
|
176
|
+
className,
|
|
167
177
|
disabled,
|
|
168
178
|
onClick,
|
|
169
179
|
subject: values == null ? void 0 : values.headline,
|
|
@@ -213,8 +223,8 @@ const ShareButton = ({
|
|
|
213
223
|
"div",
|
|
214
224
|
{
|
|
215
225
|
...{
|
|
216
|
-
// Eight 40px buttons
|
|
217
|
-
className: "
|
|
226
|
+
// Eight equal columns: 40px buttons at 11px on a 400px panel, smaller on a phone, never cut off.
|
|
227
|
+
className: "grid grid-cols-8 items-center gap-[11px]"
|
|
218
228
|
},
|
|
219
229
|
children: icons
|
|
220
230
|
}
|
|
@@ -394,7 +394,7 @@ const TemplateLayout = ({
|
|
|
394
394
|
[affiliate, data, params, preview, style]
|
|
395
395
|
);
|
|
396
396
|
const leadMission = searchParams.get("mission");
|
|
397
|
-
const leadUrl = submissionId ? null : (0, import_url.leadEndpoint)({
|
|
397
|
+
const leadUrl = submissionId ? null : (0, import_url.leadEndpoint)({ code: searchParams.get("m"), slug: params == null ? void 0 : params.slug, subdomain: params == null ? void 0 : params.subdomain, token });
|
|
398
398
|
(0, import_react.useEffect)(
|
|
399
399
|
() => {
|
|
400
400
|
if (!leadUrl) return;
|
|
@@ -362,7 +362,7 @@ const TemplateLayout = ({
|
|
|
362
362
|
[affiliate, data, params, preview, style]
|
|
363
363
|
);
|
|
364
364
|
const leadMission = searchParams.get("mission");
|
|
365
|
-
const leadUrl = submissionId ? null : leadEndpoint({
|
|
365
|
+
const leadUrl = submissionId ? null : leadEndpoint({ code: searchParams.get("m"), slug: params == null ? void 0 : params.slug, subdomain: params == null ? void 0 : params.subdomain, token });
|
|
366
366
|
useEffect(
|
|
367
367
|
() => {
|
|
368
368
|
if (!leadUrl) return;
|
|
@@ -0,0 +1,77 @@
|
|
|
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 answer_rows_exports = {};
|
|
29
|
+
__export(answer_rows_exports, {
|
|
30
|
+
Removed: () => Removed,
|
|
31
|
+
answerRows: () => answerRows,
|
|
32
|
+
blank: () => blank,
|
|
33
|
+
display: () => display
|
|
34
|
+
});
|
|
35
|
+
module.exports = __toCommonJS(answer_rows_exports);
|
|
36
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
37
|
+
var import_badge = __toESM(require("../shared/badge"));
|
|
38
|
+
const blank = (value) => value === void 0 || value === null || value === "";
|
|
39
|
+
const display = (value) => {
|
|
40
|
+
if (blank(value)) return "\u2014";
|
|
41
|
+
if (value instanceof Object) return Object.values(value).join(", ");
|
|
42
|
+
return String(value);
|
|
43
|
+
};
|
|
44
|
+
const Removed = ({ children }) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
45
|
+
"span",
|
|
46
|
+
{
|
|
47
|
+
...{
|
|
48
|
+
className: "flex flex-wrap items-center gap-2"
|
|
49
|
+
},
|
|
50
|
+
children: [
|
|
51
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("s", { children }),
|
|
52
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
53
|
+
import_badge.default,
|
|
54
|
+
{
|
|
55
|
+
...{
|
|
56
|
+
size: "small"
|
|
57
|
+
},
|
|
58
|
+
children: "Removed"
|
|
59
|
+
}
|
|
60
|
+
)
|
|
61
|
+
]
|
|
62
|
+
}
|
|
63
|
+
);
|
|
64
|
+
const answerRows = (fields = [], answers = []) => {
|
|
65
|
+
const values = Object.fromEntries(answers.map((item) => [item.reference, item.value]));
|
|
66
|
+
return (type) => fields.filter((item) => (item == null ? void 0 : item.type) === type && (!(item == null ? void 0 : item.deleted) || !blank(values[item.id]))).map((item) => ({
|
|
67
|
+
label: item.label,
|
|
68
|
+
value: (item == null ? void 0 : item.deleted) ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Removed, { children: display(values[item.id]) }) : display(values[item.id])
|
|
69
|
+
}));
|
|
70
|
+
};
|
|
71
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
72
|
+
0 && (module.exports = {
|
|
73
|
+
Removed,
|
|
74
|
+
answerRows,
|
|
75
|
+
blank,
|
|
76
|
+
display
|
|
77
|
+
});
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import Badge from "../shared/badge.mjs";
|
|
3
|
+
const blank = (value) => value === void 0 || value === null || value === "";
|
|
4
|
+
const display = (value) => {
|
|
5
|
+
if (blank(value)) return "\u2014";
|
|
6
|
+
if (value instanceof Object) return Object.values(value).join(", ");
|
|
7
|
+
return String(value);
|
|
8
|
+
};
|
|
9
|
+
const Removed = ({ children }) => /* @__PURE__ */ jsxs(
|
|
10
|
+
"span",
|
|
11
|
+
{
|
|
12
|
+
...{
|
|
13
|
+
className: "flex flex-wrap items-center gap-2"
|
|
14
|
+
},
|
|
15
|
+
children: [
|
|
16
|
+
/* @__PURE__ */ jsx("s", { children }),
|
|
17
|
+
/* @__PURE__ */ jsx(
|
|
18
|
+
Badge,
|
|
19
|
+
{
|
|
20
|
+
...{
|
|
21
|
+
size: "small"
|
|
22
|
+
},
|
|
23
|
+
children: "Removed"
|
|
24
|
+
}
|
|
25
|
+
)
|
|
26
|
+
]
|
|
27
|
+
}
|
|
28
|
+
);
|
|
29
|
+
const answerRows = (fields = [], answers = []) => {
|
|
30
|
+
const values = Object.fromEntries(answers.map((item) => [item.reference, item.value]));
|
|
31
|
+
return (type) => fields.filter((item) => (item == null ? void 0 : item.type) === type && (!(item == null ? void 0 : item.deleted) || !blank(values[item.id]))).map((item) => ({
|
|
32
|
+
label: item.label,
|
|
33
|
+
value: (item == null ? void 0 : item.deleted) ? /* @__PURE__ */ jsx(Removed, { children: display(values[item.id]) }) : display(values[item.id])
|
|
34
|
+
}));
|
|
35
|
+
};
|
|
36
|
+
export {
|
|
37
|
+
Removed,
|
|
38
|
+
answerRows,
|
|
39
|
+
blank,
|
|
40
|
+
display
|
|
41
|
+
};
|