@drawbridge/components 0.1.14 → 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.
Files changed (52) hide show
  1. package/dist/bridge/form-subdomain-missions.js +77 -38
  2. package/dist/bridge/form-subdomain-missions.mjs +76 -38
  3. package/dist/bridge/lib/url.js +3 -3
  4. package/dist/bridge/lib/url.mjs +3 -3
  5. package/dist/bridge/share-button.js +12 -2
  6. package/dist/bridge/share-button.mjs +12 -2
  7. package/dist/bridge/template-layout.js +1 -1
  8. package/dist/bridge/template-layout.mjs +1 -1
  9. package/dist/dashboard/answer-rows.js +77 -0
  10. package/dist/dashboard/answer-rows.mjs +41 -0
  11. package/dist/dashboard/card-campaign-switch.js +55 -43
  12. package/dist/dashboard/card-campaign-switch.mjs +56 -44
  13. package/dist/dashboard/card-order.js +248 -120
  14. package/dist/dashboard/card-order.mjs +248 -120
  15. package/dist/dashboard/connection-workflows.js +13 -4
  16. package/dist/dashboard/connection-workflows.mjs +13 -4
  17. package/dist/dashboard/form-organization-campaign-field-list.js +8 -49
  18. package/dist/dashboard/form-organization-campaign-field-list.mjs +8 -49
  19. package/dist/dashboard/form-organization-campaign-field-select.js +51 -5
  20. package/dist/dashboard/form-organization-campaign-field-select.mjs +51 -5
  21. package/dist/dashboard/form-organization-campaign-field-textarea.js +46 -8
  22. package/dist/dashboard/form-organization-campaign-field-textarea.mjs +46 -8
  23. package/dist/dashboard/form-organization-campaign-section.js +24 -4
  24. package/dist/dashboard/form-organization-campaign-section.mjs +24 -4
  25. package/dist/dashboard/form-organization-workflow.js +195 -56
  26. package/dist/dashboard/form-organization-workflow.mjs +191 -57
  27. package/dist/dashboard/item-row.js +92 -0
  28. package/dist/dashboard/item-row.mjs +63 -0
  29. package/dist/dashboard/lib/sms.js +3 -0
  30. package/dist/dashboard/lib/sms.mjs +2 -0
  31. package/dist/dashboard/order-sections.js +220 -0
  32. package/dist/dashboard/order-sections.mjs +185 -0
  33. package/dist/dashboard/preview.js +29 -2
  34. package/dist/dashboard/preview.mjs +28 -2
  35. package/dist/input-code.js +35 -53
  36. package/dist/input-code.mjs +26 -54
  37. package/dist/shared/button.js +1 -1
  38. package/dist/shared/button.mjs +1 -1
  39. package/dist/shared/lib/campaign.js +9 -3
  40. package/dist/shared/lib/campaign.mjs +7 -2
  41. package/dist/shared/lib/helpers.js +7 -0
  42. package/dist/shared/lib/helpers.mjs +7 -0
  43. package/package.json +19 -4
  44. package/types/bridge/form-subdomain-missions.d.ts +3 -1
  45. package/types/bridge/lib/url.d.ts +5 -4
  46. package/types/dashboard/answer-rows.d.ts +30 -0
  47. package/types/dashboard/card-order.d.ts +18 -3
  48. package/types/dashboard/form-organization-campaign-section.d.ts +2 -0
  49. package/types/dashboard/form-organization-workflow.d.ts +15 -0
  50. package/types/dashboard/item-row.d.ts +25 -0
  51. package/types/dashboard/order-sections.d.ts +36 -0
  52. package/types/shared/lib/helpers.d.ts +1 -1
@@ -2,6 +2,7 @@ import { jsx, jsxs } from "react/jsx-runtime";
2
2
  import Image from "next/image";
3
3
  import Link from "./link.mjs";
4
4
  import { Fragment, useCallback, useEffect, useRef, useState } from "react";
5
+ import { constants } from "@drawbridge/drawbridge-utils";
5
6
  import { request } from "@drawbridge/drawbridge-utils/fetch";
6
7
  import { useForm, useWatch, Controller } from "../shared/lib/form.mjs";
7
8
  import { keepPreviousData, useQuery, useQueryClient } from "@tanstack/react-query";
@@ -17,33 +18,30 @@ import InputCombobox from "./input-combobox.mjs";
17
18
  import { FormNotification } from "./form-notification.mjs";
18
19
  import { InputArrayButton, InputArrayControl, InputArraySortable } from "./input-array.mjs";
19
20
  import Badge from "../shared/badge.mjs";
21
+ import InputSwitch from "../shared/input-switch.mjs";
20
22
  import CardSection from "./card-section.mjs";
21
23
  import Accordion from "./accordion.mjs";
22
24
  import Preview from "./preview.mjs";
23
25
  import CardTask from "./card-task.mjs";
24
26
  import { LoaderDynamic } from "../shared/loader.mjs";
25
- import { smsNumberActive } from "./lib/sms.mjs";
27
+ import { smsBrandLine, smsNumberActive } from "./lib/sms.mjs";
26
28
  import Trash from "../icons/trash.mjs";
27
29
  import Button from "../shared/button.mjs";
28
30
  const emailSteps = ["step.email.send"];
29
31
  const teamSteps = ["step.email.notify"];
30
32
  const messageSteps = [...emailSteps, "step.sms.send"];
31
- const defaultScore = {
32
- rules: [
33
- { description: "From: domain has series of non-vowel letters", score: 0.5 },
34
- { description: "Informational: message was not relayed via SMTP", score: 0 },
35
- { description: "Informational: message has no Received headers", score: 0 }
36
- ],
37
- subtotal: 0,
38
- threshold: 5,
39
- total: 0.5
33
+ const renderedSteps = [...emailSteps, ...teamSteps];
34
+ const firstEntryOnly = ({ campaign, event, type }) => {
35
+ var _a, _b;
36
+ if (event !== "lead.insert" || !type || emailSteps.includes(type)) return false;
37
+ if (type === "step.sms.send") return (((_a = campaign == null ? void 0 : campaign.form) == null ? void 0 : _a.submissionLeadPrimaryKey) ?? ((_b = campaign == null ? void 0 : campaign.settings) == null ? void 0 : _b.submissionLeadPrimaryKey)) !== "phone";
38
+ return true;
40
39
  };
41
40
  const stepPrefills = {
42
41
  "step.email.send": {
43
- message: "Thanks for entering. We have your entry and will be in touch.",
44
- score: defaultScore,
45
- subject: "Thanks for entering",
46
- text: "Thanks for entering. We have your entry and will be in touch."
42
+ message: constants.campaign.confirmation.message,
43
+ subject: constants.campaign.confirmation.subject,
44
+ text: constants.campaign.confirmation.text
47
45
  },
48
46
  // Nothing to prefill: the step writes its own copy.
49
47
  "step.email.notify": {}
@@ -102,6 +100,13 @@ const prefillRow = ({ entry, step, steps = [] }) => {
102
100
  type: step
103
101
  });
104
102
  };
103
+ const pickedCopy = ({ row, type }) => {
104
+ const previous = stepPrefills[row == null ? void 0 : row.type];
105
+ const untouched = !!(previous == null ? void 0 : previous.subject) && (row == null ? void 0 : row.subject) === previous.subject && (row == null ? void 0 : row.message) === previous.message;
106
+ const { message = "", subject = "", text = "" } = stepPrefills[type] || {};
107
+ if (!untouched && ((row == null ? void 0 : row.subject) || (row == null ? void 0 : row.message))) return null;
108
+ return subject || untouched ? { message, subject, text } : null;
109
+ };
105
110
  const stepReason = ({ entry, saved = [], type }) => {
106
111
  var _a, _b;
107
112
  return ((_a = ((entry == null ? void 0 : entry.steps) || []).find((step) => (step == null ? void 0 : step.value) === type && (step == null ? void 0 : step.reason))) == null ? void 0 : _a.reason) || ((_b = saved.find((step) => (step == null ? void 0 : step.type) === type && (step == null ? void 0 : step.reason))) == null ? void 0 : _b.reason) || null;
@@ -111,6 +116,9 @@ const stepRow = (step = {}, members = []) => {
111
116
  return {
112
117
  connectionId: step.connectionId || "",
113
118
  discount: ((_a = step.settings) == null ? void 0 : _a.discount) || null,
119
+ // @story workflows/step-switch
120
+ // The step's own switch; absent reads on.
121
+ enabled: step.enabled !== false,
114
122
  // Stored as ids, picked as documents. Hydrating through the fetched list
115
123
  // also drops ids whose member no longer exists — a removed teammate
116
124
  // leaves their id on the step, and an id with nothing behind it would
@@ -185,18 +193,8 @@ const workflowSchema = yup.object({
185
193
  })
186
194
  )
187
195
  });
188
- const samples = [
189
- {
190
- key: "New lead",
191
- value: "lead"
192
- },
193
- {
194
- key: "Verified their email",
195
- value: "verified"
196
- }
197
- ];
198
- const useEmailPreview = ({ campaign, event, message, organization, sample, subject, text }) => {
199
- const asked = JSON.stringify({ message, sample, subject, text });
196
+ const useEmailPreview = ({ campaign, event, message, organization, subject, text, type }) => {
197
+ const asked = JSON.stringify(teamSteps.includes(type) ? { type } : { message, subject, text });
200
198
  const [settled, setSettled] = useState(asked);
201
199
  useEffect(() => {
202
200
  const timer = setTimeout(() => setSettled(asked), 400);
@@ -221,19 +219,21 @@ const EmailStepCard = ({
221
219
  card,
222
220
  children,
223
221
  control,
222
+ off,
224
223
  email: {
225
224
  campaign,
226
225
  event,
227
226
  name,
228
- organization
227
+ organization,
228
+ title,
229
+ type
229
230
  }
230
231
  }) => {
231
- const [sample, setSample] = useState(samples[0].value);
232
232
  const [subject, message, text] = useWatch({
233
233
  control,
234
234
  name: [name + ".subject", name + ".message", name + ".text"]
235
235
  });
236
- const preview = useEmailPreview({ campaign, event, message, organization, sample, subject, text });
236
+ const preview = useEmailPreview({ campaign, event, message, organization, subject, text, type });
237
237
  return /* @__PURE__ */ jsxs(
238
238
  CardSection,
239
239
  {
@@ -250,7 +250,7 @@ const EmailStepCard = ({
250
250
  },
251
251
  children: [
252
252
  children,
253
- /* @__PURE__ */ jsx(
253
+ emailSteps.includes(type) && /* @__PURE__ */ jsx(
254
254
  Accordion,
255
255
  {
256
256
  ...{
@@ -273,36 +273,82 @@ const EmailStepCard = ({
273
273
  }
274
274
  ),
275
275
  /* @__PURE__ */ jsx(
276
- Preview,
276
+ "div",
277
277
  {
278
278
  ...{
279
- states: {
280
- onChange: setSample,
281
- options: samples,
282
- value: sample
283
- }
279
+ className: off ? "opacity-50" : ""
284
280
  },
285
- children: /* @__PURE__ */ jsx(
281
+ children: /* @__PURE__ */ jsx(Preview, { children: /* @__PURE__ */ jsx(
286
282
  "iframe",
287
283
  {
288
284
  ...{
289
285
  // The rendered email, as a mail app shows it.
290
286
  className: "block w-full h-full border-0 bg-white",
291
287
  srcDoc: (preview == null ? void 0 : preview.html) || "",
292
- title: "Send email"
288
+ title
293
289
  }
294
290
  }
295
- )
291
+ ) })
296
292
  }
297
293
  )
298
294
  ]
299
295
  }
300
296
  );
301
297
  };
298
+ const SAMPLE = {
299
+ email: "sam.rivera@example.com",
300
+ name: "Sam Rivera",
301
+ phone: "+14165550142"
302
+ };
303
+ const webhookSample = ({ campaign }) => JSON.stringify({
304
+ campaign: {
305
+ id: (campaign == null ? void 0 : campaign.id) || "cmp_sample",
306
+ title: (campaign == null ? void 0 : campaign.title) || "Your campaign"
307
+ },
308
+ email: SAMPLE.email,
309
+ id: "lead_sample",
310
+ name: SAMPLE.name,
311
+ phone: {
312
+ number: SAMPLE.phone
313
+ }
314
+ }, null, 2);
315
+ const TextPreview = ({ children }) => /* @__PURE__ */ jsx("div", { className: "p-6 font-sans", children: /* @__PURE__ */ jsx("div", { className: "max-w-xs px-4 py-3 rounded-2xl rounded-bl-sm bg-gray-light text-black break-words", children }) });
316
+ const StepPreview = ({ campaign, control, image, name, organization, type }) => {
317
+ const [message] = useWatch({
318
+ control,
319
+ name: [name + ".message"]
320
+ });
321
+ const brand = smsBrandLine(organization == null ? void 0 : organization.title, message);
322
+ if (type === "step.sms.send") return /* @__PURE__ */ jsxs(TextPreview, { children: [
323
+ brand && /* @__PURE__ */ jsx("p", { children: brand }),
324
+ /* @__PURE__ */ jsx("p", { className: "whitespace-pre-wrap", children: message }),
325
+ (campaign == null ? void 0 : campaign.awarding) && /* @__PURE__ */ jsx("p", { className: "mt-2 px-2 py-1 rounded border border-dashed border-gray-dark text-gray-dark", children: "The entrant's missions appear here" }),
326
+ /* @__PURE__ */ jsx("p", { className: "mt-2", children: "Reply STOP to opt out" })
327
+ ] });
328
+ if (type === "step.webhook.send") return /* @__PURE__ */ jsx("pre", { className: "p-6 text-xs whitespace-pre-wrap break-all font-mono", children: "X-Drawbridge-Signature: t=\u2026,v1=\u2026\n\n" + webhookSample({ campaign }) });
329
+ return /* @__PURE__ */ jsxs("div", { className: "min-h-screen flex flex-col items-center justify-center gap-3 p-6 text-gray-dark", children: [
330
+ image && /* @__PURE__ */ jsx(
331
+ Image,
332
+ {
333
+ ...{
334
+ alt: "",
335
+ className: "w-12 h-12 object-contain",
336
+ height: 48,
337
+ src: image,
338
+ unoptimized: true,
339
+ width: 48
340
+ }
341
+ }
342
+ ),
343
+ /* @__PURE__ */ jsx("p", { children: "No preview available" })
344
+ ] });
345
+ };
302
346
  const StepCard = ({
303
347
  children,
304
348
  control,
305
349
  email,
350
+ off,
351
+ preview,
306
352
  ...card
307
353
  }) => email ? /* @__PURE__ */ jsx(
308
354
  EmailStepCard,
@@ -310,15 +356,38 @@ const StepCard = ({
310
356
  ...{
311
357
  card,
312
358
  control,
313
- email
359
+ email,
360
+ off
314
361
  },
315
362
  children
316
363
  }
317
- ) : /* @__PURE__ */ jsx(
364
+ ) : /* @__PURE__ */ jsxs(
318
365
  CardSection,
319
366
  {
320
- ...card,
321
- children
367
+ ...{
368
+ ...card,
369
+ columns: preview ? 2 : 1
370
+ },
371
+ children: [
372
+ children,
373
+ preview && /* @__PURE__ */ jsx(
374
+ "div",
375
+ {
376
+ ...{
377
+ className: off ? "opacity-50" : ""
378
+ },
379
+ children: /* @__PURE__ */ jsx(Preview, { children: /* @__PURE__ */ jsx(
380
+ StepPreview,
381
+ {
382
+ ...{
383
+ control,
384
+ ...preview
385
+ }
386
+ }
387
+ ) })
388
+ }
389
+ )
390
+ ]
322
391
  }
323
392
  );
324
393
  const FormOrganizationWorkflowEdit = ({
@@ -335,6 +404,7 @@ const FormOrganizationWorkflowEdit = ({
335
404
  const organizationData = queryClient.getQueryData(["organization", values == null ? void 0 : values.organization]);
336
405
  const ownerEmail = organizationData.owner.email;
337
406
  const smsActive = smsNumberActive(organizationData);
407
+ const campaignData = queryClient.getQueryData(["campaign", values == null ? void 0 : values.campaign]);
338
408
  const commerceConnectionId = ((_b = ((catalog == null ? void 0 : catalog.steps) || []).find(
339
409
  (s) => s.value === "step.commerce.customer.insert" || s.value === "step.commerce.code.issue"
340
410
  )) == null ? void 0 : _b.connectionId) || null;
@@ -503,7 +573,7 @@ const FormOrganizationWorkflowEdit = ({
503
573
  }) => {
504
574
  try {
505
575
  const body = {
506
- steps: steps.map(({ connectionId, discount, members, message, score, slug, subject, text, type, url }, index) => {
576
+ steps: steps.map(({ connectionId, discount, enabled, members, message, score, slug, subject, text, type, url }, index) => {
507
577
  const settings = {};
508
578
  if (type === "step.webhook.send") settings.url = url;
509
579
  if (emailSteps.includes(type)) settings.subject = subject;
@@ -521,6 +591,7 @@ const FormOrganizationWorkflowEdit = ({
521
591
  const resolvedSlug = (catalogStep == null ? void 0 : catalogStep.slug) || slug || null;
522
592
  return {
523
593
  ...resolvedConnectionId && { connectionId: resolvedConnectionId },
594
+ enabled: enabled !== false,
524
595
  ...resolvedSlug && { slug: resolvedSlug },
525
596
  settings,
526
597
  type
@@ -608,6 +679,7 @@ const FormOrganizationWorkflowEdit = ({
608
679
  )
609
680
  },
610
681
  children: ({ field, handle, index, remove }) => {
682
+ var _a2;
611
683
  const step = (watchedSteps == null ? void 0 : watchedSteps[index]) || field;
612
684
  return (
613
685
  // @story workflows/edit
@@ -622,11 +694,23 @@ const FormOrganizationWorkflowEdit = ({
622
694
  control,
623
695
  // @story workflows/send-email
624
696
  // A Send email step shows its email beside its form.
625
- email: emailSteps.includes(step.type) && {
697
+ off: step.enabled === false,
698
+ // Every other step with a type has its preview too.
699
+ preview: step.type && !renderedSteps.includes(step.type) && {
700
+ campaign: campaignData,
701
+ image: ((_a2 = ((catalog == null ? void 0 : catalog.steps) || []).find((entry) => entry.value === step.type)) == null ? void 0 : _a2.image) || null,
702
+ name: `steps.${index}`,
703
+ organization: organizationData,
704
+ type: step.type
705
+ },
706
+ // Send email and Email notification show the email the api renders.
707
+ email: renderedSteps.includes(step.type) && {
626
708
  campaign: values == null ? void 0 : values.campaign,
627
709
  event,
628
710
  name: `steps.${index}`,
629
- organization: values == null ? void 0 : values.organization
711
+ organization: values == null ? void 0 : values.organization,
712
+ title: emailSteps.includes(step.type) ? "Send email" : "Email notification",
713
+ type: step.type
630
714
  },
631
715
  cta: /* @__PURE__ */ jsxs(
632
716
  "span",
@@ -645,6 +729,30 @@ const FormOrganizationWorkflowEdit = ({
645
729
  }
646
730
  },
647
731
  "remove"
732
+ ),
733
+ /* @__PURE__ */ jsx(
734
+ Controller,
735
+ {
736
+ ...{
737
+ control,
738
+ name: `steps.${index}.enabled`,
739
+ render: ({ field: { onChange, value } }) => {
740
+ var _a3;
741
+ return /* @__PURE__ */ jsx(
742
+ InputSwitch,
743
+ {
744
+ ...{
745
+ "aria-label": ((_a3 = ((catalog == null ? void 0 : catalog.steps) || []).find((entry) => entry.value === step.type)) == null ? void 0 : _a3.key) || "Step " + (index + 1),
746
+ disabled: disabled || (formState == null ? void 0 : formState.isSubmitting),
747
+ onChange,
748
+ small: true,
749
+ value: value !== false
750
+ }
751
+ }
752
+ );
753
+ }
754
+ }
755
+ }
648
756
  )
649
757
  ]
650
758
  }
@@ -667,7 +775,8 @@ const FormOrganizationWorkflowEdit = ({
667
775
  "div",
668
776
  {
669
777
  ...{
670
- className: "space-y-3"
778
+ // A step switched off is greyed; its settings are kept.
779
+ className: "space-y-3" + (step.enabled === false ? " opacity-50" : "")
671
780
  },
672
781
  children: [
673
782
  issueIndex === index && /* @__PURE__ */ jsx(
@@ -685,12 +794,12 @@ const FormOrganizationWorkflowEdit = ({
685
794
  control,
686
795
  name: `steps.${index}.type`,
687
796
  render: ({ field: { onChange } }) => {
688
- var _a2, _b2, _c2, _d2;
797
+ var _a3, _b2, _c2, _d2;
689
798
  return /* @__PURE__ */ jsx(
690
799
  InputGroup,
691
800
  {
692
801
  ...{
693
- error: (_d2 = (_c2 = (_b2 = (_a2 = formState == null ? void 0 : formState.errors) == null ? void 0 : _a2.steps) == null ? void 0 : _b2[index]) == null ? void 0 : _c2.type) == null ? void 0 : _d2.message,
802
+ error: (_d2 = (_c2 = (_b2 = (_a3 = formState == null ? void 0 : formState.errors) == null ? void 0 : _a3.steps) == null ? void 0 : _b2[index]) == null ? void 0 : _c2.type) == null ? void 0 : _d2.message,
694
803
  input: /* @__PURE__ */ jsx(
695
804
  InputCombobox,
696
805
  {
@@ -698,9 +807,11 @@ const FormOrganizationWorkflowEdit = ({
698
807
  onChange: (val) => {
699
808
  const [type] = val.split("::");
700
809
  const option = getStepOptions(index).find((o) => o.value === val);
810
+ const copy = pickedCopy({ row: getValues(`steps.${index}`), type });
701
811
  onChange(type);
702
812
  setValue(`steps.${index}.connectionId`, (option == null ? void 0 : option.connectionId) || "");
703
813
  setValue(`steps.${index}.slug`, (option == null ? void 0 : option.slug) || "");
814
+ if (copy) Object.entries(copy).forEach(([key, value]) => setValue(`steps.${index}.${key}`, value));
704
815
  },
705
816
  disabled: lockedStep(index),
706
817
  options: getStepOptions(index),
@@ -719,6 +830,15 @@ const FormOrganizationWorkflowEdit = ({
719
830
  }
720
831
  }
721
832
  ),
833
+ firstEntryOnly({ campaign: campaignData, event, type: step.type }) && /* @__PURE__ */ jsx(
834
+ "p",
835
+ {
836
+ ...{
837
+ className: "text-sm text-gray-dark"
838
+ },
839
+ children: "Runs on a person's first entry only."
840
+ }
841
+ ),
722
842
  step.type === "step.webhook.send" && /* @__PURE__ */ jsx(
723
843
  Controller,
724
844
  {
@@ -726,12 +846,12 @@ const FormOrganizationWorkflowEdit = ({
726
846
  control,
727
847
  name: `steps.${index}.url`,
728
848
  render: ({ field: { value, onChange } }) => {
729
- var _a2, _b2, _c2, _d2;
849
+ var _a3, _b2, _c2, _d2;
730
850
  return /* @__PURE__ */ jsx(
731
851
  InputGroup,
732
852
  {
733
853
  ...{
734
- error: (_d2 = (_c2 = (_b2 = (_a2 = formState == null ? void 0 : formState.errors) == null ? void 0 : _a2.steps) == null ? void 0 : _b2[index]) == null ? void 0 : _c2.url) == null ? void 0 : _d2.message,
854
+ error: (_d2 = (_c2 = (_b2 = (_a3 = formState == null ? void 0 : formState.errors) == null ? void 0 : _a3.steps) == null ? void 0 : _b2[index]) == null ? void 0 : _c2.url) == null ? void 0 : _d2.message,
735
855
  input: /* @__PURE__ */ jsx(
736
856
  InputUrl,
737
857
  {
@@ -757,12 +877,12 @@ const FormOrganizationWorkflowEdit = ({
757
877
  control,
758
878
  name: `steps.${index}.members`,
759
879
  render: ({ field: { value, onChange } }) => {
760
- var _a2, _b2, _c2, _d2;
880
+ var _a3, _b2, _c2, _d2;
761
881
  return /* @__PURE__ */ jsx(
762
882
  InputGroup,
763
883
  {
764
884
  ...{
765
- error: (_d2 = (_c2 = (_b2 = (_a2 = formState == null ? void 0 : formState.errors) == null ? void 0 : _a2.steps) == null ? void 0 : _b2[index]) == null ? void 0 : _c2.members) == null ? void 0 : _d2.message,
885
+ error: (_d2 = (_c2 = (_b2 = (_a3 = formState == null ? void 0 : formState.errors) == null ? void 0 : _a3.steps) == null ? void 0 : _b2[index]) == null ? void 0 : _c2.members) == null ? void 0 : _d2.message,
766
886
  input: /* @__PURE__ */ jsx(
767
887
  InputResource,
768
888
  {
@@ -818,6 +938,15 @@ const FormOrganizationWorkflowEdit = ({
818
938
  }
819
939
  }
820
940
  ),
941
+ event === "lead.insert" && emailSteps.includes(step.type) && /* @__PURE__ */ jsx(
942
+ "p",
943
+ {
944
+ ...{
945
+ className: "text-sm text-gray-dark"
946
+ },
947
+ children: "Drawbridge adds the entrant's order and missions under your message. You can't edit or remove them."
948
+ }
949
+ ),
821
950
  step.type === "step.sms.send" && /* @__PURE__ */ jsx(
822
951
  Controller,
823
952
  {
@@ -825,12 +954,12 @@ const FormOrganizationWorkflowEdit = ({
825
954
  control,
826
955
  name: `steps.${index}.message`,
827
956
  render: ({ field: { value, onChange } }) => {
828
- var _a2, _b2, _c2, _d2;
957
+ var _a3, _b2, _c2, _d2;
829
958
  return /* @__PURE__ */ jsx(
830
959
  InputGroup,
831
960
  {
832
961
  ...{
833
- error: (_d2 = (_c2 = (_b2 = (_a2 = formState == null ? void 0 : formState.errors) == null ? void 0 : _a2.steps) == null ? void 0 : _b2[index]) == null ? void 0 : _c2.message) == null ? void 0 : _d2.message,
962
+ error: (_d2 = (_c2 = (_b2 = (_a3 = formState == null ? void 0 : formState.errors) == null ? void 0 : _a3.steps) == null ? void 0 : _b2[index]) == null ? void 0 : _c2.message) == null ? void 0 : _d2.message,
834
963
  input: /* @__PURE__ */ jsx(
835
964
  InputTextarea,
836
965
  {
@@ -856,12 +985,12 @@ const FormOrganizationWorkflowEdit = ({
856
985
  control,
857
986
  name: `steps.${index}.discount`,
858
987
  render: ({ field: { value, onChange } }) => {
859
- var _a2, _b2, _c2, _d2;
988
+ var _a3, _b2, _c2, _d2;
860
989
  return /* @__PURE__ */ jsx(
861
990
  InputGroup,
862
991
  {
863
992
  ...{
864
- error: (_d2 = (_c2 = (_b2 = (_a2 = formState == null ? void 0 : formState.errors) == null ? void 0 : _a2.steps) == null ? void 0 : _b2[index]) == null ? void 0 : _c2.discount) == null ? void 0 : _d2.message,
993
+ error: (_d2 = (_c2 = (_b2 = (_a3 = formState == null ? void 0 : formState.errors) == null ? void 0 : _a3.steps) == null ? void 0 : _b2[index]) == null ? void 0 : _c2.discount) == null ? void 0 : _d2.message,
865
994
  input: /* @__PURE__ */ jsx(
866
995
  InputResource,
867
996
  {
@@ -951,9 +1080,14 @@ const FormOrganizationWorkflowEdit = ({
951
1080
  };
952
1081
  export {
953
1082
  FormOrganizationWorkflowEdit,
1083
+ SAMPLE,
1084
+ TextPreview,
1085
+ firstEntryOnly,
1086
+ pickedCopy,
954
1087
  prefillRow,
955
1088
  stepReason,
956
1089
  stepRow,
957
1090
  stepVariables,
1091
+ webhookSample,
958
1092
  workflowSchema
959
1093
  };
@@ -0,0 +1,92 @@
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 item_row_exports = {};
29
+ __export(item_row_exports, {
30
+ default: () => item_row_default
31
+ });
32
+ module.exports = __toCommonJS(item_row_exports);
33
+ var import_jsx_runtime = require("react/jsx-runtime");
34
+ var import_card_asset = __toESM(require("../shared/card-asset"));
35
+ const ItemRow = ({
36
+ description,
37
+ handle,
38
+ image,
39
+ name,
40
+ summary
41
+ }) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
42
+ "div",
43
+ {
44
+ ...{
45
+ className: "flex items-center min-w-0 flex-1 gap-3"
46
+ },
47
+ children: [
48
+ handle,
49
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
50
+ import_card_asset.default,
51
+ {
52
+ ...{
53
+ asset: image || null,
54
+ className: "w-10 h-10",
55
+ classNameContainer: "bg-gray-light border border-gray",
56
+ sizes: "40px",
57
+ title: description || (image == null ? void 0 : image.filename) || name
58
+ }
59
+ }
60
+ ),
61
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
62
+ "span",
63
+ {
64
+ ...{
65
+ className: "flex flex-col min-w-0"
66
+ },
67
+ children: [
68
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
69
+ "span",
70
+ {
71
+ ...{
72
+ className: "truncate"
73
+ },
74
+ children: name
75
+ }
76
+ ),
77
+ summary && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
78
+ "span",
79
+ {
80
+ ...{
81
+ className: "text-sm text-gray-dark truncate"
82
+ },
83
+ children: summary
84
+ }
85
+ )
86
+ ]
87
+ }
88
+ )
89
+ ]
90
+ }
91
+ );
92
+ var item_row_default = ItemRow;
@@ -0,0 +1,63 @@
1
+ import { jsx, jsxs } from "react/jsx-runtime";
2
+ import CardAsset from "../shared/card-asset.mjs";
3
+ const ItemRow = ({
4
+ description,
5
+ handle,
6
+ image,
7
+ name,
8
+ summary
9
+ }) => /* @__PURE__ */ jsxs(
10
+ "div",
11
+ {
12
+ ...{
13
+ className: "flex items-center min-w-0 flex-1 gap-3"
14
+ },
15
+ children: [
16
+ handle,
17
+ /* @__PURE__ */ jsx(
18
+ CardAsset,
19
+ {
20
+ ...{
21
+ asset: image || null,
22
+ className: "w-10 h-10",
23
+ classNameContainer: "bg-gray-light border border-gray",
24
+ sizes: "40px",
25
+ title: description || (image == null ? void 0 : image.filename) || name
26
+ }
27
+ }
28
+ ),
29
+ /* @__PURE__ */ jsxs(
30
+ "span",
31
+ {
32
+ ...{
33
+ className: "flex flex-col min-w-0"
34
+ },
35
+ children: [
36
+ /* @__PURE__ */ jsx(
37
+ "span",
38
+ {
39
+ ...{
40
+ className: "truncate"
41
+ },
42
+ children: name
43
+ }
44
+ ),
45
+ summary && /* @__PURE__ */ jsx(
46
+ "span",
47
+ {
48
+ ...{
49
+ className: "text-sm text-gray-dark truncate"
50
+ },
51
+ children: summary
52
+ }
53
+ )
54
+ ]
55
+ }
56
+ )
57
+ ]
58
+ }
59
+ );
60
+ var item_row_default = ItemRow;
61
+ export {
62
+ item_row_default as default
63
+ };
@@ -17,11 +17,14 @@ var __copyProps = (to, from, except, desc) => {
17
17
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
18
  var sms_exports = {};
19
19
  __export(sms_exports, {
20
+ smsBrandLine: () => smsBrandLine,
20
21
  smsNumberActive: () => smsNumberActive
21
22
  });
22
23
  module.exports = __toCommonJS(sms_exports);
23
24
  const smsNumberActive = (organization) => ((organization == null ? void 0 : organization.identityItems) || []).some((row) => (row == null ? void 0 : row.type) === "sms" && (row == null ? void 0 : row.status) === "verified");
25
+ const smsBrandLine = (brand, message) => brand && !String(message || "").trim().toLowerCase().startsWith(String(brand).trim().toLowerCase()) ? brand : null;
24
26
  // Annotate the CommonJS export names for ESM import in node:
25
27
  0 && (module.exports = {
28
+ smsBrandLine,
26
29
  smsNumberActive
27
30
  });