@embedreach/components 0.2.55 → 0.2.57
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/chunks/index.js +536 -322
- package/dist/index.umd.js +119 -119
- package/dist/styles.css +1 -1
- package/package.json +1 -1
package/dist/chunks/index.js
CHANGED
|
@@ -13,6 +13,7 @@ const CHANNEL_SENDER_PATH = "/channel/senders";
|
|
|
13
13
|
const CHANNEL_ACCOUNT_PATH = "/channel/accounts";
|
|
14
14
|
const COMMUNICATION_GROUP_PATH = "/communication-groups";
|
|
15
15
|
const STRIPO_PATH = "/stripo";
|
|
16
|
+
const SLACK_NOTIFICATION_PATH = "/slack-notifications";
|
|
16
17
|
const TELEMETRY_PATH = "/telemetry";
|
|
17
18
|
const SMS_REGISTRATION_APPLICATION_PATH = "/sms-registration";
|
|
18
19
|
var Subscribable = class {
|
|
@@ -58321,13 +58322,27 @@ const PopoverContent = React__default.forwardRef(({ className: className2, align
|
|
|
58321
58322
|
}
|
|
58322
58323
|
) }));
|
|
58323
58324
|
PopoverContent.displayName = Content2$1.displayName;
|
|
58324
|
-
const STATUS_DISPLAY = {
|
|
58325
|
-
|
|
58326
|
-
|
|
58327
|
-
|
|
58328
|
-
|
|
58329
|
-
|
|
58330
|
-
|
|
58325
|
+
const STATUS_DISPLAY = (args) => {
|
|
58326
|
+
const { status, automationType } = args;
|
|
58327
|
+
switch (status) {
|
|
58328
|
+
case AutomationStatus.DRAFT:
|
|
58329
|
+
return "Draft";
|
|
58330
|
+
case AutomationStatus.ACTIVE:
|
|
58331
|
+
return "Active";
|
|
58332
|
+
case AutomationStatus.RUNNING:
|
|
58333
|
+
if (automationType === AutomationTriggerType.ONE_TIME) {
|
|
58334
|
+
return "Scheduled";
|
|
58335
|
+
}
|
|
58336
|
+
return "Running";
|
|
58337
|
+
case AutomationStatus.COMPLETED:
|
|
58338
|
+
return "Completed";
|
|
58339
|
+
case AutomationStatus.FAILED:
|
|
58340
|
+
return "Failed";
|
|
58341
|
+
case AutomationStatus.DEACTIVATED:
|
|
58342
|
+
return "Deactivated";
|
|
58343
|
+
default:
|
|
58344
|
+
return status;
|
|
58345
|
+
}
|
|
58331
58346
|
};
|
|
58332
58347
|
const STATUS_COLORS = {
|
|
58333
58348
|
[AutomationStatus.DRAFT]: "bg-gray-500",
|
|
@@ -58423,7 +58438,11 @@ const StatusToggleCell = ({
|
|
|
58423
58438
|
className: `w-2 h-2 rounded-full mr-2 ${STATUS_COLORS[currentStatus]}`
|
|
58424
58439
|
}
|
|
58425
58440
|
),
|
|
58426
|
-
/* @__PURE__ */ jsx("span", { children: STATUS_DISPLAY
|
|
58441
|
+
/* @__PURE__ */ jsx("span", { children: STATUS_DISPLAY({
|
|
58442
|
+
status: currentStatus,
|
|
58443
|
+
// This should never happen, but we'll handle it gracefully
|
|
58444
|
+
automationType: rowOriginal.triggerType ?? AutomationTriggerType.ONE_TIME
|
|
58445
|
+
}) })
|
|
58427
58446
|
] }),
|
|
58428
58447
|
canTransition ? /* @__PURE__ */ jsx(ChevronDown, { className: "h-4 w-4 ml-2" }) : /* @__PURE__ */ jsxs(Tooltip, { children: [
|
|
58429
58448
|
/* @__PURE__ */ jsx(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx(Info, { className: "h-4 w-4 ml-2 text-gray-500" }) }),
|
|
@@ -58456,7 +58475,10 @@ const StatusToggleCell = ({
|
|
|
58456
58475
|
className: `w-2 h-2 rounded-full ${STATUS_COLORS[transitionStatus]} mr-2`
|
|
58457
58476
|
}
|
|
58458
58477
|
),
|
|
58459
|
-
STATUS_DISPLAY
|
|
58478
|
+
STATUS_DISPLAY({
|
|
58479
|
+
status: transitionStatus,
|
|
58480
|
+
automationType: rowOriginal.triggerType ?? AutomationTriggerType.ONE_TIME
|
|
58481
|
+
})
|
|
58460
58482
|
]
|
|
58461
58483
|
},
|
|
58462
58484
|
transitionStatus
|
|
@@ -62711,7 +62733,7 @@ const awsTollFreeNumberApplicationDataSchema = z.object({
|
|
|
62711
62733
|
tollFreeNumber: z.string(),
|
|
62712
62734
|
company: z.object({
|
|
62713
62735
|
name: z.string().describe("The legal name of the company"),
|
|
62714
|
-
website: z.string()
|
|
62736
|
+
website: z.string(),
|
|
62715
62737
|
address1: z.string(),
|
|
62716
62738
|
address2: z.string().optional(),
|
|
62717
62739
|
city: z.string(),
|
|
@@ -64623,7 +64645,6 @@ function createNameColumn(nameAccessor = "name", headerText, showDescription = f
|
|
|
64623
64645
|
const { original: rowOriginal } = info.row;
|
|
64624
64646
|
const status = rowOriginal.status;
|
|
64625
64647
|
const type = rowOriginal.type;
|
|
64626
|
-
const statusText = status ? status[0].toUpperCase() + status.slice(1) : "";
|
|
64627
64648
|
const badgeStyles = {
|
|
64628
64649
|
[AutomationStatus.ACTIVE]: "bg-blue-500",
|
|
64629
64650
|
[AutomationStatus.COMPLETED]: "bg-green-500",
|
|
@@ -64638,21 +64659,18 @@ function createNameColumn(nameAccessor = "name", headerText, showDescription = f
|
|
|
64638
64659
|
[BusinessSegmentTypeEnum.CUSTOM]: "bg-amber-500"
|
|
64639
64660
|
};
|
|
64640
64661
|
const dotColor = type ? typeDotStyles[type] : status ? badgeStyles[status] : "bg-blue-500";
|
|
64641
|
-
return /* @__PURE__ */
|
|
64642
|
-
/* @__PURE__ */
|
|
64643
|
-
|
|
64644
|
-
|
|
64645
|
-
{
|
|
64646
|
-
|
|
64647
|
-
|
|
64648
|
-
|
|
64649
|
-
/* @__PURE__ */
|
|
64650
|
-
|
|
64651
|
-
|
|
64652
|
-
|
|
64653
|
-
] }),
|
|
64654
|
-
status && /* @__PURE__ */ jsx("div", { className: "flex-shrink-0", children: /* @__PURE__ */ jsx(Badge, { variant: getAutomationStatusVariant(status), children: statusText }) })
|
|
64655
|
-
] });
|
|
64662
|
+
return /* @__PURE__ */ jsx("div", { className: "w-full flex gap-6 justify-between items-center", children: /* @__PURE__ */ jsxs("div", { className: "flex gap-1 items-center w-full", children: [
|
|
64663
|
+
/* @__PURE__ */ jsx(
|
|
64664
|
+
"div",
|
|
64665
|
+
{
|
|
64666
|
+
className: `w-2 h-2 rounded-full mr-3 flex-shrink-0 ${dotColor}`
|
|
64667
|
+
}
|
|
64668
|
+
),
|
|
64669
|
+
/* @__PURE__ */ jsxs("div", { className: "flex-1 flex flex-col gap-0.5", children: [
|
|
64670
|
+
/* @__PURE__ */ jsx("span", { className: "leading-tight font-medium text-sm overflow-hidden text-ellipsis", children: value }),
|
|
64671
|
+
showDescription && rowOriginal?.description && /* @__PURE__ */ jsx("div", { className: "relative h-4", children: /* @__PURE__ */ jsx("div", { className: "absolute inset-0 text-muted-foreground text-xs truncate whitespace-nowrap overflow-hidden w-full", children: rowOriginal?.description }) })
|
|
64672
|
+
] })
|
|
64673
|
+
] }) });
|
|
64656
64674
|
}
|
|
64657
64675
|
});
|
|
64658
64676
|
}
|
|
@@ -64744,7 +64762,7 @@ function createCountColumn(accessorKey, headerText, prefix) {
|
|
|
64744
64762
|
});
|
|
64745
64763
|
}
|
|
64746
64764
|
function createBroadcastActionColumn(args) {
|
|
64747
|
-
const { setUrl, onToggle, automationName, vsaasManaged } = args;
|
|
64765
|
+
const { setUrl, onToggle, automationName, vsaasManaged, pillForStatus } = args;
|
|
64748
64766
|
return createTextColumn({
|
|
64749
64767
|
accessorKey: "status",
|
|
64750
64768
|
header: `Status`,
|
|
@@ -64758,6 +64776,10 @@ function createBroadcastActionColumn(args) {
|
|
|
64758
64776
|
cellFormatter: (info) => {
|
|
64759
64777
|
const { original: rowOriginal } = info.row;
|
|
64760
64778
|
const statusValue = rowOriginal.status ?? null;
|
|
64779
|
+
if (pillForStatus && statusValue) {
|
|
64780
|
+
const statusText = statusValue ? statusValue[0].toUpperCase() + statusValue.slice(1) : "";
|
|
64781
|
+
return /* @__PURE__ */ jsx(Badge, { variant: getAutomationStatusVariant(statusValue), children: statusText });
|
|
64782
|
+
}
|
|
64761
64783
|
if (statusValue === AutomationStatus.DRAFT && setUrl && vsaasManaged === false) {
|
|
64762
64784
|
return /* @__PURE__ */ jsx(
|
|
64763
64785
|
NavigationCell,
|
|
@@ -64816,7 +64838,13 @@ function createSegmentColumns(setSelectedSegment) {
|
|
|
64816
64838
|
];
|
|
64817
64839
|
}
|
|
64818
64840
|
function createColumns(args) {
|
|
64819
|
-
const {
|
|
64841
|
+
const {
|
|
64842
|
+
automationName,
|
|
64843
|
+
setUrl,
|
|
64844
|
+
onToggle,
|
|
64845
|
+
vsaasManaged = false,
|
|
64846
|
+
pillForStatus = false
|
|
64847
|
+
} = args;
|
|
64820
64848
|
return [
|
|
64821
64849
|
// true for description
|
|
64822
64850
|
createNameColumn("name", `Name`, true),
|
|
@@ -64828,7 +64856,8 @@ function createColumns(args) {
|
|
|
64828
64856
|
setUrl,
|
|
64829
64857
|
onToggle,
|
|
64830
64858
|
automationName,
|
|
64831
|
-
vsaasManaged
|
|
64859
|
+
vsaasManaged,
|
|
64860
|
+
pillForStatus
|
|
64832
64861
|
})
|
|
64833
64862
|
];
|
|
64834
64863
|
}
|
|
@@ -64840,7 +64869,9 @@ const InfoTooltip = ({
|
|
|
64840
64869
|
asChild = true,
|
|
64841
64870
|
link: link2,
|
|
64842
64871
|
size: size2 = "medium",
|
|
64843
|
-
iconColor = "text-gray-400"
|
|
64872
|
+
iconColor = "text-gray-400",
|
|
64873
|
+
className: className2,
|
|
64874
|
+
children: children2
|
|
64844
64875
|
}) => {
|
|
64845
64876
|
const [isOpen, setIsOpen] = useState(false);
|
|
64846
64877
|
const handleClick = (e4) => {
|
|
@@ -64861,16 +64892,24 @@ const InfoTooltip = ({
|
|
|
64861
64892
|
large: "h-5 w-5"
|
|
64862
64893
|
};
|
|
64863
64894
|
return /* @__PURE__ */ jsx(TooltipProvider, { children: /* @__PURE__ */ jsxs(Tooltip, { open: isOpen, onOpenChange: setIsOpen, children: [
|
|
64864
|
-
/* @__PURE__ */ jsx(
|
|
64865
|
-
|
|
64895
|
+
/* @__PURE__ */ jsx(
|
|
64896
|
+
TooltipTrigger,
|
|
64866
64897
|
{
|
|
64867
|
-
|
|
64868
|
-
|
|
64869
|
-
|
|
64870
|
-
|
|
64898
|
+
asChild,
|
|
64899
|
+
onClick: handleClick,
|
|
64900
|
+
className: className2,
|
|
64901
|
+
children: children2 ? children2 : /* @__PURE__ */ jsx(
|
|
64902
|
+
Icon2,
|
|
64903
|
+
{
|
|
64904
|
+
className: cn(
|
|
64905
|
+
sizeClasses[size2],
|
|
64906
|
+
"cursor-pointer transition-colors",
|
|
64907
|
+
iconColor
|
|
64908
|
+
)
|
|
64909
|
+
}
|
|
64871
64910
|
)
|
|
64872
64911
|
}
|
|
64873
|
-
)
|
|
64912
|
+
),
|
|
64874
64913
|
/* @__PURE__ */ jsx(TooltipContent, { className: "bg-white text-gray-900 border border-gray-200 shadow-lg text-left", children: /* @__PURE__ */ jsxs("div", { className: "flex flex-col items-center justify-center w-full gap-2 max-w-[300px]", children: [
|
|
64875
64914
|
alertText && /* @__PURE__ */ jsxs("div", { className: "flex flex-col items-center justify-center w-full", children: [
|
|
64876
64915
|
/* @__PURE__ */ jsx(IconDefinitions.AlertTriangleIcon, { className: "text-amber-500 w-6 h-6" }),
|
|
@@ -67703,13 +67742,13 @@ const stripoScriptId = "UiEditorScript";
|
|
|
67703
67742
|
const initStripo = (options) => {
|
|
67704
67743
|
return new Promise((resolve, reject) => {
|
|
67705
67744
|
const initStripoEditor = () => {
|
|
67706
|
-
let forceRecreate =
|
|
67745
|
+
let forceRecreate = void 0;
|
|
67707
67746
|
if (options.updatedFromDefault) {
|
|
67708
|
-
forceRecreate =
|
|
67747
|
+
forceRecreate = true;
|
|
67709
67748
|
}
|
|
67710
67749
|
if (window.UIEditor) {
|
|
67711
67750
|
window.UIEditor.initEditor(options.container, {
|
|
67712
|
-
forceRecreate,
|
|
67751
|
+
...forceRecreate && { forceRecreate },
|
|
67713
67752
|
metadata: {
|
|
67714
67753
|
emailId: options.emailId
|
|
67715
67754
|
},
|
|
@@ -67744,7 +67783,7 @@ const initStripo = (options) => {
|
|
|
67744
67783
|
const script = document.createElement("script");
|
|
67745
67784
|
script.id = stripoScriptId;
|
|
67746
67785
|
script.type = "module";
|
|
67747
|
-
script.src = "https://plugins.stripo.email/resources/uieditor/
|
|
67786
|
+
script.src = "https://plugins.stripo.email/resources/uieditor/rev/2.21.0/UIEditor.js";
|
|
67748
67787
|
script.onload = () => {
|
|
67749
67788
|
if (window.UIEditor) {
|
|
67750
67789
|
initStripoEditor();
|
|
@@ -68425,6 +68464,7 @@ const getEmailChannelSendersWithChannelAccounts = (args) => {
|
|
|
68425
68464
|
{
|
|
68426
68465
|
channelSenderId: sender.id,
|
|
68427
68466
|
fullDomain: `${sender.channelSenderMetadata.userPart}@${sender.channelSenderMetadata.baseDomain}`,
|
|
68467
|
+
baseDomain: sender.channelSenderMetadata.baseDomain ?? void 0,
|
|
68428
68468
|
channelSender: sender
|
|
68429
68469
|
}
|
|
68430
68470
|
];
|
|
@@ -68466,6 +68506,30 @@ const EditEmailContent = () => {
|
|
|
68466
68506
|
}
|
|
68467
68507
|
);
|
|
68468
68508
|
};
|
|
68509
|
+
const sendSlackNotification = async (payload) => {
|
|
68510
|
+
const response = await baseRequest(
|
|
68511
|
+
SLACK_NOTIFICATION_PATH,
|
|
68512
|
+
{
|
|
68513
|
+
method: "POST",
|
|
68514
|
+
body: JSON.stringify(payload)
|
|
68515
|
+
}
|
|
68516
|
+
);
|
|
68517
|
+
return response.data;
|
|
68518
|
+
};
|
|
68519
|
+
const useSlackNotification = () => {
|
|
68520
|
+
const mutation = useMutation({
|
|
68521
|
+
mutationFn: (payload) => sendSlackNotification(payload)
|
|
68522
|
+
});
|
|
68523
|
+
return {
|
|
68524
|
+
sendNotification: mutation.mutate,
|
|
68525
|
+
sendNotificationAsync: mutation.mutateAsync,
|
|
68526
|
+
isLoading: mutation.isPending,
|
|
68527
|
+
isError: mutation.isError,
|
|
68528
|
+
error: mutation.error,
|
|
68529
|
+
isSuccess: mutation.isSuccess,
|
|
68530
|
+
reset: mutation.reset
|
|
68531
|
+
};
|
|
68532
|
+
};
|
|
68469
68533
|
var isCheckBoxInput = (element) => element.type === "checkbox";
|
|
68470
68534
|
var isDateObject = (value) => value instanceof Date;
|
|
68471
68535
|
var isNullOrUndefined = (value) => value == null;
|
|
@@ -70640,6 +70704,7 @@ const SMSSetupBusinessForm = ({
|
|
|
70640
70704
|
};
|
|
70641
70705
|
const SMSSetup = () => {
|
|
70642
70706
|
const [showForm, setShowForm] = useState(false);
|
|
70707
|
+
const { sendNotificationAsync } = useSlackNotification();
|
|
70643
70708
|
const {
|
|
70644
70709
|
data: latestSmsRegistrationApplication,
|
|
70645
70710
|
isLoading: isLoadingLatestSmsRegistrationApplication
|
|
@@ -70655,6 +70720,11 @@ const SMSSetup = () => {
|
|
|
70655
70720
|
toast2({
|
|
70656
70721
|
title: "SMS setup submission successful"
|
|
70657
70722
|
});
|
|
70723
|
+
sendNotificationAsync({
|
|
70724
|
+
message: "💬 New SMS setup submission",
|
|
70725
|
+
product: "engage",
|
|
70726
|
+
details: { ...data }
|
|
70727
|
+
});
|
|
70658
70728
|
setShowForm(false);
|
|
70659
70729
|
},
|
|
70660
70730
|
onError: () => {
|
|
@@ -71496,6 +71566,7 @@ const SMSPreview = ({ mergeFieldsResponse }) => {
|
|
|
71496
71566
|
const [editingMessage, setEditingMessage] = useState(null);
|
|
71497
71567
|
const [showSmsEditor, setShowSmsEditor] = useState(false);
|
|
71498
71568
|
const [isMergeFieldsOpen, setIsMergeFieldsOpen] = useState(false);
|
|
71569
|
+
const [initialState2, setInitialState] = useState(false);
|
|
71499
71570
|
const inputRef = useRef(null);
|
|
71500
71571
|
const fileInputRef = useRef(null);
|
|
71501
71572
|
const [imagePreview, setImagePreview] = useState(null);
|
|
@@ -71615,13 +71686,14 @@ const SMSPreview = ({ mergeFieldsResponse }) => {
|
|
|
71615
71686
|
if (communicationGroup.textMessageMediaUrls) {
|
|
71616
71687
|
setImageUrls(communicationGroup.textMessageMediaUrls);
|
|
71617
71688
|
}
|
|
71689
|
+
setInitialState(true);
|
|
71618
71690
|
}
|
|
71619
71691
|
}, [communicationGroup]);
|
|
71620
71692
|
const updateCompanyName = (newCompanyName) => {
|
|
71621
71693
|
setCompanyName(newCompanyName);
|
|
71622
71694
|
};
|
|
71623
71695
|
useEffect(() => {
|
|
71624
|
-
if (channelSenders === void 0) {
|
|
71696
|
+
if (channelSenders === void 0 || !initialState2) {
|
|
71625
71697
|
return;
|
|
71626
71698
|
}
|
|
71627
71699
|
if (!fromNumber) {
|
|
@@ -71636,6 +71708,15 @@ const SMSPreview = ({ mergeFieldsResponse }) => {
|
|
|
71636
71708
|
});
|
|
71637
71709
|
}
|
|
71638
71710
|
}
|
|
71711
|
+
} else if (fromNumber) {
|
|
71712
|
+
if (communicationGroup?.id) {
|
|
71713
|
+
updateCommunicationGroup2({
|
|
71714
|
+
groupId: communicationGroup.id,
|
|
71715
|
+
params: {
|
|
71716
|
+
smsChannelSenderId: fromNumber
|
|
71717
|
+
}
|
|
71718
|
+
});
|
|
71719
|
+
}
|
|
71639
71720
|
}
|
|
71640
71721
|
}, [
|
|
71641
71722
|
channelSenders,
|
|
@@ -71645,7 +71726,8 @@ const SMSPreview = ({ mergeFieldsResponse }) => {
|
|
|
71645
71726
|
smsApplication,
|
|
71646
71727
|
channelAccounts?.results,
|
|
71647
71728
|
communicationGroup?.emailChannelSenderId,
|
|
71648
|
-
smsChannelSenders
|
|
71729
|
+
smsChannelSenders,
|
|
71730
|
+
initialState2
|
|
71649
71731
|
]);
|
|
71650
71732
|
useEffect(() => {
|
|
71651
71733
|
if (!companyName && me2?.name && !initCompanyName) {
|
|
@@ -73769,7 +73851,7 @@ const SendPreviewPopup = ({ automation: automation2, type, setOpenSendPreviewPop
|
|
|
73769
73851
|
{
|
|
73770
73852
|
onClick: handleSendPreview,
|
|
73771
73853
|
disabled: !recipient,
|
|
73772
|
-
className: "w-full
|
|
73854
|
+
className: "w-full disabled:cursor-not-allowed",
|
|
73773
73855
|
children: "Send Test"
|
|
73774
73856
|
}
|
|
73775
73857
|
)
|
|
@@ -73973,20 +74055,35 @@ const AutomationEditorSMSPreview = ({
|
|
|
73973
74055
|
}) => {
|
|
73974
74056
|
const [openSendPreviewSmsPopup, setOpenSendPreviewSmsPopup] = useState(false);
|
|
73975
74057
|
const { channelSenders } = useChannelSender();
|
|
74058
|
+
const { channelAccounts } = useChannelAccount();
|
|
73976
74059
|
const automation2 = useAutomation();
|
|
73977
74060
|
const communicationGroup = useCommunicationGroup();
|
|
73978
74061
|
const [editContent, setEditContent] = useState(false);
|
|
73979
74062
|
const { data: smsApplication } = useGetLatestSmsRegistrationApplication();
|
|
73980
74063
|
const [setupRequiredState, setSetupRequiredState] = useState(setupRequired);
|
|
74064
|
+
const smsChannelSenders = getSmsChannelSenders({
|
|
74065
|
+
channelSenders: channelSenders?.results ?? [],
|
|
74066
|
+
channelAccounts: channelAccounts?.results ?? [],
|
|
74067
|
+
smsApplication
|
|
74068
|
+
});
|
|
74069
|
+
const currentlySelectedSender = smsChannelSenders.find(
|
|
74070
|
+
(sender) => sender.channelSender.id === communicationGroup?.smsChannelSenderId
|
|
74071
|
+
);
|
|
73981
74072
|
useEffect(() => {
|
|
73982
|
-
if (smsApplication && smsApplication.status === SmsRegistrationApplicationStatus.PENDING) {
|
|
74073
|
+
if (currentlySelectedSender && currentlySelectedSender.smsApplication && currentlySelectedSender.smsApplication.status === SmsRegistrationApplicationStatus.PENDING) {
|
|
73983
74074
|
setSetupRequiredState(false);
|
|
73984
74075
|
}
|
|
73985
|
-
}, [
|
|
74076
|
+
}, [
|
|
74077
|
+
communicationGroup?.smsChannelSenderId,
|
|
74078
|
+
smsApplication,
|
|
74079
|
+
smsChannelSenders,
|
|
74080
|
+
currentlySelectedSender
|
|
74081
|
+
]);
|
|
73986
74082
|
if (!automation2 || channelSenders === void 0) {
|
|
73987
74083
|
return null;
|
|
73988
74084
|
}
|
|
73989
74085
|
const smsBody = communicationGroup?.smsMessageBody || "";
|
|
74086
|
+
const hasSendableSmsContent = !currentlySelectedSender?.smsApplication || currentlySelectedSender.smsApplication.status === SmsRegistrationApplicationStatus.APPROVED;
|
|
73990
74087
|
const hasSmsCommunication = (smsApplication || communicationGroup?.smsChannelSenderId) && smsBody.length > 0;
|
|
73991
74088
|
const finalSMSBody = buildFinalSMSBody({
|
|
73992
74089
|
companyName: communicationGroup?.textMessageCompanyName ?? void 0,
|
|
@@ -74025,7 +74122,7 @@ const AutomationEditorSMSPreview = ({
|
|
|
74025
74122
|
AutomationEditorPreviewContainer,
|
|
74026
74123
|
{
|
|
74027
74124
|
actionButtons: /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
74028
|
-
!disablePreview &&
|
|
74125
|
+
!disablePreview && hasSendableSmsContent && /* @__PURE__ */ jsx(
|
|
74029
74126
|
PreviewButton,
|
|
74030
74127
|
{
|
|
74031
74128
|
onClick: () => setOpenSendPreviewSmsPopup(true)
|
|
@@ -77859,7 +77956,7 @@ const SetScheduleTime = ({ setScheduleTime, setTimezone, timezone, scheduleTime,
|
|
|
77859
77956
|
] })
|
|
77860
77957
|
] }) });
|
|
77861
77958
|
};
|
|
77862
|
-
const AutomationSelectTimeMain = ({ title: title2 = "Edit Schedule Time"
|
|
77959
|
+
const AutomationSelectTimeMain = ({ title: title2 = "Edit Schedule Time" }) => {
|
|
77863
77960
|
const automation2 = useAutomation();
|
|
77864
77961
|
const { updateAutomation: businessUpdateAutomation } = useUpdateBusinessAutomation(automation2?.id || "");
|
|
77865
77962
|
const { toast: toast2 } = useToast();
|
|
@@ -77871,23 +77968,22 @@ const AutomationSelectTimeMain = ({ title: title2 = "Edit Schedule Time", autoSa
|
|
|
77871
77968
|
automation2?.triggerMetadata?.triggerType === AutomationTriggerType.ONE_TIME ? automation2?.triggerMetadata?.timezone || "America/New_York" : "America/New_York"
|
|
77872
77969
|
);
|
|
77873
77970
|
const [isDirty2, setIsDirty] = useState(false);
|
|
77971
|
+
const [pendingToast, setPendingToast] = useState(null);
|
|
77972
|
+
let toastTimeout = useRef(null);
|
|
77874
77973
|
const updateTriggerTime = useCallback(() => {
|
|
77875
|
-
if (
|
|
77974
|
+
if (!automation2) return;
|
|
77975
|
+
if (deliveryOption === "sendNow" || scheduledAt === "now") {
|
|
77876
77976
|
businessUpdateAutomation({
|
|
77877
77977
|
trigger: {
|
|
77878
77978
|
triggerType: AutomationTriggerType.ONE_TIME,
|
|
77879
77979
|
scheduledAt: "now"
|
|
77880
77980
|
}
|
|
77881
77981
|
});
|
|
77882
|
-
|
|
77982
|
+
setPendingToast({
|
|
77883
77983
|
title: "Schedule time updated successfully 🚀",
|
|
77884
|
-
description: "
|
|
77984
|
+
description: `${t$1("engage:broadcast")} scheduled to begin sending in 5 minutes after you activate it`
|
|
77885
77985
|
});
|
|
77886
|
-
|
|
77887
|
-
} else {
|
|
77888
|
-
if (!scheduledAt || !timezone) {
|
|
77889
|
-
return;
|
|
77890
|
-
}
|
|
77986
|
+
} else if (scheduledAt && timezone) {
|
|
77891
77987
|
businessUpdateAutomation({
|
|
77892
77988
|
trigger: {
|
|
77893
77989
|
triggerType: AutomationTriggerType.ONE_TIME,
|
|
@@ -77895,9 +77991,9 @@ const AutomationSelectTimeMain = ({ title: title2 = "Edit Schedule Time", autoSa
|
|
|
77895
77991
|
timezone
|
|
77896
77992
|
}
|
|
77897
77993
|
});
|
|
77898
|
-
|
|
77994
|
+
setPendingToast({
|
|
77899
77995
|
title: "Schedule time updated successfully 🚀",
|
|
77900
|
-
description:
|
|
77996
|
+
description: `${t$1("engage:broadcast")} scheduled to start at ${new Date(
|
|
77901
77997
|
scheduledAt
|
|
77902
77998
|
).toLocaleString("en-US", {
|
|
77903
77999
|
weekday: "long",
|
|
@@ -77905,42 +78001,49 @@ const AutomationSelectTimeMain = ({ title: title2 = "Edit Schedule Time", autoSa
|
|
|
77905
78001
|
day: "numeric"
|
|
77906
78002
|
})}`
|
|
77907
78003
|
});
|
|
77908
|
-
setIsDirty(false);
|
|
77909
78004
|
}
|
|
77910
|
-
}, [
|
|
78005
|
+
}, [
|
|
78006
|
+
deliveryOption,
|
|
78007
|
+
scheduledAt,
|
|
78008
|
+
timezone,
|
|
78009
|
+
businessUpdateAutomation,
|
|
78010
|
+
automation2
|
|
78011
|
+
]);
|
|
77911
78012
|
useEffect(() => {
|
|
77912
|
-
if (
|
|
77913
|
-
|
|
78013
|
+
if (pendingToast) {
|
|
78014
|
+
if (toastTimeout.current) clearTimeout(toastTimeout.current);
|
|
78015
|
+
toastTimeout.current = setTimeout(() => {
|
|
78016
|
+
toast2(pendingToast);
|
|
78017
|
+
setPendingToast(null);
|
|
78018
|
+
}, 800);
|
|
77914
78019
|
}
|
|
77915
|
-
|
|
78020
|
+
return () => {
|
|
78021
|
+
if (toastTimeout.current) clearTimeout(toastTimeout.current);
|
|
78022
|
+
};
|
|
78023
|
+
}, [pendingToast, toast2]);
|
|
77916
78024
|
useEffect(() => {
|
|
77917
|
-
if (
|
|
78025
|
+
if (!automation2) return;
|
|
78026
|
+
if (isDirty2 && deliveryOption && (deliveryOption === "sendNow" || scheduledAt)) {
|
|
77918
78027
|
updateTriggerTime();
|
|
77919
78028
|
setIsDirty(false);
|
|
77920
78029
|
}
|
|
77921
|
-
}, [
|
|
78030
|
+
}, [
|
|
78031
|
+
deliveryOption,
|
|
78032
|
+
scheduledAt,
|
|
78033
|
+
timezone,
|
|
78034
|
+
updateTriggerTime,
|
|
78035
|
+
automation2,
|
|
78036
|
+
isDirty2
|
|
78037
|
+
]);
|
|
77922
78038
|
if (!automation2) {
|
|
77923
78039
|
return null;
|
|
77924
78040
|
}
|
|
77925
78041
|
const canEditScheduleTime = automation2.status === AutomationStatus.DRAFT;
|
|
77926
|
-
const saveDisabled = !(isDirty2 && canEditScheduleTime);
|
|
77927
78042
|
return /* @__PURE__ */ jsx(
|
|
77928
78043
|
MainPageWrapper,
|
|
77929
78044
|
{
|
|
77930
78045
|
title: title2,
|
|
77931
|
-
headerActions:
|
|
77932
|
-
"div",
|
|
77933
|
-
{
|
|
77934
|
-
className: cn(
|
|
77935
|
-
saveDisabled ? "cursor-not-allowed opacity-50" : "cursor-pointer",
|
|
77936
|
-
"gap-2 flex items-center"
|
|
77937
|
-
),
|
|
77938
|
-
children: [
|
|
77939
|
-
/* @__PURE__ */ jsx(Button$1, { onClick: updateTriggerTime, disabled: saveDisabled, children: "Save" }),
|
|
77940
|
-
!canEditScheduleTime && /* @__PURE__ */ jsx(InfoTooltip, { title: "You can only edit the schedule time if the automation is in draft mode" })
|
|
77941
|
-
]
|
|
77942
|
-
}
|
|
77943
|
-
),
|
|
78046
|
+
headerActions: !canEditScheduleTime && /* @__PURE__ */ jsx(InfoTooltip, { title: "You can only edit the schedule time if the automation is in draft mode" }),
|
|
77944
78047
|
children: /* @__PURE__ */ jsx("div", { className: "@container flex-1 mx-4", children: /* @__PURE__ */ jsxs("div", { className: "flex @[1000px]:flex-row flex-col gap-8 items-center", children: [
|
|
77945
78048
|
/* @__PURE__ */ jsxs("div", { className: "flex-1 w-full", children: [
|
|
77946
78049
|
/* @__PURE__ */ jsxs("div", { className: "grid grid-cols-1 @[480px]:grid-cols-2 gap-4", children: [
|
|
@@ -77952,9 +78055,7 @@ const AutomationSelectTimeMain = ({ title: title2 = "Edit Schedule Time", autoSa
|
|
|
77952
78055
|
subtitle: "Campaign will begin sending in 5 minutes",
|
|
77953
78056
|
icon: /* @__PURE__ */ jsx(IconDefinitions.SendButton, { className: "text-primary" }),
|
|
77954
78057
|
onClick: () => {
|
|
77955
|
-
if (!canEditScheduleTime)
|
|
77956
|
-
return;
|
|
77957
|
-
}
|
|
78058
|
+
if (!canEditScheduleTime) return;
|
|
77958
78059
|
setDeliveryOption("sendNow");
|
|
77959
78060
|
setScheduledAt("now");
|
|
77960
78061
|
setTimezone("America/New_York");
|
|
@@ -77970,9 +78071,7 @@ const AutomationSelectTimeMain = ({ title: title2 = "Edit Schedule Time", autoSa
|
|
|
77970
78071
|
subtitle: "Choose date and time",
|
|
77971
78072
|
icon: /* @__PURE__ */ jsx(IconDefinitions.ScheduleButton, { className: "text-primary" }),
|
|
77972
78073
|
onClick: () => {
|
|
77973
|
-
if (!canEditScheduleTime)
|
|
77974
|
-
return;
|
|
77975
|
-
}
|
|
78074
|
+
if (!canEditScheduleTime) return;
|
|
77976
78075
|
setDeliveryOption("schedule");
|
|
77977
78076
|
}
|
|
77978
78077
|
}
|
|
@@ -77981,8 +78080,14 @@ const AutomationSelectTimeMain = ({ title: title2 = "Edit Schedule Time", autoSa
|
|
|
77981
78080
|
/* @__PURE__ */ jsx(AnimatePresence, { children: deliveryOption === "schedule" && /* @__PURE__ */ jsx(BlurDiv, { className: "overflow-hidden mt-8", children: /* @__PURE__ */ jsx("div", { className: "bg-gray-50 rounded-xl p-5 border border-gray-100 flex items-center justify-center", children: /* @__PURE__ */ jsx(
|
|
77982
78081
|
SetScheduleTime,
|
|
77983
78082
|
{
|
|
77984
|
-
setScheduleTime:
|
|
77985
|
-
|
|
78083
|
+
setScheduleTime: (date2) => {
|
|
78084
|
+
setScheduledAt(date2);
|
|
78085
|
+
setIsDirty(true);
|
|
78086
|
+
},
|
|
78087
|
+
setTimezone: (tz) => {
|
|
78088
|
+
setTimezone(tz);
|
|
78089
|
+
setIsDirty(true);
|
|
78090
|
+
},
|
|
77986
78091
|
timezone,
|
|
77987
78092
|
scheduleTime: scheduledAt,
|
|
77988
78093
|
setIsDirty
|
|
@@ -78060,7 +78165,7 @@ const AutomationSelectTimeMain = ({ title: title2 = "Edit Schedule Time", autoSa
|
|
|
78060
78165
|
);
|
|
78061
78166
|
};
|
|
78062
78167
|
const Schedule = () => {
|
|
78063
|
-
return /* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsx(AutomationSelectTimeMain, { title: "Set Schedule Time"
|
|
78168
|
+
return /* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsx(AutomationSelectTimeMain, { title: "Set Schedule Time" }) });
|
|
78064
78169
|
};
|
|
78065
78170
|
var DateUnit = /* @__PURE__ */ ((DateUnit2) => {
|
|
78066
78171
|
DateUnit2["DAYS"] = "days";
|
|
@@ -78113,8 +78218,8 @@ var DateUnit = /* @__PURE__ */ ((DateUnit2) => {
|
|
|
78113
78218
|
const operatorToHumanReadable = {
|
|
78114
78219
|
[ConditionOperatorEnumType.EQUALS]: "Equals",
|
|
78115
78220
|
[ConditionOperatorEnumType.NOT_EQUALS]: "Not Equals",
|
|
78116
|
-
[ConditionOperatorEnumType.GREATER_THAN]: "
|
|
78117
|
-
[ConditionOperatorEnumType.LESS_THAN]: "
|
|
78221
|
+
[ConditionOperatorEnumType.GREATER_THAN]: "Date on or after",
|
|
78222
|
+
[ConditionOperatorEnumType.LESS_THAN]: "Date on or before",
|
|
78118
78223
|
[ConditionOperatorEnumType.EXISTS]: "Exists",
|
|
78119
78224
|
[ConditionOperatorEnumType.EQUALS_MONTH_DAY]: "Month and Day Matches",
|
|
78120
78225
|
[ConditionOperatorEnumType.EQUALS_MONTH_DAY_YEAR]: "Month, Day, and Year Matches",
|
|
@@ -79450,19 +79555,24 @@ function MultiSelectDialog({
|
|
|
79450
79555
|
title: title2 = "Select Items",
|
|
79451
79556
|
searchPlaceholder = "Search items...",
|
|
79452
79557
|
emptyMessage = "No items found",
|
|
79453
|
-
handleSearchInput,
|
|
79454
79558
|
extraCommandItems = [],
|
|
79455
79559
|
canOpen = true
|
|
79456
79560
|
}) {
|
|
79457
79561
|
const [open, setOpen] = React.useState(false);
|
|
79458
79562
|
const [searchQuery, setSearchQuery] = React.useState("");
|
|
79459
79563
|
const [tempSelected, setTempSelected] = React.useState(selectedValues);
|
|
79564
|
+
const cleanedOptions = React.useMemo(
|
|
79565
|
+
() => options.filter(
|
|
79566
|
+
(option) => option && typeof option.value === "string" && typeof option.label === "string" && option.value.trim() !== "" && option.label.trim() !== ""
|
|
79567
|
+
),
|
|
79568
|
+
[options]
|
|
79569
|
+
);
|
|
79460
79570
|
const filteredOptions = React.useMemo(() => {
|
|
79461
|
-
if (!searchQuery) return
|
|
79462
|
-
return
|
|
79571
|
+
if (!searchQuery) return cleanedOptions;
|
|
79572
|
+
return cleanedOptions.filter(
|
|
79463
79573
|
(option) => option.label.toLowerCase().includes(searchQuery.toLowerCase())
|
|
79464
79574
|
);
|
|
79465
|
-
}, [
|
|
79575
|
+
}, [cleanedOptions, searchQuery]);
|
|
79466
79576
|
const getSelectedOptionsDisplay = React.useCallback(() => {
|
|
79467
79577
|
return selectedValues.map((val) => {
|
|
79468
79578
|
const option = options.find((opt) => opt.value === val);
|
|
@@ -79506,13 +79616,6 @@ function MultiSelectDialog({
|
|
|
79506
79616
|
setSearchQuery("");
|
|
79507
79617
|
setOpen(false);
|
|
79508
79618
|
};
|
|
79509
|
-
const handleSearchKeyDown = (e4) => {
|
|
79510
|
-
if (e4.key === "Enter" && searchQuery.trim() && handleSearchInput) {
|
|
79511
|
-
e4.preventDefault();
|
|
79512
|
-
handleSearchInput(searchQuery.trim());
|
|
79513
|
-
setSearchQuery("");
|
|
79514
|
-
}
|
|
79515
|
-
};
|
|
79516
79619
|
React.useEffect(() => {
|
|
79517
79620
|
if (open) {
|
|
79518
79621
|
setTempSelected(selectedValues);
|
|
@@ -79525,6 +79628,14 @@ function MultiSelectDialog({
|
|
|
79525
79628
|
).length;
|
|
79526
79629
|
const selectedDisplay = getSelectedOptionsDisplay();
|
|
79527
79630
|
const canSelectMore = !maxCount || tempSelected.length < maxCount;
|
|
79631
|
+
const selectedOptions = React.useMemo(
|
|
79632
|
+
() => filteredOptions.filter((option) => tempSelected.includes(option.value)),
|
|
79633
|
+
[filteredOptions, tempSelected]
|
|
79634
|
+
);
|
|
79635
|
+
const unselectedOptions = React.useMemo(
|
|
79636
|
+
() => filteredOptions.filter((option) => !tempSelected.includes(option.value)),
|
|
79637
|
+
[filteredOptions, tempSelected]
|
|
79638
|
+
);
|
|
79528
79639
|
return /* @__PURE__ */ jsxs(Dialog, { open: open && canOpen, onOpenChange: setOpen, children: [
|
|
79529
79640
|
/* @__PURE__ */ jsx(DialogTrigger, { asChild: true, children: /* @__PURE__ */ jsxs(
|
|
79530
79641
|
Button$1,
|
|
@@ -79580,23 +79691,9 @@ function MultiSelectDialog({
|
|
|
79580
79691
|
placeholder: searchPlaceholder,
|
|
79581
79692
|
value: searchQuery,
|
|
79582
79693
|
onChange: (e4) => setSearchQuery(e4.target.value),
|
|
79583
|
-
onKeyDown: handleSearchKeyDown,
|
|
79584
79694
|
className: "pl-10 h-11"
|
|
79585
79695
|
}
|
|
79586
|
-
)
|
|
79587
|
-
handleSearchInput && searchQuery.trim() && /* @__PURE__ */ jsx("div", { className: "absolute right-3 top-1/2 transform -translate-y-1/2", children: /* @__PURE__ */ jsx(
|
|
79588
|
-
Button$1,
|
|
79589
|
-
{
|
|
79590
|
-
size: "sm",
|
|
79591
|
-
variant: "ghost",
|
|
79592
|
-
className: "h-6 w-6 p-0",
|
|
79593
|
-
onClick: () => {
|
|
79594
|
-
handleSearchInput(searchQuery.trim());
|
|
79595
|
-
setSearchQuery("");
|
|
79596
|
-
},
|
|
79597
|
-
children: /* @__PURE__ */ jsx(IconDefinitions.PlusIcon, { className: "h-3 w-3" })
|
|
79598
|
-
}
|
|
79599
|
-
) })
|
|
79696
|
+
)
|
|
79600
79697
|
] }) }),
|
|
79601
79698
|
/* @__PURE__ */ jsx("div", { className: "px-6 pb-4", children: /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between text-sm", children: [
|
|
79602
79699
|
/* @__PURE__ */ jsxs("span", { className: "text-muted-foreground", children: [
|
|
@@ -79639,50 +79736,73 @@ function MultiSelectDialog({
|
|
|
79639
79736
|
] }),
|
|
79640
79737
|
filteredOptions.length === 0 ? /* @__PURE__ */ jsxs("div", { className: "text-center py-8 text-muted-foreground", children: [
|
|
79641
79738
|
/* @__PURE__ */ jsx(IconDefinitions.SearchIcon, { className: "h-8 w-8 mx-auto mb-2 opacity-50" }),
|
|
79642
|
-
/* @__PURE__ */ jsx("p", { children: emptyMessage })
|
|
79643
|
-
|
|
79644
|
-
|
|
79645
|
-
{
|
|
79646
|
-
|
|
79647
|
-
|
|
79648
|
-
|
|
79649
|
-
|
|
79650
|
-
|
|
79651
|
-
|
|
79652
|
-
|
|
79653
|
-
|
|
79654
|
-
|
|
79655
|
-
|
|
79656
|
-
|
|
79657
|
-
|
|
79658
|
-
|
|
79659
|
-
|
|
79660
|
-
|
|
79661
|
-
|
|
79662
|
-
|
|
79663
|
-
|
|
79664
|
-
|
|
79665
|
-
|
|
79666
|
-
|
|
79667
|
-
|
|
79668
|
-
|
|
79669
|
-
|
|
79670
|
-
|
|
79671
|
-
|
|
79672
|
-
|
|
79673
|
-
|
|
79674
|
-
|
|
79675
|
-
|
|
79676
|
-
|
|
79677
|
-
|
|
79678
|
-
|
|
79679
|
-
|
|
79680
|
-
|
|
79681
|
-
|
|
79682
|
-
},
|
|
79683
|
-
option
|
|
79684
|
-
|
|
79685
|
-
|
|
79739
|
+
/* @__PURE__ */ jsx("p", { children: emptyMessage })
|
|
79740
|
+
] }) : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
79741
|
+
selectedOptions.length > 0 && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
79742
|
+
/* @__PURE__ */ jsxs("div", { className: "px-3 pt-2 pb-1 text-xs font-semibold text-muted-foreground tracking-wide uppercase", children: [
|
|
79743
|
+
"Selected (",
|
|
79744
|
+
selectedOptions.length,
|
|
79745
|
+
")"
|
|
79746
|
+
] }),
|
|
79747
|
+
selectedOptions.map((option) => {
|
|
79748
|
+
const isSelected = true;
|
|
79749
|
+
const isDisabled = false;
|
|
79750
|
+
return /* @__PURE__ */ jsxs(
|
|
79751
|
+
CommandItem,
|
|
79752
|
+
{
|
|
79753
|
+
onSelect: () => handleItemToggle(option.value),
|
|
79754
|
+
className: `flex items-center space-x-3 p-3 rounded-lg transition-colors hover:bg-muted/50 cursor-pointer`,
|
|
79755
|
+
children: [
|
|
79756
|
+
/* @__PURE__ */ jsx(
|
|
79757
|
+
Checkbox,
|
|
79758
|
+
{
|
|
79759
|
+
checked: isSelected,
|
|
79760
|
+
disabled: isDisabled,
|
|
79761
|
+
onChange: () => handleItemToggle(option.value),
|
|
79762
|
+
className: "flex-shrink-0"
|
|
79763
|
+
}
|
|
79764
|
+
),
|
|
79765
|
+
/* @__PURE__ */ jsx("div", { className: "flex-1 min-w-0", children: /* @__PURE__ */ jsx("div", { className: "font-medium text-sm truncate", children: option.label }) }),
|
|
79766
|
+
/* @__PURE__ */ jsx(IconDefinitions.CheckIcon, { className: "h-4 w-4 text-primary flex-shrink-0" })
|
|
79767
|
+
]
|
|
79768
|
+
},
|
|
79769
|
+
option.value
|
|
79770
|
+
);
|
|
79771
|
+
}),
|
|
79772
|
+
/* @__PURE__ */ jsx(Separator, { className: "my-2" })
|
|
79773
|
+
] }),
|
|
79774
|
+
unselectedOptions.length > 0 && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
79775
|
+
/* @__PURE__ */ jsxs("div", { className: "px-3 pt-2 pb-1 text-xs font-semibold text-muted-foreground tracking-wide uppercase", children: [
|
|
79776
|
+
"Available (",
|
|
79777
|
+
unselectedOptions.length,
|
|
79778
|
+
")"
|
|
79779
|
+
] }),
|
|
79780
|
+
unselectedOptions.map((option) => {
|
|
79781
|
+
const isSelected = false;
|
|
79782
|
+
const isDisabled = !canSelectMore;
|
|
79783
|
+
return /* @__PURE__ */ jsxs(
|
|
79784
|
+
CommandItem,
|
|
79785
|
+
{
|
|
79786
|
+
onSelect: () => !isDisabled && handleItemToggle(option.value),
|
|
79787
|
+
className: `flex items-center space-x-3 p-3 rounded-lg transition-colors ${isDisabled ? "opacity-50 cursor-not-allowed" : "hover:bg-muted/50 cursor-pointer"}`,
|
|
79788
|
+
children: [
|
|
79789
|
+
/* @__PURE__ */ jsx(
|
|
79790
|
+
Checkbox,
|
|
79791
|
+
{
|
|
79792
|
+
checked: isSelected,
|
|
79793
|
+
disabled: isDisabled,
|
|
79794
|
+
onChange: () => !isDisabled && handleItemToggle(option.value),
|
|
79795
|
+
className: "flex-shrink-0"
|
|
79796
|
+
}
|
|
79797
|
+
),
|
|
79798
|
+
/* @__PURE__ */ jsx("div", { className: "flex-1 min-w-0", children: /* @__PURE__ */ jsx("div", { className: "font-medium text-sm truncate", children: option.label }) })
|
|
79799
|
+
]
|
|
79800
|
+
},
|
|
79801
|
+
option.value
|
|
79802
|
+
);
|
|
79803
|
+
})
|
|
79804
|
+
] })
|
|
79805
|
+
] })
|
|
79686
79806
|
] }) }) }),
|
|
79687
79807
|
/* @__PURE__ */ jsx(Separator, {}),
|
|
79688
79808
|
/* @__PURE__ */ jsx("div", { className: "p-6 pt-4", children: /* @__PURE__ */ jsxs("div", { className: "flex gap-3", children: [
|
|
@@ -79881,27 +80001,6 @@ const DateSegmentSelector = ({
|
|
|
79881
80001
|
) })
|
|
79882
80002
|
] });
|
|
79883
80003
|
};
|
|
79884
|
-
const validateNewValue = (args) => {
|
|
79885
|
-
const { value, type } = args;
|
|
79886
|
-
switch (type) {
|
|
79887
|
-
case JSONSchemaType.ReachResource:
|
|
79888
|
-
case JSONSchemaType.Array:
|
|
79889
|
-
case JSONSchemaType.String:
|
|
79890
|
-
return value.length > 0;
|
|
79891
|
-
case JSONSchemaType.Number:
|
|
79892
|
-
return !isNaN(Number(value));
|
|
79893
|
-
case JSONSchemaType.Integer:
|
|
79894
|
-
return !isNaN(Number(value)) && Number(value) % 1 === 0;
|
|
79895
|
-
case JSONSchemaType.Boolean:
|
|
79896
|
-
return value === "true" || value === "false";
|
|
79897
|
-
case JSONSchemaType.Date:
|
|
79898
|
-
return !isNaN(new Date(value).getTime());
|
|
79899
|
-
case JSONSchemaType.DateTime:
|
|
79900
|
-
return !isNaN(new Date(value).getTime());
|
|
79901
|
-
default:
|
|
79902
|
-
throw UnreachableCaseStatement(type, JSONSchemaType);
|
|
79903
|
-
}
|
|
79904
|
-
};
|
|
79905
80004
|
const validateRelativeDate = (value) => {
|
|
79906
80005
|
if (value.value === void 0) {
|
|
79907
80006
|
return true;
|
|
@@ -79941,8 +80040,7 @@ const ValueInput = ({
|
|
|
79941
80040
|
value,
|
|
79942
80041
|
onChange,
|
|
79943
80042
|
options,
|
|
79944
|
-
toast: toast2
|
|
79945
|
-
metadata
|
|
80043
|
+
toast: toast2
|
|
79946
80044
|
}) => {
|
|
79947
80045
|
const isInitiallyRelative = value.length > 0 && typeof value[0] === "object" && "type" in value[0] && value[0].type === "relative";
|
|
79948
80046
|
const isInitiallyBetween = value.length > 0 && typeof value[0] === "object" && "startDate" in value[0] && "endDate" in value[0];
|
|
@@ -79995,25 +80093,6 @@ const ValueInput = ({
|
|
|
79995
80093
|
}),
|
|
79996
80094
|
setSelectedValues: (selectedIds) => {
|
|
79997
80095
|
onChange(selectedIds);
|
|
79998
|
-
},
|
|
79999
|
-
searchPlaceholder: "Enter new value",
|
|
80000
|
-
emptyMessage: "Press enter to add new value",
|
|
80001
|
-
handleSearchInput: (newValue) => {
|
|
80002
|
-
if (newValue.length > 0) {
|
|
80003
|
-
const validValue = validateNewValue({
|
|
80004
|
-
value: newValue,
|
|
80005
|
-
type: metadata.type
|
|
80006
|
-
});
|
|
80007
|
-
if (validValue) {
|
|
80008
|
-
onChange([.../* @__PURE__ */ new Set([...value, newValue])]);
|
|
80009
|
-
} else {
|
|
80010
|
-
toast2({
|
|
80011
|
-
title: "Invalid value",
|
|
80012
|
-
description: `Please enter a valid value for this field. The value must be a ${metadata.type} type`,
|
|
80013
|
-
variant: "destructive"
|
|
80014
|
-
});
|
|
80015
|
-
}
|
|
80016
|
-
}
|
|
80017
80096
|
}
|
|
80018
80097
|
}
|
|
80019
80098
|
);
|
|
@@ -80465,8 +80544,7 @@ const ConditionRow = ({
|
|
|
80465
80544
|
const metadata = getMetadataForField(condition.field) || {
|
|
80466
80545
|
operators: [],
|
|
80467
80546
|
type: JSONSchemaType.String,
|
|
80468
|
-
options: void 0
|
|
80469
|
-
itemType: void 0
|
|
80547
|
+
options: void 0
|
|
80470
80548
|
};
|
|
80471
80549
|
const operators = metadata.operators;
|
|
80472
80550
|
const fieldType = metadata.type;
|
|
@@ -80591,12 +80669,7 @@ const ConditionRow = ({
|
|
|
80591
80669
|
})),
|
|
80592
80670
|
value: condition.value,
|
|
80593
80671
|
onChange: (newValue) => onUpdate({ ...condition, value: newValue }),
|
|
80594
|
-
toast: toast2
|
|
80595
|
-
metadata: {
|
|
80596
|
-
field: condition.field,
|
|
80597
|
-
type: fieldType,
|
|
80598
|
-
itemType: metadata.itemType
|
|
80599
|
-
}
|
|
80672
|
+
toast: toast2
|
|
80600
80673
|
}
|
|
80601
80674
|
) })
|
|
80602
80675
|
] }),
|
|
@@ -82349,6 +82422,9 @@ const OneTimeWizardMain = ({ onFinish, getExtraMergeFields, onBeforeSchedule })
|
|
|
82349
82422
|
} else {
|
|
82350
82423
|
if (currentStep === AutomationSteps.SelectSenders && selectedChannels.length === 1 && selectedChannels[0] === "sms") {
|
|
82351
82424
|
setCurrentStep(currentStep + 2);
|
|
82425
|
+
} else if (currentStep === AutomationSteps.EditEmailContent && // And no sms channel
|
|
82426
|
+
selectedChannels.length === 1 && selectedChannels[0] === "email") {
|
|
82427
|
+
setCurrentStep(currentStep + 2);
|
|
82352
82428
|
} else {
|
|
82353
82429
|
setCurrentStep(currentStep + 1);
|
|
82354
82430
|
}
|
|
@@ -82368,7 +82444,10 @@ const OneTimeWizardMain = ({ onFinish, getExtraMergeFields, onBeforeSchedule })
|
|
|
82368
82444
|
};
|
|
82369
82445
|
const renderHeader = () => /* @__PURE__ */ jsxs("header", { className: "w-full flex items-center gap-4 h-16 px-6", children: [
|
|
82370
82446
|
/* @__PURE__ */ jsx("h1", { className: "text-xl font-bold leading-none", children: automation2.name }),
|
|
82371
|
-
/* @__PURE__ */ jsx("div", { className: "flex items-center gap-4", children: /* @__PURE__ */ jsx(Badge, { variant: getAutomationStatusVariant(automation2.status), children: STATUS_DISPLAY
|
|
82447
|
+
/* @__PURE__ */ jsx("div", { className: "flex items-center gap-4", children: /* @__PURE__ */ jsx(Badge, { variant: getAutomationStatusVariant(automation2.status), children: STATUS_DISPLAY({
|
|
82448
|
+
status: automation2.status,
|
|
82449
|
+
automationType: automation2.triggerType
|
|
82450
|
+
}) }) })
|
|
82372
82451
|
] });
|
|
82373
82452
|
const renderStepNav = () => /* @__PURE__ */ jsx("nav", { className: "space-y-0 w-50 self-start pr-6 pl-8 pt-4 ", children: STEPS.map((step) => /* @__PURE__ */ jsx(
|
|
82374
82453
|
"div",
|
|
@@ -83840,7 +83919,6 @@ const BrandSettings = ({ initialBrandSettings, onSave, onBack, showAutoParseButt
|
|
|
83840
83919
|
const handleUploadClick = () => {
|
|
83841
83920
|
fileInputRef.current?.click();
|
|
83842
83921
|
};
|
|
83843
|
-
console.log("brandSettings", brandSettings);
|
|
83844
83922
|
const handleCopyLogoUrl = async () => {
|
|
83845
83923
|
if (brandSettings.logoUrl) {
|
|
83846
83924
|
try {
|
|
@@ -84622,7 +84700,7 @@ const EmailChannelSettings = () => {
|
|
|
84622
84700
|
toUpdate: {
|
|
84623
84701
|
channelSenderMetadata: {
|
|
84624
84702
|
...selectedSender.channelSender.channelSenderMetadata,
|
|
84625
|
-
emailReplyTo: data.replyTo ? data.replyTo :
|
|
84703
|
+
emailReplyTo: data.replyTo ? data.replyTo : `noreply@${selectedSender.baseDomain ?? ""}`,
|
|
84626
84704
|
emailFromName: data.fromName ? data.fromName : null
|
|
84627
84705
|
}
|
|
84628
84706
|
},
|
|
@@ -84698,9 +84776,9 @@ const EmailChannelSettings = () => {
|
|
|
84698
84776
|
/* @__PURE__ */ jsxs("span", { className: "text-xs text-muted-foreground font-normal mb-1", children: [
|
|
84699
84777
|
"Optional – will use",
|
|
84700
84778
|
" ",
|
|
84701
|
-
/* @__PURE__ */ jsx("span", { className: "font-mono", children: form.watch("channelSenderId") ? emailChannelSenders.find(
|
|
84779
|
+
/* @__PURE__ */ jsx("span", { className: "font-mono", children: form.watch("channelSenderId") ? `noreply@${emailChannelSenders.find(
|
|
84702
84780
|
(s4) => s4.channelSenderId === form.watch("channelSenderId")
|
|
84703
|
-
)?.
|
|
84781
|
+
)?.baseDomain}` : "sender domain" }),
|
|
84704
84782
|
" ",
|
|
84705
84783
|
"if empty"
|
|
84706
84784
|
] }),
|
|
@@ -84724,7 +84802,7 @@ const EmailChannelSettings = () => {
|
|
|
84724
84802
|
{
|
|
84725
84803
|
control: form.control,
|
|
84726
84804
|
name: "fromName",
|
|
84727
|
-
placeholder: "From name to use when the email is sent"
|
|
84805
|
+
placeholder: "From name to use when the email is sent (optional)"
|
|
84728
84806
|
}
|
|
84729
84807
|
)
|
|
84730
84808
|
] }),
|
|
@@ -84743,7 +84821,118 @@ const EmailChannelSettings = () => {
|
|
|
84743
84821
|
] });
|
|
84744
84822
|
};
|
|
84745
84823
|
const SMSChannelSettings = () => {
|
|
84746
|
-
|
|
84824
|
+
const [hasValidSmsSender, setHasValidSmsSender] = useState(null);
|
|
84825
|
+
const { channelSenders } = useChannelSender();
|
|
84826
|
+
const { channelAccounts } = useChannelAccount();
|
|
84827
|
+
const { data: smsApplication } = useGetLatestSmsRegistrationApplication();
|
|
84828
|
+
const smsChannelSenders = getSmsChannelSenders({
|
|
84829
|
+
channelSenders: channelSenders?.results ?? [],
|
|
84830
|
+
channelAccounts: channelAccounts?.results ?? [],
|
|
84831
|
+
smsApplication
|
|
84832
|
+
});
|
|
84833
|
+
useEffect(() => {
|
|
84834
|
+
if (smsChannelSenders.length > 0 && smsChannelSenders.some(
|
|
84835
|
+
(sender) => sender.smsApplication?.status === SmsRegistrationApplicationStatus.APPROVED || !sender.smsApplication
|
|
84836
|
+
)) {
|
|
84837
|
+
setHasValidSmsSender(true);
|
|
84838
|
+
} else {
|
|
84839
|
+
setHasValidSmsSender(false);
|
|
84840
|
+
}
|
|
84841
|
+
}, [smsChannelSenders, smsApplication]);
|
|
84842
|
+
const containerVariants = {
|
|
84843
|
+
hidden: { opacity: 0, y: 20 },
|
|
84844
|
+
visible: {
|
|
84845
|
+
opacity: 1,
|
|
84846
|
+
y: 0,
|
|
84847
|
+
transition: {
|
|
84848
|
+
duration: 0.4,
|
|
84849
|
+
ease: [0.4, 0, 0.2, 1],
|
|
84850
|
+
staggerChildren: 0.1
|
|
84851
|
+
}
|
|
84852
|
+
},
|
|
84853
|
+
exit: {
|
|
84854
|
+
opacity: 0,
|
|
84855
|
+
y: -20,
|
|
84856
|
+
transition: {
|
|
84857
|
+
duration: 0.3,
|
|
84858
|
+
ease: [0.4, 0, 1, 1]
|
|
84859
|
+
}
|
|
84860
|
+
}
|
|
84861
|
+
};
|
|
84862
|
+
const itemVariants = {
|
|
84863
|
+
hidden: { opacity: 0, y: 20 },
|
|
84864
|
+
visible: {
|
|
84865
|
+
opacity: 1,
|
|
84866
|
+
y: 0,
|
|
84867
|
+
transition: {
|
|
84868
|
+
duration: 0.4,
|
|
84869
|
+
ease: [0.4, 0, 0.2, 1]
|
|
84870
|
+
}
|
|
84871
|
+
}
|
|
84872
|
+
};
|
|
84873
|
+
if (hasValidSmsSender === null) {
|
|
84874
|
+
return /* @__PURE__ */ jsx("div", { className: "w-full max-w-4xl mx-auto mt-8", children: /* @__PURE__ */ jsx(BasicLoader, {}) });
|
|
84875
|
+
}
|
|
84876
|
+
const applicationValid = smsChannelSenders.some(
|
|
84877
|
+
(sender) => sender.smsApplication?.status === SmsRegistrationApplicationStatus.APPROVED
|
|
84878
|
+
);
|
|
84879
|
+
return /* @__PURE__ */ jsx("div", { className: "w-full max-w-4xl mx-auto mt-8", children: hasValidSmsSender ? /* @__PURE__ */ jsxs(
|
|
84880
|
+
motion.div,
|
|
84881
|
+
{
|
|
84882
|
+
initial: "hidden",
|
|
84883
|
+
animate: "visible",
|
|
84884
|
+
exit: "exit",
|
|
84885
|
+
variants: containerVariants,
|
|
84886
|
+
className: cn$1(
|
|
84887
|
+
"flex flex-col items-center text-center w-full max-w-[72ch] rounded-xl p-6 gap-3 border border-border mx-auto mb-16",
|
|
84888
|
+
"bg-background"
|
|
84889
|
+
),
|
|
84890
|
+
children: [
|
|
84891
|
+
/* @__PURE__ */ jsx(
|
|
84892
|
+
motion.div,
|
|
84893
|
+
{
|
|
84894
|
+
variants: itemVariants,
|
|
84895
|
+
className: "w-16 h-16 rounded-xl flex items-center justify-center bg-green-50",
|
|
84896
|
+
children: /* @__PURE__ */ jsx(IconDefinitions.SmsIcon, { className: "text-green-600" })
|
|
84897
|
+
}
|
|
84898
|
+
),
|
|
84899
|
+
/* @__PURE__ */ jsx(
|
|
84900
|
+
motion.h2,
|
|
84901
|
+
{
|
|
84902
|
+
variants: itemVariants,
|
|
84903
|
+
className: "text-lg font-medium text-foreground",
|
|
84904
|
+
children: "SMS Sending Number Active"
|
|
84905
|
+
}
|
|
84906
|
+
),
|
|
84907
|
+
/* @__PURE__ */ jsx(motion.div, { variants: itemVariants, className: "max-w-xl mx-auto", children: applicationValid ? /* @__PURE__ */ jsx("p", { className: "text-sm font-normal text-muted-foreground mb-2", children: "Your SMS sending number has been verified and is ready to use. You can now create and send SMS campaigns!" }) : /* @__PURE__ */ jsx("p", { className: "text-sm font-normal text-muted-foreground mb-2", children: "You already have a valid SMS sending number and it is ready to use. You can create and send SMS campaigns!" }) }),
|
|
84908
|
+
/* @__PURE__ */ jsxs(
|
|
84909
|
+
motion.div,
|
|
84910
|
+
{
|
|
84911
|
+
variants: itemVariants,
|
|
84912
|
+
className: "flex items-center gap-2 px-4 py-2 bg-green-50 border border-green-200 rounded-full mt-2",
|
|
84913
|
+
children: [
|
|
84914
|
+
/* @__PURE__ */ jsx(
|
|
84915
|
+
motion.div,
|
|
84916
|
+
{
|
|
84917
|
+
animate: {
|
|
84918
|
+
scale: [1, 1.2, 1],
|
|
84919
|
+
opacity: [1, 0.8, 1]
|
|
84920
|
+
},
|
|
84921
|
+
transition: {
|
|
84922
|
+
duration: 2,
|
|
84923
|
+
repeat: Number.POSITIVE_INFINITY,
|
|
84924
|
+
ease: "easeInOut"
|
|
84925
|
+
},
|
|
84926
|
+
className: "w-2 h-2 bg-green-500 rounded-full"
|
|
84927
|
+
}
|
|
84928
|
+
),
|
|
84929
|
+
/* @__PURE__ */ jsx("span", { className: "text-sm font-medium text-green-800", children: "Ready to send" })
|
|
84930
|
+
]
|
|
84931
|
+
}
|
|
84932
|
+
)
|
|
84933
|
+
]
|
|
84934
|
+
}
|
|
84935
|
+
) : /* @__PURE__ */ jsx("div", { className: "w-full max-w-4xl mx-auto mt-8", children: /* @__PURE__ */ jsx(SMSSetup, {}) }) });
|
|
84747
84936
|
};
|
|
84748
84937
|
function SidebarTabLayout({
|
|
84749
84938
|
tabs,
|
|
@@ -85031,7 +85220,8 @@ function BroadcastList() {
|
|
|
85031
85220
|
() => createColumns({
|
|
85032
85221
|
automationName: t$1("engage:broadcast"),
|
|
85033
85222
|
setUrl,
|
|
85034
|
-
onToggle: handleToggle
|
|
85223
|
+
onToggle: handleToggle,
|
|
85224
|
+
pillForStatus: true
|
|
85035
85225
|
}),
|
|
85036
85226
|
[handleToggle, setUrl]
|
|
85037
85227
|
);
|
|
@@ -85715,6 +85905,7 @@ const AutomationsEditorHeader = ({ showBackButton, onDuplicationCreated, onBefor
|
|
|
85715
85905
|
AutomationTriggerType
|
|
85716
85906
|
);
|
|
85717
85907
|
}
|
|
85908
|
+
const automationLanguage = automation2.triggerType === AutomationTriggerType.ONE_TIME ? t$1("engage:automation") : t$1("engage:broadcast");
|
|
85718
85909
|
businessUpdateAutomation(
|
|
85719
85910
|
{
|
|
85720
85911
|
status: newStatus ? AutomationStatus.ACTIVE : AutomationStatus.DEACTIVATED
|
|
@@ -85722,10 +85913,21 @@ const AutomationsEditorHeader = ({ showBackButton, onDuplicationCreated, onBefor
|
|
|
85722
85913
|
{
|
|
85723
85914
|
onSuccess: () => {
|
|
85724
85915
|
setIsActive(newStatus);
|
|
85725
|
-
|
|
85726
|
-
|
|
85727
|
-
|
|
85728
|
-
|
|
85916
|
+
if (automation2.triggerType === AutomationTriggerType.ONE_TIME) {
|
|
85917
|
+
if (newStatus) {
|
|
85918
|
+
toast2({
|
|
85919
|
+
title: `${automationLanguage} started, you can still cancel before it finishes sending`
|
|
85920
|
+
});
|
|
85921
|
+
} else {
|
|
85922
|
+
toast2({
|
|
85923
|
+
title: `${automationLanguage} has been unscheduled`
|
|
85924
|
+
});
|
|
85925
|
+
}
|
|
85926
|
+
} else {
|
|
85927
|
+
toast2({
|
|
85928
|
+
title: `${automationLanguage} status updated to ${newStatus ? "active" : "inactive"}`
|
|
85929
|
+
});
|
|
85930
|
+
}
|
|
85729
85931
|
setEditingStatus(false);
|
|
85730
85932
|
},
|
|
85731
85933
|
onError: () => {
|
|
@@ -85776,7 +85978,10 @@ const AutomationsEditorHeader = ({ showBackButton, onDuplicationCreated, onBefor
|
|
|
85776
85978
|
throw UnreachableCaseStatement(automation2.status, AutomationStatus);
|
|
85777
85979
|
}
|
|
85778
85980
|
if (!showSwitch) {
|
|
85779
|
-
return /* @__PURE__ */ jsx(Badge, { variant: getAutomationStatusVariant(automation2.status), children: STATUS_DISPLAY
|
|
85981
|
+
return /* @__PURE__ */ jsx(Badge, { variant: getAutomationStatusVariant(automation2.status), children: STATUS_DISPLAY({
|
|
85982
|
+
status: automation2.status,
|
|
85983
|
+
automationType: automation2.triggerType
|
|
85984
|
+
}) });
|
|
85780
85985
|
}
|
|
85781
85986
|
switch (automation2.triggerType) {
|
|
85782
85987
|
case AutomationTriggerType.TRIGGER_BASED:
|
|
@@ -85796,40 +86001,52 @@ const AutomationsEditorHeader = ({ showBackButton, onDuplicationCreated, onBefor
|
|
|
85796
86001
|
const smsChannelSender = smsChannelSenders.find(
|
|
85797
86002
|
(sender) => sender.channelSender.id === communicationGroup?.smsChannelSenderId
|
|
85798
86003
|
);
|
|
85799
|
-
if (!automation2.triggerMetadata || automation2.triggerMetadata?.triggerType === AutomationTriggerType.ONE_TIME && !automation2.triggerMetadata?.scheduledAt || !communicationGroup?.emailChannelSenderId && !communicationGroup?.smsChannelSenderId || smsChannelSender && smsChannelSender?.smsApplication?.application && smsChannelSender?.smsApplication?.status !== SmsRegistrationApplicationStatus.APPROVED) {
|
|
86004
|
+
if (!automation2.triggerMetadata || automation2.triggerMetadata === null || automation2.triggerMetadata?.triggerType === AutomationTriggerType.ONE_TIME && !automation2.triggerMetadata?.scheduledAt || !communicationGroup?.emailChannelSenderId && !communicationGroup?.smsChannelSenderId || smsChannelSender && smsChannelSender?.smsApplication?.application && smsChannelSender?.smsApplication?.status !== SmsRegistrationApplicationStatus.APPROVED) {
|
|
85800
86005
|
const renderInfoTooltip = () => {
|
|
86006
|
+
const sendText = automation2.triggerMetadata && "scheduledAt" in automation2.triggerMetadata && automation2.triggerMetadata?.scheduledAt === "now" ? "Send Now" : "Schedule Send";
|
|
85801
86007
|
if (smsChannelSender?.smsApplication?.application && smsChannelSender.smsApplication?.status !== SmsRegistrationApplicationStatus.APPROVED) {
|
|
85802
86008
|
return /* @__PURE__ */ jsx(
|
|
85803
86009
|
InfoTooltip,
|
|
85804
86010
|
{
|
|
85805
|
-
title: "
|
|
85806
|
-
alertText: "
|
|
86011
|
+
title: "You'll be able to send campaigns once your SMS application is approved.",
|
|
86012
|
+
alertText: "SMS number approval pending",
|
|
86013
|
+
asChild: false,
|
|
86014
|
+
className: "cursor-not-allowed",
|
|
86015
|
+
children: /* @__PURE__ */ jsx(
|
|
86016
|
+
Button$1,
|
|
86017
|
+
{
|
|
86018
|
+
variant: "outline",
|
|
86019
|
+
className: "flex items-center gap-2",
|
|
86020
|
+
disabled: true,
|
|
86021
|
+
children: sendText
|
|
86022
|
+
}
|
|
86023
|
+
)
|
|
85807
86024
|
}
|
|
85808
86025
|
);
|
|
85809
86026
|
}
|
|
85810
|
-
if (!automation2.triggerMetadata || !("scheduledAt" in automation2.triggerMetadata) || "scheduledAt" in automation2.triggerMetadata && !automation2.triggerMetadata?.scheduledAt) {
|
|
86027
|
+
if (!automation2.triggerMetadata || automation2.triggerMetadata === null || !("scheduledAt" in automation2.triggerMetadata) || "scheduledAt" in automation2.triggerMetadata && !automation2.triggerMetadata?.scheduledAt) {
|
|
85811
86028
|
return /* @__PURE__ */ jsx(
|
|
85812
86029
|
InfoTooltip,
|
|
85813
86030
|
{
|
|
85814
86031
|
title: "Cannot send without a schedule time",
|
|
85815
|
-
alertText: "Before sending, please select a schedule time on the left sidebar"
|
|
86032
|
+
alertText: "Before sending, please select a schedule time on the left sidebar",
|
|
86033
|
+
asChild: false,
|
|
86034
|
+
className: "cursor-not-allowed",
|
|
86035
|
+
children: /* @__PURE__ */ jsx(
|
|
86036
|
+
Button$1,
|
|
86037
|
+
{
|
|
86038
|
+
variant: "outline",
|
|
86039
|
+
className: "flex items-center gap-2",
|
|
86040
|
+
disabled: true,
|
|
86041
|
+
children: sendText
|
|
86042
|
+
}
|
|
86043
|
+
)
|
|
85816
86044
|
}
|
|
85817
86045
|
);
|
|
85818
86046
|
}
|
|
85819
86047
|
return null;
|
|
85820
86048
|
};
|
|
85821
|
-
return /* @__PURE__ */
|
|
85822
|
-
/* @__PURE__ */ jsx(
|
|
85823
|
-
Button$1,
|
|
85824
|
-
{
|
|
85825
|
-
variant: "outline",
|
|
85826
|
-
className: "flex items-center gap-2",
|
|
85827
|
-
disabled: true,
|
|
85828
|
-
children: "Send Now"
|
|
85829
|
-
}
|
|
85830
|
-
),
|
|
85831
|
-
renderInfoTooltip()
|
|
85832
|
-
] });
|
|
86049
|
+
return /* @__PURE__ */ jsx("div", { className: "flex items-center gap-2 cursor-not-allowed", children: renderInfoTooltip() });
|
|
85833
86050
|
}
|
|
85834
86051
|
if (!isActive) {
|
|
85835
86052
|
let sendText = "Schedule Send";
|
|
@@ -85854,7 +86071,7 @@ const AutomationsEditorHeader = ({ showBackButton, onDuplicationCreated, onBefor
|
|
|
85854
86071
|
className: "flex items-center gap-2",
|
|
85855
86072
|
onClick: () => handleStatusChange(!isActive),
|
|
85856
86073
|
disabled: disableSwitch,
|
|
85857
|
-
children: "Convert to Draft"
|
|
86074
|
+
children: automation2.triggerType === AutomationTriggerType.ONE_TIME ? "Unschedule" : "Convert to Draft"
|
|
85858
86075
|
}
|
|
85859
86076
|
);
|
|
85860
86077
|
}
|
|
@@ -85881,40 +86098,46 @@ const AutomationsEditorHeader = ({ showBackButton, onDuplicationCreated, onBefor
|
|
|
85881
86098
|
return /* @__PURE__ */ jsxs("header", { className: "flex px-1 pt-1", children: [
|
|
85882
86099
|
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-4 flex-1", children: [
|
|
85883
86100
|
showBackButton && /* @__PURE__ */ jsx(Button$1, { variant: "ghost", size: "icon", onClick: () => navigate(-1), children: /* @__PURE__ */ jsx(ArrowLeft, {}) }),
|
|
85884
|
-
/* @__PURE__ */ jsxs("div", { className: "flex
|
|
85885
|
-
/* @__PURE__ */
|
|
85886
|
-
|
|
85887
|
-
|
|
85888
|
-
|
|
85889
|
-
|
|
85890
|
-
|
|
85891
|
-
|
|
85892
|
-
|
|
85893
|
-
|
|
85894
|
-
|
|
85895
|
-
|
|
85896
|
-
|
|
85897
|
-
|
|
85898
|
-
|
|
85899
|
-
|
|
85900
|
-
|
|
85901
|
-
|
|
85902
|
-
|
|
85903
|
-
|
|
85904
|
-
|
|
85905
|
-
|
|
85906
|
-
|
|
85907
|
-
|
|
85908
|
-
|
|
85909
|
-
|
|
85910
|
-
|
|
85911
|
-
|
|
85912
|
-
|
|
85913
|
-
|
|
85914
|
-
|
|
85915
|
-
|
|
85916
|
-
|
|
85917
|
-
|
|
86101
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
|
|
86102
|
+
/* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-0 items-start", children: [
|
|
86103
|
+
/* @__PURE__ */ jsx(
|
|
86104
|
+
InlineEditor,
|
|
86105
|
+
{
|
|
86106
|
+
value: automation2.name,
|
|
86107
|
+
schema: nameSchema,
|
|
86108
|
+
onSubmit: (values) => {
|
|
86109
|
+
return businessUpdateAutomation({
|
|
86110
|
+
name: values.name
|
|
86111
|
+
});
|
|
86112
|
+
},
|
|
86113
|
+
fieldName: "name",
|
|
86114
|
+
className: "text-lg",
|
|
86115
|
+
successMessage: "Automation name updated",
|
|
86116
|
+
errorMessage: "Failed to update automation name"
|
|
86117
|
+
}
|
|
86118
|
+
),
|
|
86119
|
+
automation2.automationType !== BusinessAutomationTypeEnum.MANAGED ? /* @__PURE__ */ jsx(
|
|
86120
|
+
InlineEditor,
|
|
86121
|
+
{
|
|
86122
|
+
value: automation2.description || "",
|
|
86123
|
+
schema: descriptionSchema,
|
|
86124
|
+
onSubmit: (values) => {
|
|
86125
|
+
return businessUpdateAutomation({
|
|
86126
|
+
description: values.description
|
|
86127
|
+
});
|
|
86128
|
+
},
|
|
86129
|
+
fieldName: "description",
|
|
86130
|
+
className: `text-sm ${automation2.description ? "text-current" : "text-muted-foreground"}`,
|
|
86131
|
+
successMessage: "Description updated",
|
|
86132
|
+
errorMessage: "Failed to update description",
|
|
86133
|
+
placeholderText: "Describe the goal of the automation"
|
|
86134
|
+
}
|
|
86135
|
+
) : automation2.description && /* @__PURE__ */ jsx("div", { className: "text-sm text-current", children: automation2.description })
|
|
86136
|
+
] }),
|
|
86137
|
+
/* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsx(Badge, { variant: getAutomationStatusVariant(automation2.status), children: STATUS_DISPLAY({
|
|
86138
|
+
status: automation2.status,
|
|
86139
|
+
automationType: automation2.triggerType
|
|
86140
|
+
}) }) })
|
|
85918
86141
|
] })
|
|
85919
86142
|
] }),
|
|
85920
86143
|
/* @__PURE__ */ jsxs("div", { className: "ml-auto flex gap-4 items-center", children: [
|
|
@@ -86076,50 +86299,39 @@ const AutomationRecipientsTable = () => {
|
|
|
86076
86299
|
const hasSms = smsCommunications.length > 0;
|
|
86077
86300
|
const emailDelivered = emailCommunications.some((c2) => c2.delivered);
|
|
86078
86301
|
const smsDelivered = smsCommunications.some((c2) => c2.delivered);
|
|
86079
|
-
|
|
86080
|
-
|
|
86081
|
-
|
|
86082
|
-
|
|
86083
|
-
|
|
86084
|
-
|
|
86085
|
-
|
|
86086
|
-
}
|
|
86087
|
-
|
|
86088
|
-
|
|
86089
|
-
|
|
86090
|
-
|
|
86091
|
-
|
|
86092
|
-
|
|
86093
|
-
|
|
86094
|
-
|
|
86095
|
-
|
|
86096
|
-
children: emailDelivered ? "Delivered" : "Pending"
|
|
86097
|
-
}
|
|
86098
|
-
)
|
|
86099
|
-
] })
|
|
86302
|
+
const emailError = emailCommunications.find((c2) => c2.error)?.error;
|
|
86303
|
+
const smsError = smsCommunications.find((c2) => c2.error)?.error;
|
|
86304
|
+
const renderInnerTooltip = (type, delivered, error2) => /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-1.5 cursor-pointer", children: [
|
|
86305
|
+
/* @__PURE__ */ jsxs("div", { className: "relative", children: [
|
|
86306
|
+
type === "email" ? /* @__PURE__ */ jsx(
|
|
86307
|
+
IconDefinitions.EmailIcon,
|
|
86308
|
+
{
|
|
86309
|
+
className: `h-4 w-4 ${error2 ? "text-red-500" : delivered ? "text-green-500" : "text-gray-400"}`
|
|
86310
|
+
}
|
|
86311
|
+
) : /* @__PURE__ */ jsx(
|
|
86312
|
+
IconDefinitions.SmsIcon,
|
|
86313
|
+
{
|
|
86314
|
+
className: `h-4 w-4 ${error2 ? "text-red-500" : delivered ? "text-green-500" : "text-gray-400"}`
|
|
86315
|
+
}
|
|
86316
|
+
),
|
|
86317
|
+
delivered && !error2 && /* @__PURE__ */ jsx("div", { className: "absolute -right-1 -top-1 h-2 w-2 rounded-full bg-green-500 ring-1 ring-white" }),
|
|
86318
|
+
error2 && /* @__PURE__ */ jsx("div", { className: "absolute -right-1 -top-1 h-2 w-2 rounded-full bg-red-500 ring-1 ring-white" })
|
|
86100
86319
|
] }),
|
|
86320
|
+
/* @__PURE__ */ jsxs("div", { className: "flex flex-col", children: [
|
|
86321
|
+
/* @__PURE__ */ jsx("span", { className: "text-sm font-medium", children: type === "email" ? "Email" : "SMS" }),
|
|
86322
|
+
error2 ? /* @__PURE__ */ jsx("span", { className: "text-xs text-red-500", children: "Failed" }) : /* @__PURE__ */ jsx(
|
|
86323
|
+
"span",
|
|
86324
|
+
{
|
|
86325
|
+
className: `text-xs ${delivered ? "text-green-600" : "text-gray-500"}`,
|
|
86326
|
+
children: delivered ? "Delivered" : "Pending"
|
|
86327
|
+
}
|
|
86328
|
+
)
|
|
86329
|
+
] })
|
|
86330
|
+
] });
|
|
86331
|
+
return /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-3", children: [
|
|
86332
|
+
hasEmail && (emailError ? /* @__PURE__ */ jsx(InfoTooltip, { title: emailError, children: renderInnerTooltip("email", emailDelivered, emailError) }) : renderInnerTooltip("email", emailDelivered, emailError)),
|
|
86101
86333
|
hasEmail && hasSms && /* @__PURE__ */ jsx("div", { className: "h-8 w-px bg-gray-200" }),
|
|
86102
|
-
hasSms && /* @__PURE__ */
|
|
86103
|
-
/* @__PURE__ */ jsxs("div", { className: "relative", children: [
|
|
86104
|
-
/* @__PURE__ */ jsx(
|
|
86105
|
-
IconDefinitions.SmsIcon,
|
|
86106
|
-
{
|
|
86107
|
-
className: `h-4 w-4 ${smsDelivered ? "text-green-500" : "text-gray-400"}`
|
|
86108
|
-
}
|
|
86109
|
-
),
|
|
86110
|
-
smsDelivered && /* @__PURE__ */ jsx("div", { className: "absolute -right-1 -top-1 h-2 w-2 rounded-full bg-green-500 ring-1 ring-white" })
|
|
86111
|
-
] }),
|
|
86112
|
-
/* @__PURE__ */ jsxs("div", { className: "flex flex-col", children: [
|
|
86113
|
-
/* @__PURE__ */ jsx("span", { className: "text-sm font-medium", children: "SMS" }),
|
|
86114
|
-
/* @__PURE__ */ jsx(
|
|
86115
|
-
"span",
|
|
86116
|
-
{
|
|
86117
|
-
className: `text-xs ${smsDelivered ? "text-green-600" : "text-gray-500"}`,
|
|
86118
|
-
children: smsDelivered ? "Delivered" : "Pending"
|
|
86119
|
-
}
|
|
86120
|
-
)
|
|
86121
|
-
] })
|
|
86122
|
-
] }),
|
|
86334
|
+
hasSms && (smsError ? /* @__PURE__ */ jsx(InfoTooltip, { title: smsError, children: renderInnerTooltip("sms", smsDelivered, smsError) }) : renderInnerTooltip("sms", smsDelivered, smsError)),
|
|
86123
86335
|
!hasEmail && !hasSms && /* @__PURE__ */ jsx("span", { className: "text-sm text-gray-400", children: "None" })
|
|
86124
86336
|
] });
|
|
86125
86337
|
}
|
|
@@ -88510,7 +88722,7 @@ const AutomationEditorTrigger = () => {
|
|
|
88510
88722
|
const renderTriggerData = () => {
|
|
88511
88723
|
switch (automation2.triggerType) {
|
|
88512
88724
|
case AutomationTriggerType.TRIGGER_BASED: {
|
|
88513
|
-
if (automation2.triggerMetadata.triggerType !== AutomationTriggerType.TRIGGER_BASED || automation2.triggerMetadata.eventName !== ReachEventNamesEnum.USER_ENTERS_SEGMENT || !automation2.triggerMetadata.eventFilter.segment_id) {
|
|
88725
|
+
if (automation2.triggerMetadata && automation2.triggerMetadata.triggerType !== AutomationTriggerType.TRIGGER_BASED || !automation2.triggerMetadata || automation2.triggerMetadata.eventName !== ReachEventNamesEnum.USER_ENTERS_SEGMENT || !automation2.triggerMetadata.eventFilter.segment_id) {
|
|
88514
88726
|
return null;
|
|
88515
88727
|
}
|
|
88516
88728
|
const segmentId = automation2.triggerMetadata.eventFilter.segment_id;
|
|
@@ -88566,7 +88778,7 @@ const AutomationEditorTrigger = () => {
|
|
|
88566
88778
|
copyText: `Click to set the date and time for this ${t$1("engage:broadcast")}`
|
|
88567
88779
|
}
|
|
88568
88780
|
) : /* @__PURE__ */ jsx(AutomationFlowLabel, { copyText: "Bulk send at" }),
|
|
88569
|
-
needsDate === false && "scheduledAt" in automation2.triggerMetadata && automation2.triggerMetadata.scheduledAt && /* @__PURE__ */ jsx("div", { className: "text-xs font-medium", children: /* @__PURE__ */ jsx(
|
|
88781
|
+
needsDate === false && automation2.triggerMetadata && "scheduledAt" in automation2.triggerMetadata && automation2.triggerMetadata.scheduledAt && /* @__PURE__ */ jsx("div", { className: "text-xs font-medium", children: /* @__PURE__ */ jsx(
|
|
88570
88782
|
SegmentPill,
|
|
88571
88783
|
{
|
|
88572
88784
|
segmentName: automation2.triggerMetadata.scheduledAt === "now" ? "5 minutes after send" : format$1(
|
|
@@ -89103,19 +89315,21 @@ const ViewAutomationMain = ({
|
|
|
89103
89315
|
const { updateCommunicationGroup: updateCommunicationGroup2 } = useUpdateCommunicationGroup();
|
|
89104
89316
|
const { toast: toast2 } = useToast();
|
|
89105
89317
|
const { channelSenders } = useChannelSender();
|
|
89318
|
+
const previousMergeFieldsRef = useRef("");
|
|
89106
89319
|
useEffect(() => {
|
|
89107
89320
|
if (communicationGroup && getExtraMergeFields) {
|
|
89108
89321
|
const updateExtraMergeFields = async () => {
|
|
89109
89322
|
const extraMergeFields = await getExtraMergeFields();
|
|
89110
|
-
|
|
89323
|
+
const currentMergeFieldsString = JSON.stringify(extraMergeFields);
|
|
89324
|
+
if (currentMergeFieldsString !== previousMergeFieldsRef.current) {
|
|
89325
|
+
previousMergeFieldsRef.current = currentMergeFieldsString;
|
|
89111
89326
|
updateCommunicationGroup2(
|
|
89112
89327
|
{
|
|
89113
89328
|
groupId: communicationGroup?.id,
|
|
89114
89329
|
params: { extraMergeFields }
|
|
89115
89330
|
},
|
|
89116
89331
|
{
|
|
89117
|
-
|
|
89118
|
-
onError: (error2) => {
|
|
89332
|
+
onError: () => {
|
|
89119
89333
|
toast2({
|
|
89120
89334
|
title: "Error saving merge fields!",
|
|
89121
89335
|
description: "Please contact your administrator if this issue persists.",
|