@drawbridge/components 0.1.17 → 0.1.18
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/form-subdomain-missions.js +11 -13
- package/dist/bridge/form-subdomain-missions.mjs +11 -13
- package/dist/bridge/template-layout.js +1 -1
- package/dist/bridge/template-layout.mjs +1 -1
- package/dist/bridge/template-modal.js +1 -1
- package/dist/bridge/template-modal.mjs +1 -1
- package/dist/dashboard/form-organization-workflow.js +34 -21
- package/dist/dashboard/form-organization-workflow.mjs +34 -22
- package/dist/dashboard/input-editor.js +17 -9
- package/dist/dashboard/input-editor.mjs +15 -8
- package/package.json +3 -3
- package/types/bridge/form-subdomain-missions.d.ts +1 -1
- package/types/dashboard/input-editor.d.ts +4 -2
|
@@ -107,7 +107,7 @@ const Back = ({ onClick, style }) => {
|
|
|
107
107
|
reverse: true,
|
|
108
108
|
variant: "link"
|
|
109
109
|
},
|
|
110
|
-
children: "Back
|
|
110
|
+
children: "Back"
|
|
111
111
|
}
|
|
112
112
|
)
|
|
113
113
|
}
|
|
@@ -412,14 +412,12 @@ const FormSubdomainMissions = ({
|
|
|
412
412
|
children: [
|
|
413
413
|
header("Thank you!"),
|
|
414
414
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Back, { ...{ onClick: back, style } }),
|
|
415
|
-
/* @__PURE__ */ (0, import_jsx_runtime.
|
|
416
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Strong, { children: "Mission accomplished!" }),
|
|
417
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { children: "Your bonus entries are in. Go back to missions to earn more." })
|
|
418
|
-
] })
|
|
415
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Centre, { children: Number(item == null ? void 0 : item.entries) > 0 && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Strong, { children: "You've earned " + (0, import_missions.entriesText)(item.entries) }) })
|
|
419
416
|
]
|
|
420
417
|
}
|
|
421
418
|
);
|
|
422
|
-
|
|
419
|
+
const finished = screen === "start" && !message && !bonusText(items, completed);
|
|
420
|
+
if (screen === "start" && !finished) {
|
|
423
421
|
const bonus = bonusText(items, completed);
|
|
424
422
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
425
423
|
"div",
|
|
@@ -491,7 +489,7 @@ const FormSubdomainMissions = ({
|
|
|
491
489
|
className: "space-y-6"
|
|
492
490
|
},
|
|
493
491
|
children: [
|
|
494
|
-
header("Earn more entries", { onClick: () => go("start") }),
|
|
492
|
+
finished ? header(title) : header("Earn more entries", { onClick: () => go("start") }),
|
|
495
493
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
496
494
|
"ul",
|
|
497
495
|
{
|
|
@@ -503,9 +501,9 @@ const FormSubdomainMissions = ({
|
|
|
503
501
|
},
|
|
504
502
|
children: items.filter((row) => import_missions.missions[row.type]).map((row, index) => {
|
|
505
503
|
var _a2;
|
|
506
|
-
const
|
|
504
|
+
const done = completed.includes(row.type);
|
|
507
505
|
const opens = screenFor(row.type);
|
|
508
|
-
const Mark =
|
|
506
|
+
const Mark = done ? import_check.default : import_chevron_right.default;
|
|
509
507
|
const content = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
510
508
|
"span",
|
|
511
509
|
{
|
|
@@ -517,10 +515,10 @@ const FormSubdomainMissions = ({
|
|
|
517
515
|
"span",
|
|
518
516
|
{
|
|
519
517
|
...{
|
|
520
|
-
className: "flex items-center gap-4 flex-1 min-w-0" + (
|
|
518
|
+
className: "flex items-center gap-4 flex-1 min-w-0" + (done ? " opacity-40" : "")
|
|
521
519
|
},
|
|
522
520
|
children: [
|
|
523
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Pill, { ...{ style }, children: pillText(row,
|
|
521
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Pill, { ...{ style }, children: pillText(row, done) }),
|
|
524
522
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
525
523
|
"span",
|
|
526
524
|
{
|
|
@@ -533,7 +531,7 @@ const FormSubdomainMissions = ({
|
|
|
533
531
|
]
|
|
534
532
|
}
|
|
535
533
|
),
|
|
536
|
-
(
|
|
534
|
+
(done || opens !== "missions") && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Pill, { ...{ style }, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
537
535
|
Mark,
|
|
538
536
|
{
|
|
539
537
|
...{
|
|
@@ -553,7 +551,7 @@ const FormSubdomainMissions = ({
|
|
|
553
551
|
borderColor: "inherit"
|
|
554
552
|
}
|
|
555
553
|
},
|
|
556
|
-
children:
|
|
554
|
+
children: done || opens === "missions" ? content : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
557
555
|
import_button.default,
|
|
558
556
|
{
|
|
559
557
|
...{
|
|
@@ -70,7 +70,7 @@ const Back = ({ onClick, style }) => {
|
|
|
70
70
|
reverse: true,
|
|
71
71
|
variant: "link"
|
|
72
72
|
},
|
|
73
|
-
children: "Back
|
|
73
|
+
children: "Back"
|
|
74
74
|
}
|
|
75
75
|
)
|
|
76
76
|
}
|
|
@@ -375,14 +375,12 @@ const FormSubdomainMissions = ({
|
|
|
375
375
|
children: [
|
|
376
376
|
header("Thank you!"),
|
|
377
377
|
/* @__PURE__ */ jsx(Back, { ...{ onClick: back, style } }),
|
|
378
|
-
/* @__PURE__ */
|
|
379
|
-
/* @__PURE__ */ jsx(Strong, { children: "Mission accomplished!" }),
|
|
380
|
-
/* @__PURE__ */ jsx("p", { children: "Your bonus entries are in. Go back to missions to earn more." })
|
|
381
|
-
] })
|
|
378
|
+
/* @__PURE__ */ jsx(Centre, { children: Number(item == null ? void 0 : item.entries) > 0 && /* @__PURE__ */ jsx(Strong, { children: "You've earned " + entriesText(item.entries) }) })
|
|
382
379
|
]
|
|
383
380
|
}
|
|
384
381
|
);
|
|
385
|
-
|
|
382
|
+
const finished = screen === "start" && !message && !bonusText(items, completed);
|
|
383
|
+
if (screen === "start" && !finished) {
|
|
386
384
|
const bonus = bonusText(items, completed);
|
|
387
385
|
return /* @__PURE__ */ jsxs(
|
|
388
386
|
"div",
|
|
@@ -454,7 +452,7 @@ const FormSubdomainMissions = ({
|
|
|
454
452
|
className: "space-y-6"
|
|
455
453
|
},
|
|
456
454
|
children: [
|
|
457
|
-
header("Earn more entries", { onClick: () => go("start") }),
|
|
455
|
+
finished ? header(title) : header("Earn more entries", { onClick: () => go("start") }),
|
|
458
456
|
/* @__PURE__ */ jsx(
|
|
459
457
|
"ul",
|
|
460
458
|
{
|
|
@@ -466,9 +464,9 @@ const FormSubdomainMissions = ({
|
|
|
466
464
|
},
|
|
467
465
|
children: items.filter((row) => manifests[row.type]).map((row, index) => {
|
|
468
466
|
var _a2;
|
|
469
|
-
const
|
|
467
|
+
const done = completed.includes(row.type);
|
|
470
468
|
const opens = screenFor(row.type);
|
|
471
|
-
const Mark =
|
|
469
|
+
const Mark = done ? Check : ChevronRight;
|
|
472
470
|
const content = /* @__PURE__ */ jsxs(
|
|
473
471
|
"span",
|
|
474
472
|
{
|
|
@@ -480,10 +478,10 @@ const FormSubdomainMissions = ({
|
|
|
480
478
|
"span",
|
|
481
479
|
{
|
|
482
480
|
...{
|
|
483
|
-
className: "flex items-center gap-4 flex-1 min-w-0" + (
|
|
481
|
+
className: "flex items-center gap-4 flex-1 min-w-0" + (done ? " opacity-40" : "")
|
|
484
482
|
},
|
|
485
483
|
children: [
|
|
486
|
-
/* @__PURE__ */ jsx(Pill, { ...{ style }, children: pillText(row,
|
|
484
|
+
/* @__PURE__ */ jsx(Pill, { ...{ style }, children: pillText(row, done) }),
|
|
487
485
|
/* @__PURE__ */ jsx(
|
|
488
486
|
"span",
|
|
489
487
|
{
|
|
@@ -496,7 +494,7 @@ const FormSubdomainMissions = ({
|
|
|
496
494
|
]
|
|
497
495
|
}
|
|
498
496
|
),
|
|
499
|
-
(
|
|
497
|
+
(done || opens !== "missions") && /* @__PURE__ */ jsx(Pill, { ...{ style }, children: /* @__PURE__ */ jsx(
|
|
500
498
|
Mark,
|
|
501
499
|
{
|
|
502
500
|
...{
|
|
@@ -516,7 +514,7 @@ const FormSubdomainMissions = ({
|
|
|
516
514
|
borderColor: "inherit"
|
|
517
515
|
}
|
|
518
516
|
},
|
|
519
|
-
children:
|
|
517
|
+
children: done || opens === "missions" ? content : /* @__PURE__ */ jsx(
|
|
520
518
|
Button,
|
|
521
519
|
{
|
|
522
520
|
...{
|
|
@@ -393,7 +393,7 @@ const TemplateLayout = ({
|
|
|
393
393
|
},
|
|
394
394
|
[affiliate, data, params, preview, style]
|
|
395
395
|
);
|
|
396
|
-
const leadMission = searchParams.get("
|
|
396
|
+
const leadMission = searchParams.get("open");
|
|
397
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
|
() => {
|
|
@@ -361,7 +361,7 @@ const TemplateLayout = ({
|
|
|
361
361
|
},
|
|
362
362
|
[affiliate, data, params, preview, style]
|
|
363
363
|
);
|
|
364
|
-
const leadMission = searchParams.get("
|
|
364
|
+
const leadMission = searchParams.get("open");
|
|
365
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
|
() => {
|
|
@@ -158,7 +158,7 @@ const TemplateModal = ({
|
|
|
158
158
|
);
|
|
159
159
|
// @story public-entry/lead-link
|
|
160
160
|
// Opened by the lead's own link while entries are being awarded:
|
|
161
|
-
// the missions panel, at the mission a `&
|
|
161
|
+
// the missions panel, at the mission a `&open=` asked for. With
|
|
162
162
|
// no missions the link opens no panel (template-layout.js).
|
|
163
163
|
case "lead":
|
|
164
164
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
@@ -126,7 +126,7 @@ const TemplateModal = ({
|
|
|
126
126
|
);
|
|
127
127
|
// @story public-entry/lead-link
|
|
128
128
|
// Opened by the lead's own link while entries are being awarded:
|
|
129
|
-
// the missions panel, at the mission a `&
|
|
129
|
+
// the missions panel, at the mission a `&open=` asked for. With
|
|
130
130
|
// no missions the link opens no panel (template-layout.js).
|
|
131
131
|
case "lead":
|
|
132
132
|
return /* @__PURE__ */ jsx(
|
|
@@ -33,6 +33,7 @@ __export(form_organization_workflow_exports, {
|
|
|
33
33
|
TextPreview: () => TextPreview,
|
|
34
34
|
firstEntryOnly: () => firstEntryOnly,
|
|
35
35
|
issueRow: () => issueRow,
|
|
36
|
+
memberOptions: () => memberOptions,
|
|
36
37
|
partToStart: () => partToStart,
|
|
37
38
|
pickedCopy: () => pickedCopy,
|
|
38
39
|
plainHtml: () => plainHtml,
|
|
@@ -109,20 +110,23 @@ const memberParams = {
|
|
|
109
110
|
createdAt: -1
|
|
110
111
|
}
|
|
111
112
|
};
|
|
113
|
+
const memberOptions = (organization) => ({
|
|
114
|
+
queryKey: ["organization-members", organization, "options"],
|
|
115
|
+
queryFn: async () => {
|
|
116
|
+
const { result } = await (0, import_fetch.request)({
|
|
117
|
+
endpoint: "/organization/" + organization + "/members",
|
|
118
|
+
// limit / skip / sort are required by the route's query validation.
|
|
119
|
+
params: memberParams
|
|
120
|
+
});
|
|
121
|
+
return result;
|
|
122
|
+
},
|
|
123
|
+
staleTime: Infinity
|
|
124
|
+
});
|
|
112
125
|
const useOrganizationMembers = (organization) => {
|
|
113
126
|
var _a;
|
|
114
127
|
const members = (0, import_react_query.useQuery)({
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
const { result } = await (0, import_fetch.request)({
|
|
118
|
-
endpoint: "/organization/" + organization + "/members",
|
|
119
|
-
// limit / skip / sort are required by the route's query validation.
|
|
120
|
-
params: memberParams
|
|
121
|
-
});
|
|
122
|
-
return result;
|
|
123
|
-
},
|
|
124
|
-
enabled: Boolean(organization),
|
|
125
|
-
staleTime: Infinity
|
|
128
|
+
...memberOptions(organization),
|
|
129
|
+
enabled: Boolean(organization)
|
|
126
130
|
});
|
|
127
131
|
return {
|
|
128
132
|
items: ((_a = members.data) == null ? void 0 : _a.items) || [],
|
|
@@ -255,9 +259,9 @@ const responseSave = ({ email, sms }) => ({
|
|
|
255
259
|
message: sms.message
|
|
256
260
|
}
|
|
257
261
|
});
|
|
258
|
-
const plainHtml = (text) => String(text || "").split("\n").map((line) => {
|
|
262
|
+
const plainHtml = (text, variables) => String(text || "").split("\n").map((line) => {
|
|
259
263
|
const marked = line.match(/^\[(.+)\]$/);
|
|
260
|
-
return "<p>" + (marked ? '<span data-variable="placeholder" key="placeholder" label="' + (0, import_html.escapeHtml)(marked[1]) + '"></span>' : (0,
|
|
264
|
+
return "<p>" + (marked ? '<span data-variable="placeholder" key="placeholder" label="' + (0, import_html.escapeHtml)(marked[1]) + '"></span>' : (0, import_input_editor.plainLine)(line, variables)) + "</p>";
|
|
261
265
|
}).join("");
|
|
262
266
|
const taggedScore = (settings) => (settings == null ? void 0 : settings.score) ? {
|
|
263
267
|
...settings.score,
|
|
@@ -539,7 +543,7 @@ const RESPONSE_STATES = [
|
|
|
539
543
|
value: "sms"
|
|
540
544
|
}
|
|
541
545
|
];
|
|
542
|
-
const ResponseText = ({ className, id, text }) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
546
|
+
const ResponseText = ({ className, id, text, variables }) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
543
547
|
"div",
|
|
544
548
|
{
|
|
545
549
|
...{
|
|
@@ -550,7 +554,7 @@ const ResponseText = ({ className, id, text }) => /* @__PURE__ */ (0, import_jsx
|
|
|
550
554
|
import_input_editor.EditorView,
|
|
551
555
|
{
|
|
552
556
|
...{
|
|
553
|
-
value: plainHtml(text)
|
|
557
|
+
value: plainHtml(text, variables)
|
|
554
558
|
}
|
|
555
559
|
}
|
|
556
560
|
)
|
|
@@ -691,7 +695,8 @@ const ResponseStepCard = ({
|
|
|
691
695
|
{
|
|
692
696
|
...{
|
|
693
697
|
className: "w-full border border-inherit rounded px-3 py-2 disabled",
|
|
694
|
-
text: preview == null ? void 0 : preview.text
|
|
698
|
+
text: preview == null ? void 0 : preview.text,
|
|
699
|
+
variables
|
|
695
700
|
}
|
|
696
701
|
}
|
|
697
702
|
),
|
|
@@ -747,7 +752,8 @@ const ResponseStepCard = ({
|
|
|
747
752
|
},
|
|
748
753
|
onChange: ({ text }) => onChange(text),
|
|
749
754
|
plain: true,
|
|
750
|
-
value: value || ""
|
|
755
|
+
value: value || "",
|
|
756
|
+
variables
|
|
751
757
|
}
|
|
752
758
|
}
|
|
753
759
|
),
|
|
@@ -796,7 +802,15 @@ const ResponseStepCard = ({
|
|
|
796
802
|
}
|
|
797
803
|
) : /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(TextPreview, { children: [
|
|
798
804
|
brand && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { children: brand }),
|
|
799
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
805
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
806
|
+
ResponseText,
|
|
807
|
+
{
|
|
808
|
+
...{
|
|
809
|
+
text: (_e = settings == null ? void 0 : settings.sms) == null ? void 0 : _e.message,
|
|
810
|
+
variables
|
|
811
|
+
}
|
|
812
|
+
}
|
|
813
|
+
),
|
|
800
814
|
(placeholders == null ? void 0 : placeholders.missions) && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
801
815
|
ResponseText,
|
|
802
816
|
{
|
|
@@ -1548,9 +1562,7 @@ const FormOrganizationWorkflowEdit = ({
|
|
|
1548
1562
|
// QA read "Issue a discount code", built the one-step workflow that
|
|
1549
1563
|
// describes, and reported the codes as never arriving.
|
|
1550
1564
|
message: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_react.Fragment, { children: [
|
|
1551
|
-
"Creates the code and saves it to the lead. To send it,
|
|
1552
|
-
"{{shopifyDiscountCode}}",
|
|
1553
|
-
" in the message.",
|
|
1565
|
+
"Creates the code and saves it to the lead. To send it, keep this step before Auto response and add Shopify Discount Code to its message.",
|
|
1554
1566
|
commerceDomain ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_react.Fragment, { children: [
|
|
1555
1567
|
" ",
|
|
1556
1568
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("a", { href: "https://" + commerceDomain + "/admin/discounts", rel: "noopener noreferrer", target: "_blank", children: "Manage discounts" })
|
|
@@ -1601,6 +1613,7 @@ const FormOrganizationWorkflowEdit = ({
|
|
|
1601
1613
|
TextPreview,
|
|
1602
1614
|
firstEntryOnly,
|
|
1603
1615
|
issueRow,
|
|
1616
|
+
memberOptions,
|
|
1604
1617
|
partToStart,
|
|
1605
1618
|
pickedCopy,
|
|
1606
1619
|
plainHtml,
|
|
@@ -17,7 +17,7 @@ import InputUrl from "../shared/input-url.mjs";
|
|
|
17
17
|
import InputResource from "./input-resource.mjs";
|
|
18
18
|
import InputCombobox from "./input-combobox.mjs";
|
|
19
19
|
import { FormNotification } from "./form-notification.mjs";
|
|
20
|
-
import InputEditor, { EditorView } from "./input-editor.mjs";
|
|
20
|
+
import InputEditor, { EditorView, plainLine } from "./input-editor.mjs";
|
|
21
21
|
import { InputArrayButton, InputArrayControl, InputArraySortable } from "./input-array.mjs";
|
|
22
22
|
import Badge from "../shared/badge.mjs";
|
|
23
23
|
import InputSwitch from "../shared/input-switch.mjs";
|
|
@@ -59,20 +59,23 @@ const memberParams = {
|
|
|
59
59
|
createdAt: -1
|
|
60
60
|
}
|
|
61
61
|
};
|
|
62
|
+
const memberOptions = (organization) => ({
|
|
63
|
+
queryKey: ["organization-members", organization, "options"],
|
|
64
|
+
queryFn: async () => {
|
|
65
|
+
const { result } = await request({
|
|
66
|
+
endpoint: "/organization/" + organization + "/members",
|
|
67
|
+
// limit / skip / sort are required by the route's query validation.
|
|
68
|
+
params: memberParams
|
|
69
|
+
});
|
|
70
|
+
return result;
|
|
71
|
+
},
|
|
72
|
+
staleTime: Infinity
|
|
73
|
+
});
|
|
62
74
|
const useOrganizationMembers = (organization) => {
|
|
63
75
|
var _a;
|
|
64
76
|
const members = useQuery({
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
const { result } = await request({
|
|
68
|
-
endpoint: "/organization/" + organization + "/members",
|
|
69
|
-
// limit / skip / sort are required by the route's query validation.
|
|
70
|
-
params: memberParams
|
|
71
|
-
});
|
|
72
|
-
return result;
|
|
73
|
-
},
|
|
74
|
-
enabled: Boolean(organization),
|
|
75
|
-
staleTime: Infinity
|
|
77
|
+
...memberOptions(organization),
|
|
78
|
+
enabled: Boolean(organization)
|
|
76
79
|
});
|
|
77
80
|
return {
|
|
78
81
|
items: ((_a = members.data) == null ? void 0 : _a.items) || [],
|
|
@@ -205,9 +208,9 @@ const responseSave = ({ email, sms }) => ({
|
|
|
205
208
|
message: sms.message
|
|
206
209
|
}
|
|
207
210
|
});
|
|
208
|
-
const plainHtml = (text) => String(text || "").split("\n").map((line) => {
|
|
211
|
+
const plainHtml = (text, variables) => String(text || "").split("\n").map((line) => {
|
|
209
212
|
const marked = line.match(/^\[(.+)\]$/);
|
|
210
|
-
return "<p>" + (marked ? '<span data-variable="placeholder" key="placeholder" label="' + escapeHtml(marked[1]) + '"></span>' :
|
|
213
|
+
return "<p>" + (marked ? '<span data-variable="placeholder" key="placeholder" label="' + escapeHtml(marked[1]) + '"></span>' : plainLine(line, variables)) + "</p>";
|
|
211
214
|
}).join("");
|
|
212
215
|
const taggedScore = (settings) => (settings == null ? void 0 : settings.score) ? {
|
|
213
216
|
...settings.score,
|
|
@@ -489,7 +492,7 @@ const RESPONSE_STATES = [
|
|
|
489
492
|
value: "sms"
|
|
490
493
|
}
|
|
491
494
|
];
|
|
492
|
-
const ResponseText = ({ className, id, text }) => /* @__PURE__ */ jsx(
|
|
495
|
+
const ResponseText = ({ className, id, text, variables }) => /* @__PURE__ */ jsx(
|
|
493
496
|
"div",
|
|
494
497
|
{
|
|
495
498
|
...{
|
|
@@ -500,7 +503,7 @@ const ResponseText = ({ className, id, text }) => /* @__PURE__ */ jsx(
|
|
|
500
503
|
EditorView,
|
|
501
504
|
{
|
|
502
505
|
...{
|
|
503
|
-
value: plainHtml(text)
|
|
506
|
+
value: plainHtml(text, variables)
|
|
504
507
|
}
|
|
505
508
|
}
|
|
506
509
|
)
|
|
@@ -641,7 +644,8 @@ const ResponseStepCard = ({
|
|
|
641
644
|
{
|
|
642
645
|
...{
|
|
643
646
|
className: "w-full border border-inherit rounded px-3 py-2 disabled",
|
|
644
|
-
text: preview == null ? void 0 : preview.text
|
|
647
|
+
text: preview == null ? void 0 : preview.text,
|
|
648
|
+
variables
|
|
645
649
|
}
|
|
646
650
|
}
|
|
647
651
|
),
|
|
@@ -697,7 +701,8 @@ const ResponseStepCard = ({
|
|
|
697
701
|
},
|
|
698
702
|
onChange: ({ text }) => onChange(text),
|
|
699
703
|
plain: true,
|
|
700
|
-
value: value || ""
|
|
704
|
+
value: value || "",
|
|
705
|
+
variables
|
|
701
706
|
}
|
|
702
707
|
}
|
|
703
708
|
),
|
|
@@ -746,7 +751,15 @@ const ResponseStepCard = ({
|
|
|
746
751
|
}
|
|
747
752
|
) : /* @__PURE__ */ jsxs(TextPreview, { children: [
|
|
748
753
|
brand && /* @__PURE__ */ jsx("p", { children: brand }),
|
|
749
|
-
/* @__PURE__ */ jsx(
|
|
754
|
+
/* @__PURE__ */ jsx(
|
|
755
|
+
ResponseText,
|
|
756
|
+
{
|
|
757
|
+
...{
|
|
758
|
+
text: (_e = settings == null ? void 0 : settings.sms) == null ? void 0 : _e.message,
|
|
759
|
+
variables
|
|
760
|
+
}
|
|
761
|
+
}
|
|
762
|
+
),
|
|
750
763
|
(placeholders == null ? void 0 : placeholders.missions) && /* @__PURE__ */ jsx(
|
|
751
764
|
ResponseText,
|
|
752
765
|
{
|
|
@@ -1498,9 +1511,7 @@ const FormOrganizationWorkflowEdit = ({
|
|
|
1498
1511
|
// QA read "Issue a discount code", built the one-step workflow that
|
|
1499
1512
|
// describes, and reported the codes as never arriving.
|
|
1500
1513
|
message: /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
1501
|
-
"Creates the code and saves it to the lead. To send it,
|
|
1502
|
-
"{{shopifyDiscountCode}}",
|
|
1503
|
-
" in the message.",
|
|
1514
|
+
"Creates the code and saves it to the lead. To send it, keep this step before Auto response and add Shopify Discount Code to its message.",
|
|
1504
1515
|
commerceDomain ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
1505
1516
|
" ",
|
|
1506
1517
|
/* @__PURE__ */ jsx("a", { href: "https://" + commerceDomain + "/admin/discounts", rel: "noopener noreferrer", target: "_blank", children: "Manage discounts" })
|
|
@@ -1550,6 +1561,7 @@ export {
|
|
|
1550
1561
|
TextPreview,
|
|
1551
1562
|
firstEntryOnly,
|
|
1552
1563
|
issueRow,
|
|
1564
|
+
memberOptions,
|
|
1553
1565
|
partToStart,
|
|
1554
1566
|
pickedCopy,
|
|
1555
1567
|
plainHtml,
|
|
@@ -32,7 +32,8 @@ __export(input_editor_exports, {
|
|
|
32
32
|
Variable: () => Variable,
|
|
33
33
|
default: () => input_editor_default,
|
|
34
34
|
linkText: () => linkText,
|
|
35
|
-
plainContent: () => plainContent
|
|
35
|
+
plainContent: () => plainContent,
|
|
36
|
+
plainLine: () => plainLine
|
|
36
37
|
});
|
|
37
38
|
module.exports = __toCommonJS(input_editor_exports);
|
|
38
39
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
@@ -109,12 +110,18 @@ const plainExtensions = [
|
|
|
109
110
|
orderedList: false,
|
|
110
111
|
strike: false,
|
|
111
112
|
underline: false
|
|
112
|
-
})
|
|
113
|
+
}),
|
|
114
|
+
Variable
|
|
113
115
|
];
|
|
114
116
|
const plainOptions = {
|
|
115
117
|
blockSeparator: "\n"
|
|
116
118
|
};
|
|
117
|
-
const
|
|
119
|
+
const plainLine = (line, variables) => (0, import_html.escapeHtml)(line).replace(/\{\{(\w+)\}\}/g, (_, key) => {
|
|
120
|
+
var _a;
|
|
121
|
+
const label = ((_a = variables == null ? void 0 : variables.find((item) => item.key === key)) == null ? void 0 : _a.label) || key;
|
|
122
|
+
return '<span data-variable="' + key + '" key="' + key + '" label="' + (0, import_html.escapeHtml)(label) + '"></span>';
|
|
123
|
+
});
|
|
124
|
+
const plainContent = (value, variables) => String(value || "").split("\n").map((line) => "<p>" + plainLine(line, variables) + "</p>").join("");
|
|
118
125
|
const EditorView = ({ value }) => {
|
|
119
126
|
const editor = (0, import_react2.useEditor)({
|
|
120
127
|
content: value || "",
|
|
@@ -150,7 +157,7 @@ const InputEditor = ({
|
|
|
150
157
|
const [draft, setDraft] = (0, import_react.useState)(null);
|
|
151
158
|
const editor = (0, import_react2.useEditor)({
|
|
152
159
|
extensions: plain ? plainExtensions : extensions,
|
|
153
|
-
content: plain ? plainContent(value) : value || "",
|
|
160
|
+
content: plain ? plainContent(value, variables) : value || "",
|
|
154
161
|
editable: !disabled,
|
|
155
162
|
editorProps: {
|
|
156
163
|
attributes: {
|
|
@@ -218,7 +225,7 @@ const InputEditor = ({
|
|
|
218
225
|
() => {
|
|
219
226
|
if (!editor) return;
|
|
220
227
|
if (plain ? (value || "") !== editor.getText(plainOptions) : value !== editor.getHTML()) {
|
|
221
|
-
editor.commands.setContent(plain ? plainContent(value) : value || "", { emitUpdate: false });
|
|
228
|
+
editor.commands.setContent(plain ? plainContent(value, variables) : value || "", { emitUpdate: false });
|
|
222
229
|
}
|
|
223
230
|
},
|
|
224
231
|
[editor, plain, value]
|
|
@@ -235,14 +242,14 @@ const InputEditor = ({
|
|
|
235
242
|
className: ["w-full border border-inherit rounded overflow-hidden", disabled ? "disabled" : ""].join(" ").trim()
|
|
236
243
|
},
|
|
237
244
|
children: [
|
|
238
|
-
!plain && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
245
|
+
(!plain || (variables == null ? void 0 : variables.length) > 0) && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
239
246
|
"div",
|
|
240
247
|
{
|
|
241
248
|
...{
|
|
242
|
-
className: "flex items-center
|
|
249
|
+
className: ["flex items-center p-1 bg-gray-light", plain ? "justify-end" : "justify-between"].join(" ")
|
|
243
250
|
},
|
|
244
251
|
children: [
|
|
245
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
252
|
+
!plain && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
246
253
|
"div",
|
|
247
254
|
{
|
|
248
255
|
...{
|
|
@@ -508,5 +515,6 @@ var input_editor_default = InputEditor;
|
|
|
508
515
|
EditorView,
|
|
509
516
|
Variable,
|
|
510
517
|
linkText,
|
|
511
|
-
plainContent
|
|
518
|
+
plainContent,
|
|
519
|
+
plainLine
|
|
512
520
|
});
|
|
@@ -73,12 +73,18 @@ const plainExtensions = [
|
|
|
73
73
|
orderedList: false,
|
|
74
74
|
strike: false,
|
|
75
75
|
underline: false
|
|
76
|
-
})
|
|
76
|
+
}),
|
|
77
|
+
Variable
|
|
77
78
|
];
|
|
78
79
|
const plainOptions = {
|
|
79
80
|
blockSeparator: "\n"
|
|
80
81
|
};
|
|
81
|
-
const
|
|
82
|
+
const plainLine = (line, variables) => escapeHtml(line).replace(/\{\{(\w+)\}\}/g, (_, key) => {
|
|
83
|
+
var _a;
|
|
84
|
+
const label = ((_a = variables == null ? void 0 : variables.find((item) => item.key === key)) == null ? void 0 : _a.label) || key;
|
|
85
|
+
return '<span data-variable="' + key + '" key="' + key + '" label="' + escapeHtml(label) + '"></span>';
|
|
86
|
+
});
|
|
87
|
+
const plainContent = (value, variables) => String(value || "").split("\n").map((line) => "<p>" + plainLine(line, variables) + "</p>").join("");
|
|
82
88
|
const EditorView = ({ value }) => {
|
|
83
89
|
const editor = useEditor({
|
|
84
90
|
content: value || "",
|
|
@@ -114,7 +120,7 @@ const InputEditor = ({
|
|
|
114
120
|
const [draft, setDraft] = useState(null);
|
|
115
121
|
const editor = useEditor({
|
|
116
122
|
extensions: plain ? plainExtensions : extensions,
|
|
117
|
-
content: plain ? plainContent(value) : value || "",
|
|
123
|
+
content: plain ? plainContent(value, variables) : value || "",
|
|
118
124
|
editable: !disabled,
|
|
119
125
|
editorProps: {
|
|
120
126
|
attributes: {
|
|
@@ -182,7 +188,7 @@ const InputEditor = ({
|
|
|
182
188
|
() => {
|
|
183
189
|
if (!editor) return;
|
|
184
190
|
if (plain ? (value || "") !== editor.getText(plainOptions) : value !== editor.getHTML()) {
|
|
185
|
-
editor.commands.setContent(plain ? plainContent(value) : value || "", { emitUpdate: false });
|
|
191
|
+
editor.commands.setContent(plain ? plainContent(value, variables) : value || "", { emitUpdate: false });
|
|
186
192
|
}
|
|
187
193
|
},
|
|
188
194
|
[editor, plain, value]
|
|
@@ -199,14 +205,14 @@ const InputEditor = ({
|
|
|
199
205
|
className: ["w-full border border-inherit rounded overflow-hidden", disabled ? "disabled" : ""].join(" ").trim()
|
|
200
206
|
},
|
|
201
207
|
children: [
|
|
202
|
-
!plain && /* @__PURE__ */ jsxs(
|
|
208
|
+
(!plain || (variables == null ? void 0 : variables.length) > 0) && /* @__PURE__ */ jsxs(
|
|
203
209
|
"div",
|
|
204
210
|
{
|
|
205
211
|
...{
|
|
206
|
-
className: "flex items-center
|
|
212
|
+
className: ["flex items-center p-1 bg-gray-light", plain ? "justify-end" : "justify-between"].join(" ")
|
|
207
213
|
},
|
|
208
214
|
children: [
|
|
209
|
-
/* @__PURE__ */ jsxs(
|
|
215
|
+
!plain && /* @__PURE__ */ jsxs(
|
|
210
216
|
"div",
|
|
211
217
|
{
|
|
212
218
|
...{
|
|
@@ -472,5 +478,6 @@ export {
|
|
|
472
478
|
Variable,
|
|
473
479
|
input_editor_default as default,
|
|
474
480
|
linkText,
|
|
475
|
-
plainContent
|
|
481
|
+
plainContent,
|
|
482
|
+
plainLine
|
|
476
483
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@drawbridge/components",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.18",
|
|
4
4
|
"exports": {
|
|
5
5
|
"./advertisement": {
|
|
6
6
|
"types": "./types/advertisement.d.ts",
|
|
@@ -1663,7 +1663,7 @@
|
|
|
1663
1663
|
"peerDependencies": {
|
|
1664
1664
|
"@analytics/google-tag-manager": ">=0.5.5",
|
|
1665
1665
|
"@drawbridge/drawbridge-telemetry": ">=0.0.19",
|
|
1666
|
-
"@drawbridge/drawbridge-utils": ">=0.0.
|
|
1666
|
+
"@drawbridge/drawbridge-utils": ">=0.0.230",
|
|
1667
1667
|
"@headlessui/react": ">=2.1.2",
|
|
1668
1668
|
"@hookform/resolvers": ">=3.1.1",
|
|
1669
1669
|
"@sentry/nextjs": ">=10.58.0",
|
|
@@ -1783,7 +1783,7 @@
|
|
|
1783
1783
|
"@analytics/google-tag-manager": "0.5.5",
|
|
1784
1784
|
"@drawbridge/drawbridge-agents": "0.1.102",
|
|
1785
1785
|
"@drawbridge/drawbridge-telemetry": "0.0.19",
|
|
1786
|
-
"@drawbridge/drawbridge-utils": "0.0.
|
|
1786
|
+
"@drawbridge/drawbridge-utils": "0.0.230",
|
|
1787
1787
|
"@headlessui/react": "2.2.9",
|
|
1788
1788
|
"@hookform/resolvers": "3.1.1",
|
|
1789
1789
|
"@sentry/nextjs": "10.58.0",
|
|
@@ -14,7 +14,7 @@ export interface FormSubdomainMissionsProps {
|
|
|
14
14
|
advertisements?: ReactNode;
|
|
15
15
|
button?: ReactNode;
|
|
16
16
|
contact?: { email?: string | null; phone?: string | null };
|
|
17
|
-
// The mission a lead link's `&
|
|
17
|
+
// The mission a lead link's `&open=` opens at.
|
|
18
18
|
initial?: string | null;
|
|
19
19
|
message?: ReactNode;
|
|
20
20
|
missions?: MissionItem[];
|
|
@@ -11,7 +11,8 @@ export interface InputEditorProps {
|
|
|
11
11
|
disabled?: boolean;
|
|
12
12
|
// Sits under what is typed, outside the document, so it cannot be removed.
|
|
13
13
|
locked?: ReactNode;
|
|
14
|
-
// No
|
|
14
|
+
// No formatting tools, only the Variables menu while there is something to
|
|
15
|
+
// insert; `value` and the emitted `text` are plain text, a variable as {{key}}.
|
|
15
16
|
plain?: boolean;
|
|
16
17
|
// Both renderings; pass `html` to a react-hook-form field, not the object.
|
|
17
18
|
onChange?: ( value: { html: string; text: string } ) => void;
|
|
@@ -29,7 +30,8 @@ export declare const Variable: Node;
|
|
|
29
30
|
// The text serializer that keeps a link's address in the plain rendering.
|
|
30
31
|
export declare const linkText: ( props: { node: any; parent: any; index: number } ) => string;
|
|
31
32
|
|
|
32
|
-
export declare const
|
|
33
|
+
export declare const plainLine: ( line: string, variables?: { key: string; label?: string }[] ) => string;
|
|
34
|
+
export declare const plainContent: ( value?: string, variables?: { key: string; label?: string }[] ) => string;
|
|
33
35
|
|
|
34
36
|
export declare const EditorView: ComponentType<EditorViewProps>;
|
|
35
37
|
|