@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.
Files changed (32) hide show
  1. package/dist/bridge/lib/url.js +3 -3
  2. package/dist/bridge/lib/url.mjs +3 -3
  3. package/dist/bridge/share-button.js +12 -2
  4. package/dist/bridge/share-button.mjs +12 -2
  5. package/dist/bridge/template-layout.js +1 -1
  6. package/dist/bridge/template-layout.mjs +1 -1
  7. package/dist/dashboard/answer-rows.js +77 -0
  8. package/dist/dashboard/answer-rows.mjs +41 -0
  9. package/dist/dashboard/card-order.js +186 -243
  10. package/dist/dashboard/card-order.mjs +186 -243
  11. package/dist/dashboard/form-organization-campaign-field-list.js +8 -49
  12. package/dist/dashboard/form-organization-campaign-field-list.mjs +8 -49
  13. package/dist/dashboard/form-organization-workflow.js +70 -120
  14. package/dist/dashboard/form-organization-workflow.mjs +68 -120
  15. package/dist/dashboard/item-row.js +92 -0
  16. package/dist/dashboard/item-row.mjs +63 -0
  17. package/dist/dashboard/lib/sms.js +3 -0
  18. package/dist/dashboard/lib/sms.mjs +2 -0
  19. package/dist/dashboard/order-sections.js +220 -0
  20. package/dist/dashboard/order-sections.mjs +185 -0
  21. package/dist/dashboard/preview.js +29 -2
  22. package/dist/dashboard/preview.mjs +28 -2
  23. package/dist/shared/lib/helpers.js +7 -0
  24. package/dist/shared/lib/helpers.mjs +7 -0
  25. package/package.json +19 -4
  26. package/types/bridge/lib/url.d.ts +5 -4
  27. package/types/dashboard/answer-rows.d.ts +30 -0
  28. package/types/dashboard/card-order.d.ts +16 -14
  29. package/types/dashboard/form-organization-workflow.d.ts +2 -0
  30. package/types/dashboard/item-row.d.ts +25 -0
  31. package/types/dashboard/order-sections.d.ts +36 -0
  32. 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";
@@ -18,34 +19,29 @@ import { FormNotification } from "./form-notification.mjs";
18
19
  import { InputArrayButton, InputArrayControl, InputArraySortable } from "./input-array.mjs";
19
20
  import Badge from "../shared/badge.mjs";
20
21
  import InputSwitch from "../shared/input-switch.mjs";
21
- import Tooltip from "../shared/tooltip.mjs";
22
22
  import CardSection from "./card-section.mjs";
23
23
  import Accordion from "./accordion.mjs";
24
24
  import Preview from "./preview.mjs";
25
25
  import CardTask from "./card-task.mjs";
26
26
  import { LoaderDynamic } from "../shared/loader.mjs";
27
- import { smsNumberActive } from "./lib/sms.mjs";
27
+ import { smsBrandLine, smsNumberActive } from "./lib/sms.mjs";
28
28
  import Trash from "../icons/trash.mjs";
29
29
  import Button from "../shared/button.mjs";
30
30
  const emailSteps = ["step.email.send"];
31
31
  const teamSteps = ["step.email.notify"];
32
32
  const messageSteps = [...emailSteps, "step.sms.send"];
33
- const defaultScore = {
34
- rules: [
35
- { description: "From: domain has series of non-vowel letters", score: 0.5 },
36
- { description: "Informational: message was not relayed via SMTP", score: 0 },
37
- { description: "Informational: message has no Received headers", score: 0 }
38
- ],
39
- subtotal: 0,
40
- threshold: 5,
41
- 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;
42
39
  };
43
40
  const stepPrefills = {
44
41
  "step.email.send": {
45
- message: "Thanks for entering. We have your entry and will be in touch.",
46
- score: defaultScore,
47
- subject: "Thanks for entering",
48
- 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
49
45
  },
50
46
  // Nothing to prefill: the step writes its own copy.
51
47
  "step.email.notify": {}
@@ -104,6 +100,13 @@ const prefillRow = ({ entry, step, steps = [] }) => {
104
100
  type: step
105
101
  });
106
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
+ };
107
110
  const stepReason = ({ entry, saved = [], type }) => {
108
111
  var _a, _b;
109
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,9 +114,6 @@ const stepReason = ({ entry, saved = [], type }) => {
111
114
  const stepRow = (step = {}, members = []) => {
112
115
  var _a, _b, _c, _d, _e, _f, _g, _h, _i;
113
116
  return {
114
- // @story workflows/entry-confirmation
115
- // The System email: no remove and no switch ( the api keeps it on ).
116
- confirmation: Boolean(step.confirmation),
117
117
  connectionId: step.connectionId || "",
118
118
  discount: ((_a = step.settings) == null ? void 0 : _a.discount) || null,
119
119
  // @story workflows/step-switch
@@ -193,18 +193,8 @@ const workflowSchema = yup.object({
193
193
  })
194
194
  )
195
195
  });
196
- const samples = [
197
- {
198
- key: "New lead",
199
- value: "lead"
200
- },
201
- {
202
- key: "Verified their email",
203
- value: "verified"
204
- }
205
- ];
206
- const useEmailPreview = ({ campaign, confirmation = false, event, message, organization, sample, subject, text }) => {
207
- const asked = JSON.stringify({ ...confirmation && { confirmation }, 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 });
208
198
  const [settled, setSettled] = useState(asked);
209
199
  useEffect(() => {
210
200
  const timer = setTimeout(() => setSettled(asked), 400);
@@ -232,18 +222,18 @@ const EmailStepCard = ({
232
222
  off,
233
223
  email: {
234
224
  campaign,
235
- confirmation,
236
225
  event,
237
226
  name,
238
- organization
227
+ organization,
228
+ title,
229
+ type
239
230
  }
240
231
  }) => {
241
- const [sample, setSample] = useState(samples[0].value);
242
232
  const [subject, message, text] = useWatch({
243
233
  control,
244
234
  name: [name + ".subject", name + ".message", name + ".text"]
245
235
  });
246
- const preview = useEmailPreview({ campaign, confirmation, event, message, organization, sample, subject, text });
236
+ const preview = useEmailPreview({ campaign, event, message, organization, subject, text, type });
247
237
  return /* @__PURE__ */ jsxs(
248
238
  CardSection,
249
239
  {
@@ -260,7 +250,7 @@ const EmailStepCard = ({
260
250
  },
261
251
  children: [
262
252
  children,
263
- /* @__PURE__ */ jsx(
253
+ emailSteps.includes(type) && /* @__PURE__ */ jsx(
264
254
  Accordion,
265
255
  {
266
256
  ...{
@@ -288,29 +278,17 @@ const EmailStepCard = ({
288
278
  ...{
289
279
  className: off ? "opacity-50" : ""
290
280
  },
291
- children: /* @__PURE__ */ jsx(
292
- Preview,
281
+ children: /* @__PURE__ */ jsx(Preview, { children: /* @__PURE__ */ jsx(
282
+ "iframe",
293
283
  {
294
284
  ...{
295
- states: {
296
- onChange: setSample,
297
- options: samples,
298
- value: sample
299
- }
300
- },
301
- children: /* @__PURE__ */ jsx(
302
- "iframe",
303
- {
304
- ...{
305
- // The rendered email, as a mail app shows it.
306
- className: "block w-full h-full border-0 bg-white",
307
- srcDoc: (preview == null ? void 0 : preview.html) || "",
308
- title: "Send email"
309
- }
310
- }
311
- )
285
+ // The rendered email, as a mail app shows it.
286
+ className: "block w-full h-full border-0 bg-white",
287
+ srcDoc: (preview == null ? void 0 : preview.html) || "",
288
+ title
289
+ }
312
290
  }
313
- )
291
+ ) })
314
292
  }
315
293
  )
316
294
  ]
@@ -320,7 +298,6 @@ const EmailStepCard = ({
320
298
  const SAMPLE = {
321
299
  email: "sam.rivera@example.com",
322
300
  name: "Sam Rivera",
323
- order: "House espresso \xD7 2, Holiday blend \xD7 1",
324
301
  phone: "+14165550142"
325
302
  };
326
303
  const webhookSample = ({ campaign }) => JSON.stringify({
@@ -335,33 +312,20 @@ const webhookSample = ({ campaign }) => JSON.stringify({
335
312
  number: SAMPLE.phone
336
313
  }
337
314
  }, null, 2);
338
- const teamSample = ({ campaign, event, organization }) => event === "order.insert" ? {
339
- lines: ["New order for " + ((campaign == null ? void 0 : campaign.title) || "your campaign") + " at " + ((organization == null ? void 0 : organization.title) || "your organization") + ": " + SAMPLE.order + ".", "Estimated total $55.00.", "Pickup: Saturday, 9 am to noon.", "Note: Please grind the Holiday blend for a French press."],
340
- title: "New order \u2014 " + ((campaign == null ? void 0 : campaign.title) || "your campaign")
341
- } : {
342
- lines: [SAMPLE.name + " (" + SAMPLE.email + ") entered " + ((campaign == null ? void 0 : campaign.title) || "your campaign") + "."],
343
- title: "1 new entry \u2014 " + ((campaign == null ? void 0 : campaign.title) || "your campaign")
344
- };
345
- const StepPreview = ({ campaign, control, event, image, name, organization, type }) => {
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 }) => {
346
317
  const [message] = useWatch({
347
318
  control,
348
319
  name: [name + ".message"]
349
320
  });
350
- if (type === "step.sms.send") return /* @__PURE__ */ jsxs("div", { className: "p-6 font-sans", children: [
351
- /* @__PURE__ */ jsx("p", { className: "mb-4 text-xs text-center text-gray-dark", children: organization == null ? void 0 : organization.title }),
352
- /* @__PURE__ */ jsxs("div", { className: "max-w-xs px-4 py-3 rounded-2xl rounded-bl-sm bg-gray-light text-black", children: [
353
- /* @__PURE__ */ jsx("p", { className: "whitespace-pre-wrap", children: message }),
354
- /* @__PURE__ */ jsx("p", { className: "mt-2", children: "Reply STOP to opt out" })
355
- ] })
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" })
356
327
  ] });
357
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 }) });
358
- if (teamSteps.includes(type)) {
359
- const { lines, title } = teamSample({ campaign, event, organization });
360
- return /* @__PURE__ */ jsxs("div", { className: "p-6 space-y-3 font-sans", children: [
361
- /* @__PURE__ */ jsx("p", { className: "text-lg font-bold", children: title }),
362
- lines.map((line) => /* @__PURE__ */ jsx("p", { children: line }, line))
363
- ] });
364
- }
365
329
  return /* @__PURE__ */ jsxs("div", { className: "min-h-screen flex flex-col items-center justify-center gap-3 p-6 text-gray-dark", children: [
366
330
  image && /* @__PURE__ */ jsx(
367
331
  Image,
@@ -440,6 +404,7 @@ const FormOrganizationWorkflowEdit = ({
440
404
  const organizationData = queryClient.getQueryData(["organization", values == null ? void 0 : values.organization]);
441
405
  const ownerEmail = organizationData.owner.email;
442
406
  const smsActive = smsNumberActive(organizationData);
407
+ const campaignData = queryClient.getQueryData(["campaign", values == null ? void 0 : values.campaign]);
443
408
  const commerceConnectionId = ((_b = ((catalog == null ? void 0 : catalog.steps) || []).find(
444
409
  (s) => s.value === "step.commerce.customer.insert" || s.value === "step.commerce.code.issue"
445
410
  )) == null ? void 0 : _b.connectionId) || null;
@@ -608,7 +573,7 @@ const FormOrganizationWorkflowEdit = ({
608
573
  }) => {
609
574
  try {
610
575
  const body = {
611
- steps: steps.map(({ confirmation, connectionId, discount, enabled, 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) => {
612
577
  const settings = {};
613
578
  if (type === "step.webhook.send") settings.url = url;
614
579
  if (emailSteps.includes(type)) settings.subject = subject;
@@ -625,8 +590,6 @@ const FormOrganizationWorkflowEdit = ({
625
590
  const resolvedConnectionId = (catalogStep == null ? void 0 : catalogStep.connectionId) || connectionId || null;
626
591
  const resolvedSlug = (catalogStep == null ? void 0 : catalogStep.slug) || slug || null;
627
592
  return {
628
- // The System email row names itself; the api keeps it only where it was.
629
- ...confirmation && { confirmation: true },
630
593
  ...resolvedConnectionId && { connectionId: resolvedConnectionId },
631
594
  enabled: enabled !== false,
632
595
  ...resolvedSlug && { slug: resolvedSlug },
@@ -733,20 +696,21 @@ const FormOrganizationWorkflowEdit = ({
733
696
  // A Send email step shows its email beside its form.
734
697
  off: step.enabled === false,
735
698
  // Every other step with a type has its preview too.
736
- preview: step.type && !emailSteps.includes(step.type) && {
737
- campaign: queryClient.getQueryData(["campaign", values == null ? void 0 : values.campaign]),
738
- event,
699
+ preview: step.type && !renderedSteps.includes(step.type) && {
700
+ campaign: campaignData,
739
701
  image: ((_a2 = ((catalog == null ? void 0 : catalog.steps) || []).find((entry) => entry.value === step.type)) == null ? void 0 : _a2.image) || null,
740
702
  name: `steps.${index}`,
741
703
  organization: organizationData,
742
704
  type: step.type
743
705
  },
744
- email: emailSteps.includes(step.type) && {
706
+ // Send email and Email notification show the email the api renders.
707
+ email: renderedSteps.includes(step.type) && {
745
708
  campaign: values == null ? void 0 : values.campaign,
746
- confirmation: step.confirmation,
747
709
  event,
748
710
  name: `steps.${index}`,
749
- 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
750
714
  },
751
715
  cta: /* @__PURE__ */ jsxs(
752
716
  "span",
@@ -756,7 +720,7 @@ const FormOrganizationWorkflowEdit = ({
756
720
  },
757
721
  children: [
758
722
  renderStepBadge(step),
759
- !lockedStep(index) && !step.confirmation && /* @__PURE__ */ jsx(
723
+ !lockedStep(index) && /* @__PURE__ */ jsx(
760
724
  InputArrayControl,
761
725
  {
762
726
  ...{
@@ -766,35 +730,7 @@ const FormOrganizationWorkflowEdit = ({
766
730
  },
767
731
  "remove"
768
732
  ),
769
- step.confirmation ? /* @__PURE__ */ jsx(
770
- Tooltip,
771
- {
772
- ...{
773
- content: "System email"
774
- },
775
- children: /* @__PURE__ */ jsx(
776
- "span",
777
- {
778
- ...{
779
- className: "inline-flex pointer-events-none"
780
- },
781
- children: /* @__PURE__ */ jsx(
782
- InputSwitch,
783
- {
784
- ...{
785
- "aria-label": "System email, always on",
786
- disabled: true,
787
- onChange: () => {
788
- },
789
- small: true,
790
- value: true
791
- }
792
- }
793
- )
794
- }
795
- )
796
- }
797
- ) : /* @__PURE__ */ jsx(
733
+ /* @__PURE__ */ jsx(
798
734
  Controller,
799
735
  {
800
736
  ...{
@@ -871,12 +807,13 @@ const FormOrganizationWorkflowEdit = ({
871
807
  onChange: (val) => {
872
808
  const [type] = val.split("::");
873
809
  const option = getStepOptions(index).find((o) => o.value === val);
810
+ const copy = pickedCopy({ row: getValues(`steps.${index}`), type });
874
811
  onChange(type);
875
812
  setValue(`steps.${index}.connectionId`, (option == null ? void 0 : option.connectionId) || "");
876
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));
877
815
  },
878
- // The System email is always a Send email.
879
- disabled: lockedStep(index) || Boolean(step.confirmation),
816
+ disabled: lockedStep(index),
880
817
  options: getStepOptions(index),
881
818
  // Resolved from the WHOLE ROW, not from this path: the
882
819
  // option value carries a connection the type alone cannot
@@ -893,6 +830,15 @@ const FormOrganizationWorkflowEdit = ({
893
830
  }
894
831
  }
895
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
+ ),
896
842
  step.type === "step.webhook.send" && /* @__PURE__ */ jsx(
897
843
  Controller,
898
844
  {
@@ -992,7 +938,7 @@ const FormOrganizationWorkflowEdit = ({
992
938
  }
993
939
  }
994
940
  ),
995
- step.confirmation && /* @__PURE__ */ jsx(
941
+ event === "lead.insert" && emailSteps.includes(step.type) && /* @__PURE__ */ jsx(
996
942
  "p",
997
943
  {
998
944
  ...{
@@ -1135,11 +1081,13 @@ const FormOrganizationWorkflowEdit = ({
1135
1081
  export {
1136
1082
  FormOrganizationWorkflowEdit,
1137
1083
  SAMPLE,
1084
+ TextPreview,
1085
+ firstEntryOnly,
1086
+ pickedCopy,
1138
1087
  prefillRow,
1139
1088
  stepReason,
1140
1089
  stepRow,
1141
1090
  stepVariables,
1142
- teamSample,
1143
1091
  webhookSample,
1144
1092
  workflowSchema
1145
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
  });
@@ -1,4 +1,6 @@
1
1
  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");
2
+ const smsBrandLine = (brand, message) => brand && !String(message || "").trim().toLowerCase().startsWith(String(brand).trim().toLowerCase()) ? brand : null;
2
3
  export {
4
+ smsBrandLine,
3
5
  smsNumberActive
4
6
  };