@drawbridge/components 0.1.14 → 0.1.15
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 +77 -38
- package/dist/bridge/form-subdomain-missions.mjs +76 -38
- package/dist/dashboard/card-campaign-switch.js +55 -43
- package/dist/dashboard/card-campaign-switch.mjs +56 -44
- package/dist/dashboard/card-order.js +216 -31
- package/dist/dashboard/card-order.mjs +216 -31
- package/dist/dashboard/connection-workflows.js +13 -4
- package/dist/dashboard/connection-workflows.mjs +13 -4
- package/dist/dashboard/form-organization-campaign-field-select.js +51 -5
- package/dist/dashboard/form-organization-campaign-field-select.mjs +51 -5
- package/dist/dashboard/form-organization-campaign-field-textarea.js +46 -8
- package/dist/dashboard/form-organization-campaign-field-textarea.mjs +46 -8
- package/dist/dashboard/form-organization-campaign-section.js +24 -4
- package/dist/dashboard/form-organization-campaign-section.mjs +24 -4
- package/dist/dashboard/form-organization-workflow.js +222 -33
- package/dist/dashboard/form-organization-workflow.mjs +219 -33
- package/dist/input-code.js +35 -53
- package/dist/input-code.mjs +26 -54
- package/dist/shared/button.js +1 -1
- package/dist/shared/button.mjs +1 -1
- package/dist/shared/lib/campaign.js +9 -3
- package/dist/shared/lib/campaign.mjs +7 -2
- package/package.json +1 -1
- package/types/bridge/form-subdomain-missions.d.ts +3 -1
- package/types/dashboard/card-order.d.ts +15 -2
- package/types/dashboard/form-organization-campaign-section.d.ts +2 -0
- package/types/dashboard/form-organization-workflow.d.ts +13 -0
|
@@ -17,6 +17,8 @@ import InputCombobox from "./input-combobox.mjs";
|
|
|
17
17
|
import { FormNotification } from "./form-notification.mjs";
|
|
18
18
|
import { InputArrayButton, InputArrayControl, InputArraySortable } from "./input-array.mjs";
|
|
19
19
|
import Badge from "../shared/badge.mjs";
|
|
20
|
+
import InputSwitch from "../shared/input-switch.mjs";
|
|
21
|
+
import Tooltip from "../shared/tooltip.mjs";
|
|
20
22
|
import CardSection from "./card-section.mjs";
|
|
21
23
|
import Accordion from "./accordion.mjs";
|
|
22
24
|
import Preview from "./preview.mjs";
|
|
@@ -109,8 +111,14 @@ const stepReason = ({ entry, saved = [], type }) => {
|
|
|
109
111
|
const stepRow = (step = {}, members = []) => {
|
|
110
112
|
var _a, _b, _c, _d, _e, _f, _g, _h, _i;
|
|
111
113
|
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),
|
|
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
|
|
@@ -195,8 +203,8 @@ const samples = [
|
|
|
195
203
|
value: "verified"
|
|
196
204
|
}
|
|
197
205
|
];
|
|
198
|
-
const useEmailPreview = ({ campaign, event, message, organization, sample, subject, text }) => {
|
|
199
|
-
const asked = JSON.stringify({ message, sample, subject, text });
|
|
206
|
+
const useEmailPreview = ({ campaign, confirmation = false, event, message, organization, sample, subject, text }) => {
|
|
207
|
+
const asked = JSON.stringify({ ...confirmation && { confirmation }, message, sample, subject, text });
|
|
200
208
|
const [settled, setSettled] = useState(asked);
|
|
201
209
|
useEffect(() => {
|
|
202
210
|
const timer = setTimeout(() => setSettled(asked), 400);
|
|
@@ -221,8 +229,10 @@ const EmailStepCard = ({
|
|
|
221
229
|
card,
|
|
222
230
|
children,
|
|
223
231
|
control,
|
|
232
|
+
off,
|
|
224
233
|
email: {
|
|
225
234
|
campaign,
|
|
235
|
+
confirmation,
|
|
226
236
|
event,
|
|
227
237
|
name,
|
|
228
238
|
organization
|
|
@@ -233,7 +243,7 @@ const EmailStepCard = ({
|
|
|
233
243
|
control,
|
|
234
244
|
name: [name + ".subject", name + ".message", name + ".text"]
|
|
235
245
|
});
|
|
236
|
-
const preview = useEmailPreview({ campaign, event, message, organization, sample, subject, text });
|
|
246
|
+
const preview = useEmailPreview({ campaign, confirmation, event, message, organization, sample, subject, text });
|
|
237
247
|
return /* @__PURE__ */ jsxs(
|
|
238
248
|
CardSection,
|
|
239
249
|
{
|
|
@@ -273,24 +283,32 @@ const EmailStepCard = ({
|
|
|
273
283
|
}
|
|
274
284
|
),
|
|
275
285
|
/* @__PURE__ */ jsx(
|
|
276
|
-
|
|
286
|
+
"div",
|
|
277
287
|
{
|
|
278
288
|
...{
|
|
279
|
-
|
|
280
|
-
onChange: setSample,
|
|
281
|
-
options: samples,
|
|
282
|
-
value: sample
|
|
283
|
-
}
|
|
289
|
+
className: off ? "opacity-50" : ""
|
|
284
290
|
},
|
|
285
291
|
children: /* @__PURE__ */ jsx(
|
|
286
|
-
|
|
292
|
+
Preview,
|
|
287
293
|
{
|
|
288
294
|
...{
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
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
|
+
)
|
|
294
312
|
}
|
|
295
313
|
)
|
|
296
314
|
}
|
|
@@ -299,10 +317,74 @@ const EmailStepCard = ({
|
|
|
299
317
|
}
|
|
300
318
|
);
|
|
301
319
|
};
|
|
320
|
+
const SAMPLE = {
|
|
321
|
+
email: "sam.rivera@example.com",
|
|
322
|
+
name: "Sam Rivera",
|
|
323
|
+
order: "House espresso \xD7 2, Holiday blend \xD7 1",
|
|
324
|
+
phone: "+14165550142"
|
|
325
|
+
};
|
|
326
|
+
const webhookSample = ({ campaign }) => JSON.stringify({
|
|
327
|
+
campaign: {
|
|
328
|
+
id: (campaign == null ? void 0 : campaign.id) || "cmp_sample",
|
|
329
|
+
title: (campaign == null ? void 0 : campaign.title) || "Your campaign"
|
|
330
|
+
},
|
|
331
|
+
email: SAMPLE.email,
|
|
332
|
+
id: "lead_sample",
|
|
333
|
+
name: SAMPLE.name,
|
|
334
|
+
phone: {
|
|
335
|
+
number: SAMPLE.phone
|
|
336
|
+
}
|
|
337
|
+
}, 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 }) => {
|
|
346
|
+
const [message] = useWatch({
|
|
347
|
+
control,
|
|
348
|
+
name: [name + ".message"]
|
|
349
|
+
});
|
|
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
|
+
] })
|
|
356
|
+
] });
|
|
357
|
+
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
|
+
return /* @__PURE__ */ jsxs("div", { className: "min-h-screen flex flex-col items-center justify-center gap-3 p-6 text-gray-dark", children: [
|
|
366
|
+
image && /* @__PURE__ */ jsx(
|
|
367
|
+
Image,
|
|
368
|
+
{
|
|
369
|
+
...{
|
|
370
|
+
alt: "",
|
|
371
|
+
className: "w-12 h-12 object-contain",
|
|
372
|
+
height: 48,
|
|
373
|
+
src: image,
|
|
374
|
+
unoptimized: true,
|
|
375
|
+
width: 48
|
|
376
|
+
}
|
|
377
|
+
}
|
|
378
|
+
),
|
|
379
|
+
/* @__PURE__ */ jsx("p", { children: "No preview available" })
|
|
380
|
+
] });
|
|
381
|
+
};
|
|
302
382
|
const StepCard = ({
|
|
303
383
|
children,
|
|
304
384
|
control,
|
|
305
385
|
email,
|
|
386
|
+
off,
|
|
387
|
+
preview,
|
|
306
388
|
...card
|
|
307
389
|
}) => email ? /* @__PURE__ */ jsx(
|
|
308
390
|
EmailStepCard,
|
|
@@ -310,15 +392,38 @@ const StepCard = ({
|
|
|
310
392
|
...{
|
|
311
393
|
card,
|
|
312
394
|
control,
|
|
313
|
-
email
|
|
395
|
+
email,
|
|
396
|
+
off
|
|
314
397
|
},
|
|
315
398
|
children
|
|
316
399
|
}
|
|
317
|
-
) : /* @__PURE__ */
|
|
400
|
+
) : /* @__PURE__ */ jsxs(
|
|
318
401
|
CardSection,
|
|
319
402
|
{
|
|
320
|
-
...
|
|
321
|
-
|
|
403
|
+
...{
|
|
404
|
+
...card,
|
|
405
|
+
columns: preview ? 2 : 1
|
|
406
|
+
},
|
|
407
|
+
children: [
|
|
408
|
+
children,
|
|
409
|
+
preview && /* @__PURE__ */ jsx(
|
|
410
|
+
"div",
|
|
411
|
+
{
|
|
412
|
+
...{
|
|
413
|
+
className: off ? "opacity-50" : ""
|
|
414
|
+
},
|
|
415
|
+
children: /* @__PURE__ */ jsx(Preview, { children: /* @__PURE__ */ jsx(
|
|
416
|
+
StepPreview,
|
|
417
|
+
{
|
|
418
|
+
...{
|
|
419
|
+
control,
|
|
420
|
+
...preview
|
|
421
|
+
}
|
|
422
|
+
}
|
|
423
|
+
) })
|
|
424
|
+
}
|
|
425
|
+
)
|
|
426
|
+
]
|
|
322
427
|
}
|
|
323
428
|
);
|
|
324
429
|
const FormOrganizationWorkflowEdit = ({
|
|
@@ -503,7 +608,7 @@ const FormOrganizationWorkflowEdit = ({
|
|
|
503
608
|
}) => {
|
|
504
609
|
try {
|
|
505
610
|
const body = {
|
|
506
|
-
steps: steps.map(({ connectionId, discount, members, message, score, slug, subject, text, type, url }, index) => {
|
|
611
|
+
steps: steps.map(({ confirmation, connectionId, discount, enabled, members, message, score, slug, subject, text, type, url }, index) => {
|
|
507
612
|
const settings = {};
|
|
508
613
|
if (type === "step.webhook.send") settings.url = url;
|
|
509
614
|
if (emailSteps.includes(type)) settings.subject = subject;
|
|
@@ -520,7 +625,10 @@ const FormOrganizationWorkflowEdit = ({
|
|
|
520
625
|
const resolvedConnectionId = (catalogStep == null ? void 0 : catalogStep.connectionId) || connectionId || null;
|
|
521
626
|
const resolvedSlug = (catalogStep == null ? void 0 : catalogStep.slug) || slug || null;
|
|
522
627
|
return {
|
|
628
|
+
// The System email row names itself; the api keeps it only where it was.
|
|
629
|
+
...confirmation && { confirmation: true },
|
|
523
630
|
...resolvedConnectionId && { connectionId: resolvedConnectionId },
|
|
631
|
+
enabled: enabled !== false,
|
|
524
632
|
...resolvedSlug && { slug: resolvedSlug },
|
|
525
633
|
settings,
|
|
526
634
|
type
|
|
@@ -608,6 +716,7 @@ const FormOrganizationWorkflowEdit = ({
|
|
|
608
716
|
)
|
|
609
717
|
},
|
|
610
718
|
children: ({ field, handle, index, remove }) => {
|
|
719
|
+
var _a2;
|
|
611
720
|
const step = (watchedSteps == null ? void 0 : watchedSteps[index]) || field;
|
|
612
721
|
return (
|
|
613
722
|
// @story workflows/edit
|
|
@@ -622,8 +731,19 @@ const FormOrganizationWorkflowEdit = ({
|
|
|
622
731
|
control,
|
|
623
732
|
// @story workflows/send-email
|
|
624
733
|
// A Send email step shows its email beside its form.
|
|
734
|
+
off: step.enabled === false,
|
|
735
|
+
// 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,
|
|
739
|
+
image: ((_a2 = ((catalog == null ? void 0 : catalog.steps) || []).find((entry) => entry.value === step.type)) == null ? void 0 : _a2.image) || null,
|
|
740
|
+
name: `steps.${index}`,
|
|
741
|
+
organization: organizationData,
|
|
742
|
+
type: step.type
|
|
743
|
+
},
|
|
625
744
|
email: emailSteps.includes(step.type) && {
|
|
626
745
|
campaign: values == null ? void 0 : values.campaign,
|
|
746
|
+
confirmation: step.confirmation,
|
|
627
747
|
event,
|
|
628
748
|
name: `steps.${index}`,
|
|
629
749
|
organization: values == null ? void 0 : values.organization
|
|
@@ -636,7 +756,7 @@ const FormOrganizationWorkflowEdit = ({
|
|
|
636
756
|
},
|
|
637
757
|
children: [
|
|
638
758
|
renderStepBadge(step),
|
|
639
|
-
!lockedStep(index) && /* @__PURE__ */ jsx(
|
|
759
|
+
!lockedStep(index) && !step.confirmation && /* @__PURE__ */ jsx(
|
|
640
760
|
InputArrayControl,
|
|
641
761
|
{
|
|
642
762
|
...{
|
|
@@ -645,6 +765,58 @@ const FormOrganizationWorkflowEdit = ({
|
|
|
645
765
|
}
|
|
646
766
|
},
|
|
647
767
|
"remove"
|
|
768
|
+
),
|
|
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(
|
|
798
|
+
Controller,
|
|
799
|
+
{
|
|
800
|
+
...{
|
|
801
|
+
control,
|
|
802
|
+
name: `steps.${index}.enabled`,
|
|
803
|
+
render: ({ field: { onChange, value } }) => {
|
|
804
|
+
var _a3;
|
|
805
|
+
return /* @__PURE__ */ jsx(
|
|
806
|
+
InputSwitch,
|
|
807
|
+
{
|
|
808
|
+
...{
|
|
809
|
+
"aria-label": ((_a3 = ((catalog == null ? void 0 : catalog.steps) || []).find((entry) => entry.value === step.type)) == null ? void 0 : _a3.key) || "Step " + (index + 1),
|
|
810
|
+
disabled: disabled || (formState == null ? void 0 : formState.isSubmitting),
|
|
811
|
+
onChange,
|
|
812
|
+
small: true,
|
|
813
|
+
value: value !== false
|
|
814
|
+
}
|
|
815
|
+
}
|
|
816
|
+
);
|
|
817
|
+
}
|
|
818
|
+
}
|
|
819
|
+
}
|
|
648
820
|
)
|
|
649
821
|
]
|
|
650
822
|
}
|
|
@@ -667,7 +839,8 @@ const FormOrganizationWorkflowEdit = ({
|
|
|
667
839
|
"div",
|
|
668
840
|
{
|
|
669
841
|
...{
|
|
670
|
-
|
|
842
|
+
// A step switched off is greyed; its settings are kept.
|
|
843
|
+
className: "space-y-3" + (step.enabled === false ? " opacity-50" : "")
|
|
671
844
|
},
|
|
672
845
|
children: [
|
|
673
846
|
issueIndex === index && /* @__PURE__ */ jsx(
|
|
@@ -685,12 +858,12 @@ const FormOrganizationWorkflowEdit = ({
|
|
|
685
858
|
control,
|
|
686
859
|
name: `steps.${index}.type`,
|
|
687
860
|
render: ({ field: { onChange } }) => {
|
|
688
|
-
var
|
|
861
|
+
var _a3, _b2, _c2, _d2;
|
|
689
862
|
return /* @__PURE__ */ jsx(
|
|
690
863
|
InputGroup,
|
|
691
864
|
{
|
|
692
865
|
...{
|
|
693
|
-
error: (_d2 = (_c2 = (_b2 = (
|
|
866
|
+
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
867
|
input: /* @__PURE__ */ jsx(
|
|
695
868
|
InputCombobox,
|
|
696
869
|
{
|
|
@@ -702,7 +875,8 @@ const FormOrganizationWorkflowEdit = ({
|
|
|
702
875
|
setValue(`steps.${index}.connectionId`, (option == null ? void 0 : option.connectionId) || "");
|
|
703
876
|
setValue(`steps.${index}.slug`, (option == null ? void 0 : option.slug) || "");
|
|
704
877
|
},
|
|
705
|
-
|
|
878
|
+
// The System email is always a Send email.
|
|
879
|
+
disabled: lockedStep(index) || Boolean(step.confirmation),
|
|
706
880
|
options: getStepOptions(index),
|
|
707
881
|
// Resolved from the WHOLE ROW, not from this path: the
|
|
708
882
|
// option value carries a connection the type alone cannot
|
|
@@ -726,12 +900,12 @@ const FormOrganizationWorkflowEdit = ({
|
|
|
726
900
|
control,
|
|
727
901
|
name: `steps.${index}.url`,
|
|
728
902
|
render: ({ field: { value, onChange } }) => {
|
|
729
|
-
var
|
|
903
|
+
var _a3, _b2, _c2, _d2;
|
|
730
904
|
return /* @__PURE__ */ jsx(
|
|
731
905
|
InputGroup,
|
|
732
906
|
{
|
|
733
907
|
...{
|
|
734
|
-
error: (_d2 = (_c2 = (_b2 = (
|
|
908
|
+
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
909
|
input: /* @__PURE__ */ jsx(
|
|
736
910
|
InputUrl,
|
|
737
911
|
{
|
|
@@ -757,12 +931,12 @@ const FormOrganizationWorkflowEdit = ({
|
|
|
757
931
|
control,
|
|
758
932
|
name: `steps.${index}.members`,
|
|
759
933
|
render: ({ field: { value, onChange } }) => {
|
|
760
|
-
var
|
|
934
|
+
var _a3, _b2, _c2, _d2;
|
|
761
935
|
return /* @__PURE__ */ jsx(
|
|
762
936
|
InputGroup,
|
|
763
937
|
{
|
|
764
938
|
...{
|
|
765
|
-
error: (_d2 = (_c2 = (_b2 = (
|
|
939
|
+
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
940
|
input: /* @__PURE__ */ jsx(
|
|
767
941
|
InputResource,
|
|
768
942
|
{
|
|
@@ -818,6 +992,15 @@ const FormOrganizationWorkflowEdit = ({
|
|
|
818
992
|
}
|
|
819
993
|
}
|
|
820
994
|
),
|
|
995
|
+
step.confirmation && /* @__PURE__ */ jsx(
|
|
996
|
+
"p",
|
|
997
|
+
{
|
|
998
|
+
...{
|
|
999
|
+
className: "text-sm text-gray-dark"
|
|
1000
|
+
},
|
|
1001
|
+
children: "Drawbridge adds the entrant's order and missions under your message. You can't edit or remove them."
|
|
1002
|
+
}
|
|
1003
|
+
),
|
|
821
1004
|
step.type === "step.sms.send" && /* @__PURE__ */ jsx(
|
|
822
1005
|
Controller,
|
|
823
1006
|
{
|
|
@@ -825,12 +1008,12 @@ const FormOrganizationWorkflowEdit = ({
|
|
|
825
1008
|
control,
|
|
826
1009
|
name: `steps.${index}.message`,
|
|
827
1010
|
render: ({ field: { value, onChange } }) => {
|
|
828
|
-
var
|
|
1011
|
+
var _a3, _b2, _c2, _d2;
|
|
829
1012
|
return /* @__PURE__ */ jsx(
|
|
830
1013
|
InputGroup,
|
|
831
1014
|
{
|
|
832
1015
|
...{
|
|
833
|
-
error: (_d2 = (_c2 = (_b2 = (
|
|
1016
|
+
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
1017
|
input: /* @__PURE__ */ jsx(
|
|
835
1018
|
InputTextarea,
|
|
836
1019
|
{
|
|
@@ -856,12 +1039,12 @@ const FormOrganizationWorkflowEdit = ({
|
|
|
856
1039
|
control,
|
|
857
1040
|
name: `steps.${index}.discount`,
|
|
858
1041
|
render: ({ field: { value, onChange } }) => {
|
|
859
|
-
var
|
|
1042
|
+
var _a3, _b2, _c2, _d2;
|
|
860
1043
|
return /* @__PURE__ */ jsx(
|
|
861
1044
|
InputGroup,
|
|
862
1045
|
{
|
|
863
1046
|
...{
|
|
864
|
-
error: (_d2 = (_c2 = (_b2 = (
|
|
1047
|
+
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
1048
|
input: /* @__PURE__ */ jsx(
|
|
866
1049
|
InputResource,
|
|
867
1050
|
{
|
|
@@ -951,9 +1134,12 @@ const FormOrganizationWorkflowEdit = ({
|
|
|
951
1134
|
};
|
|
952
1135
|
export {
|
|
953
1136
|
FormOrganizationWorkflowEdit,
|
|
1137
|
+
SAMPLE,
|
|
954
1138
|
prefillRow,
|
|
955
1139
|
stepReason,
|
|
956
1140
|
stepRow,
|
|
957
1141
|
stepVariables,
|
|
1142
|
+
teamSample,
|
|
1143
|
+
webhookSample,
|
|
958
1144
|
workflowSchema
|
|
959
1145
|
};
|
package/dist/input-code.js
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
"use client";
|
|
2
|
+
var __create = Object.create;
|
|
2
3
|
var __defProp = Object.defineProperty;
|
|
3
4
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
5
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
5
7
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
8
|
var __export = (target, all) => {
|
|
7
9
|
for (var name in all)
|
|
@@ -15,6 +17,14 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
15
17
|
}
|
|
16
18
|
return to;
|
|
17
19
|
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
18
28
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
29
|
var input_code_exports = {};
|
|
20
30
|
__export(input_code_exports, {
|
|
@@ -23,8 +33,7 @@ __export(input_code_exports, {
|
|
|
23
33
|
});
|
|
24
34
|
module.exports = __toCommonJS(input_code_exports);
|
|
25
35
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
26
|
-
var
|
|
27
|
-
var import_styles = require("./styles");
|
|
36
|
+
var import_input_text = __toESM(require("./input-text"));
|
|
28
37
|
const codeDigits = (value, length = 6) => String(value ?? "").replace(/\D/g, "").slice(0, length);
|
|
29
38
|
const InputCode = ({
|
|
30
39
|
autoFocus,
|
|
@@ -37,60 +46,33 @@ const InputCode = ({
|
|
|
37
46
|
style,
|
|
38
47
|
value
|
|
39
48
|
}) => {
|
|
40
|
-
const [focused, setFocused] = (0, import_react.useState)(false);
|
|
41
49
|
const digits = codeDigits(value, length);
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
45
|
-
"div",
|
|
50
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
51
|
+
import_input_text.default,
|
|
46
52
|
{
|
|
47
53
|
...{
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
"aria-label": "Verification code"
|
|
71
|
-
},
|
|
72
|
-
autoComplete: "one-time-code",
|
|
73
|
-
autoFocus,
|
|
74
|
-
className: "absolute inset-0 w-full h-full opacity-0 cursor-text",
|
|
75
|
-
disabled,
|
|
76
|
-
id,
|
|
77
|
-
inputMode: "numeric",
|
|
78
|
-
maxLength: length,
|
|
79
|
-
name,
|
|
80
|
-
onBlur: () => setFocused(false),
|
|
81
|
-
onChange: ({ target }) => {
|
|
82
|
-
const next = codeDigits(target.value, length);
|
|
83
|
-
onChange == null ? void 0 : onChange(next);
|
|
84
|
-
if (next.length === length && next !== digits) onComplete == null ? void 0 : onComplete(next);
|
|
85
|
-
},
|
|
86
|
-
onFocus: () => setFocused(true),
|
|
87
|
-
pattern: "[0-9]*",
|
|
88
|
-
type: "text",
|
|
89
|
-
value: digits
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
)
|
|
93
|
-
]
|
|
54
|
+
// An `id` means a <label htmlFor> names it ( InputGroup's ); only a
|
|
55
|
+
// bare field names itself.
|
|
56
|
+
...!id && {
|
|
57
|
+
"aria-label": "Verification code"
|
|
58
|
+
},
|
|
59
|
+
autoComplete: "one-time-code",
|
|
60
|
+
autoFocus,
|
|
61
|
+
disabled,
|
|
62
|
+
id,
|
|
63
|
+
inputMode: "numeric",
|
|
64
|
+
maxLength: length,
|
|
65
|
+
name,
|
|
66
|
+
onChange: (text) => {
|
|
67
|
+
const next = codeDigits(text, length);
|
|
68
|
+
onChange == null ? void 0 : onChange(next);
|
|
69
|
+
if (next.length === length && next !== digits) onComplete == null ? void 0 : onComplete(next);
|
|
70
|
+
},
|
|
71
|
+
pattern: "[0-9]*",
|
|
72
|
+
style,
|
|
73
|
+
type: "text",
|
|
74
|
+
value: digits
|
|
75
|
+
}
|
|
94
76
|
}
|
|
95
77
|
);
|
|
96
78
|
};
|
package/dist/input-code.mjs
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsx
|
|
3
|
-
import
|
|
4
|
-
import { inputStyle } from "./styles.mjs";
|
|
2
|
+
import { jsx } from "react/jsx-runtime";
|
|
3
|
+
import InputText from "./input-text.mjs";
|
|
5
4
|
const codeDigits = (value, length = 6) => String(value ?? "").replace(/\D/g, "").slice(0, length);
|
|
6
5
|
const InputCode = ({
|
|
7
6
|
autoFocus,
|
|
@@ -14,60 +13,33 @@ const InputCode = ({
|
|
|
14
13
|
style,
|
|
15
14
|
value
|
|
16
15
|
}) => {
|
|
17
|
-
const [focused, setFocused] = useState(false);
|
|
18
16
|
const digits = codeDigits(value, length);
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
return /* @__PURE__ */ jsxs(
|
|
22
|
-
"div",
|
|
17
|
+
return /* @__PURE__ */ jsx(
|
|
18
|
+
InputText,
|
|
23
19
|
{
|
|
24
20
|
...{
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
"aria-label": "Verification code"
|
|
48
|
-
},
|
|
49
|
-
autoComplete: "one-time-code",
|
|
50
|
-
autoFocus,
|
|
51
|
-
className: "absolute inset-0 w-full h-full opacity-0 cursor-text",
|
|
52
|
-
disabled,
|
|
53
|
-
id,
|
|
54
|
-
inputMode: "numeric",
|
|
55
|
-
maxLength: length,
|
|
56
|
-
name,
|
|
57
|
-
onBlur: () => setFocused(false),
|
|
58
|
-
onChange: ({ target }) => {
|
|
59
|
-
const next = codeDigits(target.value, length);
|
|
60
|
-
onChange == null ? void 0 : onChange(next);
|
|
61
|
-
if (next.length === length && next !== digits) onComplete == null ? void 0 : onComplete(next);
|
|
62
|
-
},
|
|
63
|
-
onFocus: () => setFocused(true),
|
|
64
|
-
pattern: "[0-9]*",
|
|
65
|
-
type: "text",
|
|
66
|
-
value: digits
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
)
|
|
70
|
-
]
|
|
21
|
+
// An `id` means a <label htmlFor> names it ( InputGroup's ); only a
|
|
22
|
+
// bare field names itself.
|
|
23
|
+
...!id && {
|
|
24
|
+
"aria-label": "Verification code"
|
|
25
|
+
},
|
|
26
|
+
autoComplete: "one-time-code",
|
|
27
|
+
autoFocus,
|
|
28
|
+
disabled,
|
|
29
|
+
id,
|
|
30
|
+
inputMode: "numeric",
|
|
31
|
+
maxLength: length,
|
|
32
|
+
name,
|
|
33
|
+
onChange: (text) => {
|
|
34
|
+
const next = codeDigits(text, length);
|
|
35
|
+
onChange == null ? void 0 : onChange(next);
|
|
36
|
+
if (next.length === length && next !== digits) onComplete == null ? void 0 : onComplete(next);
|
|
37
|
+
},
|
|
38
|
+
pattern: "[0-9]*",
|
|
39
|
+
style,
|
|
40
|
+
type: "text",
|
|
41
|
+
value: digits
|
|
42
|
+
}
|
|
71
43
|
}
|
|
72
44
|
);
|
|
73
45
|
};
|