@embedreach/components 0.1.89 → 0.1.90
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 +233 -184
- package/dist/index.umd.js +111 -111
- package/package.json +1 -1
package/dist/chunks/index.js
CHANGED
|
@@ -62851,11 +62851,6 @@ const useRecipientStats = (automation2) => {
|
|
|
62851
62851
|
const AutomationContext = createContext$1(
|
|
62852
62852
|
null
|
|
62853
62853
|
);
|
|
62854
|
-
const CommunicationContext = createContext$1(null);
|
|
62855
|
-
const LoadingContext = createContext$1(null);
|
|
62856
|
-
const ValidationContext = createContext$1(
|
|
62857
|
-
null
|
|
62858
|
-
);
|
|
62859
62854
|
const useAutomation = () => {
|
|
62860
62855
|
const context2 = useContext$1(AutomationContext);
|
|
62861
62856
|
if (!context2) {
|
|
@@ -62865,6 +62860,7 @@ const useAutomation = () => {
|
|
|
62865
62860
|
}
|
|
62866
62861
|
return context2;
|
|
62867
62862
|
};
|
|
62863
|
+
const CommunicationContext = createContext$1(null);
|
|
62868
62864
|
const useCommunication = () => {
|
|
62869
62865
|
const context2 = useContext$1(CommunicationContext);
|
|
62870
62866
|
if (!context2) {
|
|
@@ -62874,6 +62870,7 @@ const useCommunication = () => {
|
|
|
62874
62870
|
}
|
|
62875
62871
|
return context2;
|
|
62876
62872
|
};
|
|
62873
|
+
const LoadingContext = createContext$1(null);
|
|
62877
62874
|
const useLoading = () => {
|
|
62878
62875
|
const context2 = useContext$1(LoadingContext);
|
|
62879
62876
|
if (!context2) {
|
|
@@ -62881,6 +62878,9 @@ const useLoading = () => {
|
|
|
62881
62878
|
}
|
|
62882
62879
|
return context2;
|
|
62883
62880
|
};
|
|
62881
|
+
const ValidationContext = createContext$1(
|
|
62882
|
+
null
|
|
62883
|
+
);
|
|
62884
62884
|
const useValidation = () => {
|
|
62885
62885
|
const context2 = useContext$1(ValidationContext);
|
|
62886
62886
|
if (!context2) {
|
|
@@ -62898,13 +62898,13 @@ const ViewAutomationProvider = ({
|
|
|
62898
62898
|
const mountedRef = useRef(true);
|
|
62899
62899
|
const { automation: fetchedAutomation, isLoading: isFetchLoading } = useGetBusinessAutomation(automationId);
|
|
62900
62900
|
const automation2 = existingAutomation || fetchedAutomation;
|
|
62901
|
-
const { isUpdating } = useUpdateBusinessAutomation(automationId);
|
|
62902
62901
|
const communicationGroupId = automation2?.action_data?.find(
|
|
62903
62902
|
(action) => action.action_type === "send_communication"
|
|
62904
62903
|
)?.action_metadata.communication_group_id;
|
|
62904
|
+
const { isUpdating } = useUpdateBusinessAutomation(automationId);
|
|
62905
62905
|
const { communicationGroup, isGetting: isLoadingCommunicationGroup } = useGetCommunicationGroup(communicationGroupId || void 0);
|
|
62906
|
-
const { isUpdating: isUpdatingCommunicationGroup } = useUpdateCommunicationGroup();
|
|
62907
62906
|
const { estimatedMatchesStats } = useRecipientStats(automation2);
|
|
62907
|
+
const { isUpdating: isUpdatingCommunicationGroup } = useUpdateCommunicationGroup();
|
|
62908
62908
|
const [isLoading, setIsLoading] = useState(false);
|
|
62909
62909
|
useEffect(() => {
|
|
62910
62910
|
const loadingState = (!existingAutomation && isFetchLoading || isUpdating || isLoadingCommunicationGroup || isUpdatingCommunicationGroup) && mountedRef.current;
|
|
@@ -64989,6 +64989,20 @@ const DropdownMenuSeparator = React.forwardRef(({ className: className2, ...prop
|
|
|
64989
64989
|
}
|
|
64990
64990
|
));
|
|
64991
64991
|
DropdownMenuSeparator.displayName = Separator2.displayName;
|
|
64992
|
+
const CancelAutomationDialog = ({
|
|
64993
|
+
open,
|
|
64994
|
+
onOpenChange,
|
|
64995
|
+
onCancel
|
|
64996
|
+
}) => {
|
|
64997
|
+
return /* @__PURE__ */ jsx(Dialog, { open, onOpenChange, children: /* @__PURE__ */ jsxs(DialogContent, { className: "sm:max-w-[425px]", children: [
|
|
64998
|
+
/* @__PURE__ */ jsx(DialogTitle, { className: "text-xl font-semibold", children: "Cancel Automation" }),
|
|
64999
|
+
/* @__PURE__ */ jsx(DialogDescription, { className: "text-gray-600 mt-2 text-center", children: "Are you sure you want to cancel this automation? This action cannot be undone." }),
|
|
65000
|
+
/* @__PURE__ */ jsxs("div", { className: "flex justify-center gap-3 mt-6", children: [
|
|
65001
|
+
/* @__PURE__ */ jsx(Button$1, { variant: "outline", onClick: () => onOpenChange(false), children: "Keep Running" }),
|
|
65002
|
+
/* @__PURE__ */ jsx(Button$1, { variant: "destructive", onClick: onCancel, children: "Yes, Cancel Automation" })
|
|
65003
|
+
] })
|
|
65004
|
+
] }) });
|
|
65005
|
+
};
|
|
64992
65006
|
const stepIndicatorContainer = "reach-styles-module__stepIndicatorContainer___FoKXB";
|
|
64993
65007
|
const iconContainer = "reach-styles-module__iconContainer___Ki-1n";
|
|
64994
65008
|
const checkIcon = "reach-styles-module__checkIcon___-krUS";
|
|
@@ -65418,6 +65432,12 @@ const EmailPreview = ({ mergeFieldsResponse }) => {
|
|
|
65418
65432
|
const { communicationGroup } = useCommunication();
|
|
65419
65433
|
const { automation: automation2 } = useAutomation();
|
|
65420
65434
|
const { updateCommunicationGroup: updateCommunicationGroup2 } = useUpdateCommunicationGroup();
|
|
65435
|
+
const { refetchAutomation: refreshAutomation } = useGetBusinessAutomation(
|
|
65436
|
+
automation2?.id || ""
|
|
65437
|
+
);
|
|
65438
|
+
const { channelSenders } = useChannelSender();
|
|
65439
|
+
const { channelAccounts } = useChannelAccount();
|
|
65440
|
+
const { updateChannelSender: updateChannelSender2 } = useUpdateChannelSender();
|
|
65421
65441
|
const [isUpdating, setIsUpdating] = useState(false);
|
|
65422
65442
|
const [fromEmail, setFromEmail] = useState(
|
|
65423
65443
|
communicationGroup?.email_channel_sender_id || null
|
|
@@ -65438,20 +65458,19 @@ const EmailPreview = ({ mergeFieldsResponse }) => {
|
|
|
65438
65458
|
const [replyToEmailError, setReplyToEmailError] = useState(
|
|
65439
65459
|
null
|
|
65440
65460
|
);
|
|
65441
|
-
const { refetchAutomation: refreshAutomation } = useGetBusinessAutomation(
|
|
65442
|
-
automation2?.id || ""
|
|
65443
|
-
);
|
|
65444
65461
|
const [showHelpDialog, setShowHelpDialog] = useState(false);
|
|
65445
65462
|
const initialRenderRef = useRef(true);
|
|
65446
65463
|
const [isFormLoading, setIsFormLoading] = useState(true);
|
|
65447
65464
|
const [userModifiedEmail, setUserModifiedEmail] = useState(false);
|
|
65465
|
+
const [stripoDialogDimensions, setStripoDialogDimensions] = useState({
|
|
65466
|
+
width: 0,
|
|
65467
|
+
height: 0
|
|
65468
|
+
});
|
|
65469
|
+
const [updatingField, setUpdatingField] = useState(null);
|
|
65448
65470
|
const debouncedSubject = useDebounce(subject, 500);
|
|
65449
65471
|
const debouncedPreviewText = useDebounce(previewText, 500);
|
|
65450
65472
|
const debouncedFromName = useDebounce(fromName, 500);
|
|
65451
65473
|
const debouncedReplyToEmail = useDebounce(replyToEmail, 500);
|
|
65452
|
-
const { channelSenders } = useChannelSender();
|
|
65453
|
-
const { channelAccounts } = useChannelAccount();
|
|
65454
|
-
const { updateChannelSender: updateChannelSender2 } = useUpdateChannelSender();
|
|
65455
65474
|
const emailChannelSendersWithChannelAccounts = useMemo(
|
|
65456
65475
|
() => channelSenders?.results?.filter((sender) => sender.channel_sender_metadata.userPart)?.flatMap((sender) => {
|
|
65457
65476
|
const channelAccount = channelAccounts?.results?.find(
|
|
@@ -65470,10 +65489,6 @@ const EmailPreview = ({ mergeFieldsResponse }) => {
|
|
|
65470
65489
|
}) || [],
|
|
65471
65490
|
[channelSenders?.results, channelAccounts?.results]
|
|
65472
65491
|
);
|
|
65473
|
-
const [stripoDialogDimensions, setStripoDialogDimensions] = useState({
|
|
65474
|
-
width: 0,
|
|
65475
|
-
height: 0
|
|
65476
|
-
});
|
|
65477
65492
|
const emailPreviewDimensions = useMemo(
|
|
65478
65493
|
() => ({
|
|
65479
65494
|
width: 800,
|
|
@@ -65552,10 +65567,12 @@ const EmailPreview = ({ mergeFieldsResponse }) => {
|
|
|
65552
65567
|
(sender) => sender.id === fromEmail
|
|
65553
65568
|
);
|
|
65554
65569
|
if (channelSender) {
|
|
65555
|
-
setFromName(channelSender.channel_sender_metadata.emailFromName);
|
|
65556
65570
|
if (!userModifiedEmail || isFormLoading) {
|
|
65557
65571
|
setReplyToEmail(channelSender.channel_sender_metadata.emailReplyTo);
|
|
65558
65572
|
}
|
|
65573
|
+
if (isFormLoading) {
|
|
65574
|
+
setFromName(channelSender.channel_sender_metadata.emailFromName);
|
|
65575
|
+
}
|
|
65559
65576
|
setIsFormLoading(false);
|
|
65560
65577
|
}
|
|
65561
65578
|
}
|
|
@@ -65584,7 +65601,7 @@ const EmailPreview = ({ mergeFieldsResponse }) => {
|
|
|
65584
65601
|
]);
|
|
65585
65602
|
useEffect(() => {
|
|
65586
65603
|
if (!initialRenderRef.current && debouncedFromName && fromEmail) {
|
|
65587
|
-
|
|
65604
|
+
setUpdatingField("fromName");
|
|
65588
65605
|
const updateSender = async () => {
|
|
65589
65606
|
try {
|
|
65590
65607
|
const channelSender = channelSenders?.results?.find(
|
|
@@ -65604,7 +65621,7 @@ const EmailPreview = ({ mergeFieldsResponse }) => {
|
|
|
65604
65621
|
} catch (error2) {
|
|
65605
65622
|
console.error("Error updating from name:", error2);
|
|
65606
65623
|
} finally {
|
|
65607
|
-
|
|
65624
|
+
setUpdatingField(null);
|
|
65608
65625
|
}
|
|
65609
65626
|
};
|
|
65610
65627
|
updateSender();
|
|
@@ -65627,31 +65644,42 @@ const EmailPreview = ({ mergeFieldsResponse }) => {
|
|
|
65627
65644
|
}
|
|
65628
65645
|
}, [debouncedReplyToEmail]);
|
|
65629
65646
|
useEffect(() => {
|
|
65630
|
-
|
|
65631
|
-
|
|
65632
|
-
|
|
65633
|
-
|
|
65634
|
-
|
|
65635
|
-
|
|
65636
|
-
);
|
|
65637
|
-
|
|
65638
|
-
|
|
65639
|
-
|
|
65640
|
-
|
|
65641
|
-
channel_sender_metadata
|
|
65642
|
-
|
|
65643
|
-
emailReplyTo: debouncedReplyToEmail
|
|
65644
|
-
}
|
|
65647
|
+
const updateReplyTo = async (args) => {
|
|
65648
|
+
try {
|
|
65649
|
+
const channelSender = channelSenders?.results?.find(
|
|
65650
|
+
(sender) => sender.id === args.fromEmail
|
|
65651
|
+
);
|
|
65652
|
+
if (channelSender) {
|
|
65653
|
+
console.log("Updating reply-to email:", args.debouncedReplyToEmail);
|
|
65654
|
+
updateChannelSender2({
|
|
65655
|
+
id: args.fromEmail,
|
|
65656
|
+
toUpdate: {
|
|
65657
|
+
channel_sender_metadata: {
|
|
65658
|
+
...channelSender.channel_sender_metadata,
|
|
65659
|
+
emailReplyTo: args.debouncedReplyToEmail
|
|
65645
65660
|
}
|
|
65646
|
-
}
|
|
65647
|
-
}
|
|
65648
|
-
} catch (error2) {
|
|
65649
|
-
console.error("Error updating reply-to email:", error2);
|
|
65650
|
-
} finally {
|
|
65651
|
-
setIsUpdating(false);
|
|
65661
|
+
}
|
|
65662
|
+
});
|
|
65652
65663
|
}
|
|
65653
|
-
}
|
|
65654
|
-
|
|
65664
|
+
} catch (error2) {
|
|
65665
|
+
console.error("Error updating reply-to email:", error2);
|
|
65666
|
+
} finally {
|
|
65667
|
+
setUpdatingField(null);
|
|
65668
|
+
}
|
|
65669
|
+
};
|
|
65670
|
+
if (!initialRenderRef.current && fromEmail && !replyToEmailError) {
|
|
65671
|
+
setUpdatingField("replyToEmail");
|
|
65672
|
+
if (debouncedReplyToEmail) {
|
|
65673
|
+
updateReplyTo({
|
|
65674
|
+
fromEmail,
|
|
65675
|
+
debouncedReplyToEmail
|
|
65676
|
+
});
|
|
65677
|
+
} else {
|
|
65678
|
+
updateReplyTo({
|
|
65679
|
+
fromEmail,
|
|
65680
|
+
debouncedReplyToEmail: null
|
|
65681
|
+
});
|
|
65682
|
+
}
|
|
65655
65683
|
}
|
|
65656
65684
|
}, [
|
|
65657
65685
|
debouncedReplyToEmail,
|
|
@@ -65765,7 +65793,7 @@ const EmailPreview = ({ mergeFieldsResponse }) => {
|
|
|
65765
65793
|
placeholder: "Enter from name",
|
|
65766
65794
|
value: fromName ?? "",
|
|
65767
65795
|
onChange: (e4) => setFromName(e4.target.value),
|
|
65768
|
-
disabled: isUpdating || !fromEmail || isFormLoading
|
|
65796
|
+
disabled: isUpdating && updatingField !== "fromName" || !fromEmail || isFormLoading
|
|
65769
65797
|
}
|
|
65770
65798
|
)
|
|
65771
65799
|
] }),
|
|
@@ -65786,10 +65814,13 @@ const EmailPreview = ({ mergeFieldsResponse }) => {
|
|
|
65786
65814
|
placeholder: "Enter reply to email",
|
|
65787
65815
|
value: replyToEmail ?? "",
|
|
65788
65816
|
onChange: (e4) => {
|
|
65789
|
-
|
|
65790
|
-
|
|
65817
|
+
const newValue = e4.target.value;
|
|
65818
|
+
setReplyToEmail(newValue);
|
|
65819
|
+
if (!userModifiedEmail) {
|
|
65820
|
+
setUserModifiedEmail(true);
|
|
65821
|
+
}
|
|
65791
65822
|
},
|
|
65792
|
-
disabled: isUpdating || !fromEmail || isFormLoading
|
|
65823
|
+
disabled: isUpdating && updatingField !== "replyToEmail" || !fromEmail || isFormLoading
|
|
65793
65824
|
}
|
|
65794
65825
|
),
|
|
65795
65826
|
replyToEmailError && /* @__PURE__ */ jsx("p", { className: "text-sm text-red-500 mt-1", children: replyToEmailError })
|
|
@@ -66094,19 +66125,12 @@ const useMe = () => {
|
|
|
66094
66125
|
};
|
|
66095
66126
|
const SMSPreview = ({ iconDefinitions, mergeFieldsResponse }) => {
|
|
66096
66127
|
const { automation: automation2 } = useAutomation();
|
|
66097
|
-
const [isUpdating, setIsUpdating] = useState(false);
|
|
66098
66128
|
const _getCommunicationGroupFromAutomation = useCallback(() => {
|
|
66099
66129
|
const actionGroup = automation2?.action_data?.find(
|
|
66100
66130
|
(action) => action.action_type === "send_communication"
|
|
66101
66131
|
);
|
|
66102
66132
|
return actionGroup?.action_metadata.communication_group_id;
|
|
66103
66133
|
}, [automation2?.action_data]);
|
|
66104
|
-
const [mergeFieldValue, setMergeFieldValue] = useState("");
|
|
66105
|
-
const [fromNumber, setFromNumber] = useState(null);
|
|
66106
|
-
const [initCompanyName, setInitCompanyName] = useState(false);
|
|
66107
|
-
const [companyName, setCompanyName] = useState(null);
|
|
66108
|
-
const [message2, setMessage] = useState(null);
|
|
66109
|
-
const [showSmsEditor, setShowSmsEditor] = useState(false);
|
|
66110
66134
|
const { channelSenders } = useChannelSender();
|
|
66111
66135
|
const { data: me2, isLoading: isMeLoading } = useMe();
|
|
66112
66136
|
const { channelAccounts } = useChannelAccount();
|
|
@@ -66114,6 +66138,13 @@ const SMSPreview = ({ iconDefinitions, mergeFieldsResponse }) => {
|
|
|
66114
66138
|
const { communicationGroup } = useGetCommunicationGroup(
|
|
66115
66139
|
_getCommunicationGroupFromAutomation() ?? void 0
|
|
66116
66140
|
);
|
|
66141
|
+
const [isUpdating, setIsUpdating] = useState(false);
|
|
66142
|
+
const [mergeFieldValue, setMergeFieldValue] = useState("");
|
|
66143
|
+
const [fromNumber, setFromNumber] = useState(null);
|
|
66144
|
+
const [initCompanyName, setInitCompanyName] = useState(false);
|
|
66145
|
+
const [companyName, setCompanyName] = useState(null);
|
|
66146
|
+
const [message2, setMessage] = useState(null);
|
|
66147
|
+
const [showSmsEditor, setShowSmsEditor] = useState(false);
|
|
66117
66148
|
const inputRef = useRef(null);
|
|
66118
66149
|
const debouncedMessage = useDebounce(message2, 1e3);
|
|
66119
66150
|
const debouncedFromNumber = useDebounce(fromNumber, 1e3);
|
|
@@ -67061,9 +67092,9 @@ const PreviewAndSchedule = ({
|
|
|
67061
67092
|
const { automation: automation2 } = useAutomation();
|
|
67062
67093
|
const { communicationGroup } = useCommunication();
|
|
67063
67094
|
const { updateAutomation: businessUpdateAutomation } = useUpdateBusinessAutomation(automation2?.id || "");
|
|
67064
|
-
const updateAutomation2 = externalUpdateAutomation || ((params) => businessUpdateAutomation(params));
|
|
67065
67095
|
const { channelSenders } = useChannelSender();
|
|
67066
67096
|
const { channelAccounts } = useChannelAccount();
|
|
67097
|
+
const updateAutomation2 = externalUpdateAutomation || ((params) => businessUpdateAutomation(params));
|
|
67067
67098
|
const [emailPreview, setEmailPreview] = useState(null);
|
|
67068
67099
|
const [smsPreview, setSmsPreview] = useState(null);
|
|
67069
67100
|
const [channelSenderData, setChannelSenderData] = useState(null);
|
|
@@ -67510,29 +67541,19 @@ const TitleAndContent = ({ title: title2, subtitle, content: content2, className
|
|
|
67510
67541
|
/* @__PURE__ */ jsx("div", { className: "bg-white rounded-2xl w-full border border-gray-200 p-6 relative", children: content2 })
|
|
67511
67542
|
] });
|
|
67512
67543
|
};
|
|
67513
|
-
const containerVariants = {
|
|
67514
|
-
hidden: { opacity: 0 },
|
|
67515
|
-
visible: {
|
|
67516
|
-
opacity: 1,
|
|
67517
|
-
transition: {
|
|
67518
|
-
duration: 0.5,
|
|
67519
|
-
staggerChildren: 0.1
|
|
67520
|
-
}
|
|
67521
|
-
}
|
|
67522
|
-
};
|
|
67523
|
-
const itemVariants = {
|
|
67524
|
-
hidden: { opacity: 0, y: 10 },
|
|
67525
|
-
visible: {
|
|
67526
|
-
opacity: 1,
|
|
67527
|
-
y: 0,
|
|
67528
|
-
transition: {
|
|
67529
|
-
type: "spring",
|
|
67530
|
-
stiffness: 300,
|
|
67531
|
-
damping: 24
|
|
67532
|
-
}
|
|
67533
|
-
}
|
|
67534
|
-
};
|
|
67535
67544
|
const TriggerEditAutomation = ({ automation: automation2 }) => {
|
|
67545
|
+
const itemVariants = {
|
|
67546
|
+
hidden: { opacity: 0, y: 10 },
|
|
67547
|
+
visible: {
|
|
67548
|
+
opacity: 1,
|
|
67549
|
+
y: 0,
|
|
67550
|
+
transition: {
|
|
67551
|
+
type: "spring",
|
|
67552
|
+
stiffness: 300,
|
|
67553
|
+
damping: 24
|
|
67554
|
+
}
|
|
67555
|
+
}
|
|
67556
|
+
};
|
|
67536
67557
|
if (!automation2.name) {
|
|
67537
67558
|
return /* @__PURE__ */ jsx("div", { className: "flex items-center justify-center min-h-[200px]", children: /* @__PURE__ */ jsx(BasicLoader, {}) });
|
|
67538
67559
|
}
|
|
@@ -67540,7 +67561,16 @@ const TriggerEditAutomation = ({ automation: automation2 }) => {
|
|
|
67540
67561
|
motion.div,
|
|
67541
67562
|
{
|
|
67542
67563
|
className: "bg-white rounded-2xl shadow-sm border border-gray-100 p-6 max-w-lg",
|
|
67543
|
-
variants:
|
|
67564
|
+
variants: {
|
|
67565
|
+
hidden: { opacity: 0 },
|
|
67566
|
+
visible: {
|
|
67567
|
+
opacity: 1,
|
|
67568
|
+
transition: {
|
|
67569
|
+
duration: 0.5,
|
|
67570
|
+
staggerChildren: 0.1
|
|
67571
|
+
}
|
|
67572
|
+
}
|
|
67573
|
+
},
|
|
67544
67574
|
initial: "hidden",
|
|
67545
67575
|
animate: "visible",
|
|
67546
67576
|
children: [
|
|
@@ -67749,7 +67779,7 @@ const getAutomationSteps = ({
|
|
|
67749
67779
|
}
|
|
67750
67780
|
];
|
|
67751
67781
|
};
|
|
67752
|
-
const
|
|
67782
|
+
const useValidateStep = () => {
|
|
67753
67783
|
const { automation: automation2 } = useAutomation();
|
|
67754
67784
|
const { communicationGroup } = useCommunication();
|
|
67755
67785
|
const validateStep = useCallback(
|
|
@@ -67838,6 +67868,7 @@ const EditAutomation = ({
|
|
|
67838
67868
|
const { automation: automation2 } = useAutomation();
|
|
67839
67869
|
const { communicationGroup } = useCommunication();
|
|
67840
67870
|
const { estimatedMatchesStats } = useValidation();
|
|
67871
|
+
const { validateStep } = useValidateStep();
|
|
67841
67872
|
const [currentStep, setCurrentStep] = useState(
|
|
67842
67873
|
void 0
|
|
67843
67874
|
);
|
|
@@ -67845,7 +67876,6 @@ const EditAutomation = ({
|
|
|
67845
67876
|
const { updateAutomation: updateAutomation2 } = useUpdateBusinessAutomation(
|
|
67846
67877
|
automation2?.id || ""
|
|
67847
67878
|
);
|
|
67848
|
-
const { validateStep } = useAutomationActions();
|
|
67849
67879
|
useEffect(() => {
|
|
67850
67880
|
if (automation2) {
|
|
67851
67881
|
setCurrentStep(
|
|
@@ -68044,6 +68074,39 @@ const EditAutomation = ({
|
|
|
68044
68074
|
renderFooter()
|
|
68045
68075
|
] });
|
|
68046
68076
|
};
|
|
68077
|
+
const EditAutomationDialog = ({
|
|
68078
|
+
open,
|
|
68079
|
+
onOpenChange,
|
|
68080
|
+
iconDefinitions,
|
|
68081
|
+
setOpenEditAutomationPopup,
|
|
68082
|
+
logoUrl,
|
|
68083
|
+
getExtraMergeFields,
|
|
68084
|
+
onBeforeSchedule
|
|
68085
|
+
}) => {
|
|
68086
|
+
return /* @__PURE__ */ jsx(Dialog, { open, onOpenChange, children: /* @__PURE__ */ jsxs(
|
|
68087
|
+
DialogContent,
|
|
68088
|
+
{
|
|
68089
|
+
className: "max-w-7xl w-full overflow-hidden p-0 h-full max-h-[calc(100dvh-10dvh)]",
|
|
68090
|
+
hideCloseButton: true,
|
|
68091
|
+
children: [
|
|
68092
|
+
/* @__PURE__ */ jsxs(VisuallyHidden$2, { children: [
|
|
68093
|
+
/* @__PURE__ */ jsx(DialogTitle, { children: "Edit Automation" }),
|
|
68094
|
+
/* @__PURE__ */ jsx(DialogDescription, { children: "Edit the automation to change the content, schedule, and other details." })
|
|
68095
|
+
] }),
|
|
68096
|
+
/* @__PURE__ */ jsx(
|
|
68097
|
+
EditAutomation,
|
|
68098
|
+
{
|
|
68099
|
+
iconDefinitions,
|
|
68100
|
+
setOpenEditAutomationPopup,
|
|
68101
|
+
logoUrl,
|
|
68102
|
+
getExtraMergeFields,
|
|
68103
|
+
onBeforeSchedule
|
|
68104
|
+
}
|
|
68105
|
+
)
|
|
68106
|
+
]
|
|
68107
|
+
}
|
|
68108
|
+
) });
|
|
68109
|
+
};
|
|
68047
68110
|
const validateEmail = (email) => {
|
|
68048
68111
|
const emailRegex = /^[^\s@.]+(?:\.[^\s@.]+)*@[^\s@.]+(?:\.[^\s@.]+)+$/;
|
|
68049
68112
|
return emailRegex.test(email);
|
|
@@ -68200,6 +68263,52 @@ const SendPreviewPopup = ({ automation: automation2, type, setOpenSendPreviewPop
|
|
|
68200
68263
|
)
|
|
68201
68264
|
] });
|
|
68202
68265
|
};
|
|
68266
|
+
const PreviewEmailDialog = ({
|
|
68267
|
+
open,
|
|
68268
|
+
onOpenChange,
|
|
68269
|
+
automation: automation2,
|
|
68270
|
+
iconDefinitions,
|
|
68271
|
+
setOpenSendPreviewPopup
|
|
68272
|
+
}) => {
|
|
68273
|
+
return /* @__PURE__ */ jsx(Dialog, { open, onOpenChange, children: /* @__PURE__ */ jsxs(DialogContent, { children: [
|
|
68274
|
+
/* @__PURE__ */ jsxs(VisuallyHidden$2, { children: [
|
|
68275
|
+
/* @__PURE__ */ jsx(DialogTitle, { children: "Send Preview Email" }),
|
|
68276
|
+
/* @__PURE__ */ jsx(DialogDescription, { children: "Send a preview email to the automation." })
|
|
68277
|
+
] }),
|
|
68278
|
+
/* @__PURE__ */ jsx(
|
|
68279
|
+
SendPreviewPopup,
|
|
68280
|
+
{
|
|
68281
|
+
automation: automation2,
|
|
68282
|
+
type: "email",
|
|
68283
|
+
setOpenSendPreviewPopup,
|
|
68284
|
+
iconDefinitions
|
|
68285
|
+
}
|
|
68286
|
+
)
|
|
68287
|
+
] }) });
|
|
68288
|
+
};
|
|
68289
|
+
const PreviewSmsDialog = ({
|
|
68290
|
+
open,
|
|
68291
|
+
onOpenChange,
|
|
68292
|
+
automation: automation2,
|
|
68293
|
+
iconDefinitions,
|
|
68294
|
+
setOpenSendPreviewPopup
|
|
68295
|
+
}) => {
|
|
68296
|
+
return /* @__PURE__ */ jsx(Dialog, { open, onOpenChange, children: /* @__PURE__ */ jsxs(DialogContent, { children: [
|
|
68297
|
+
/* @__PURE__ */ jsxs(VisuallyHidden$2, { children: [
|
|
68298
|
+
/* @__PURE__ */ jsx(DialogTitle, { children: "Send Preview SMS" }),
|
|
68299
|
+
/* @__PURE__ */ jsx(DialogDescription, { children: "Send a preview SMS to the automation." })
|
|
68300
|
+
] }),
|
|
68301
|
+
/* @__PURE__ */ jsx(
|
|
68302
|
+
SendPreviewPopup,
|
|
68303
|
+
{
|
|
68304
|
+
automation: automation2,
|
|
68305
|
+
type: "sms",
|
|
68306
|
+
setOpenSendPreviewPopup,
|
|
68307
|
+
iconDefinitions
|
|
68308
|
+
}
|
|
68309
|
+
)
|
|
68310
|
+
] }) });
|
|
68311
|
+
};
|
|
68203
68312
|
const ViewAutomationHeaderContainer = ({
|
|
68204
68313
|
iconDefinitions,
|
|
68205
68314
|
autoOpenEditPopup,
|
|
@@ -68209,13 +68318,14 @@ const ViewAutomationHeaderContainer = ({
|
|
|
68209
68318
|
onBeforeSchedule,
|
|
68210
68319
|
showBackButton = false
|
|
68211
68320
|
}) => {
|
|
68321
|
+
const mergedIconDefinitions = mergeIconDefinitions(iconDefinitions);
|
|
68212
68322
|
const [openEditAutomationPopup, setOpenEditAutomationPopup] = useState(false);
|
|
68213
68323
|
const [openSendPreviewSmsPopup, setOpenSendPreviewSmsPopup] = useState(false);
|
|
68324
|
+
const [openSendPreviewEmailPopup, setOpenSendPreviewEmailPopup] = useState(false);
|
|
68214
68325
|
const [
|
|
68215
68326
|
cancelAutomationConfirmationPopup,
|
|
68216
68327
|
setCancelAutomationConfirmationPopup
|
|
68217
68328
|
] = useState(false);
|
|
68218
|
-
const [openSendPreviewEmailPopup, setOpenSendPreviewEmailPopup] = useState(false);
|
|
68219
68329
|
const { automation: automation2 } = useAutomation();
|
|
68220
68330
|
const { updateAutomation: updateAutomation2 } = useUpdateBusinessAutomation(
|
|
68221
68331
|
automation2?.id || ""
|
|
@@ -68223,7 +68333,6 @@ const ViewAutomationHeaderContainer = ({
|
|
|
68223
68333
|
const { invalidateAutomation } = useGetBusinessAutomation(
|
|
68224
68334
|
automation2?.id || ""
|
|
68225
68335
|
);
|
|
68226
|
-
const mergedIconDefinitions = mergeIconDefinitions(iconDefinitions);
|
|
68227
68336
|
const navigate = useNavigate();
|
|
68228
68337
|
const { toast: toast2 } = useToast();
|
|
68229
68338
|
useEffect(() => {
|
|
@@ -68277,102 +68386,6 @@ const ViewAutomationHeaderContainer = ({
|
|
|
68277
68386
|
if (!automation2) {
|
|
68278
68387
|
return /* @__PURE__ */ jsx("div", { className: "flex justify-center items-center h-full", children: /* @__PURE__ */ jsx(BasicLoader, { text: ["Fetching Automation data", "Finishing up"] }) });
|
|
68279
68388
|
}
|
|
68280
|
-
const renderEditAutomationDialog = () => /* @__PURE__ */ jsx(
|
|
68281
|
-
Dialog,
|
|
68282
|
-
{
|
|
68283
|
-
open: openEditAutomationPopup,
|
|
68284
|
-
onOpenChange: handleEditDialogChange,
|
|
68285
|
-
children: /* @__PURE__ */ jsxs(
|
|
68286
|
-
DialogContent,
|
|
68287
|
-
{
|
|
68288
|
-
className: "max-w-7xl w-full overflow-hidden p-0 h-full max-h-[calc(100dvh-10dvh)]",
|
|
68289
|
-
hideCloseButton: true,
|
|
68290
|
-
children: [
|
|
68291
|
-
/* @__PURE__ */ jsxs(VisuallyHidden$2, { children: [
|
|
68292
|
-
/* @__PURE__ */ jsx(DialogTitle, { children: "Edit Automation" }),
|
|
68293
|
-
/* @__PURE__ */ jsx(DialogDescription, { children: "Edit the automation to change the content, schedule, and other details." })
|
|
68294
|
-
] }),
|
|
68295
|
-
/* @__PURE__ */ jsx(
|
|
68296
|
-
EditAutomation,
|
|
68297
|
-
{
|
|
68298
|
-
iconDefinitions: mergedIconDefinitions,
|
|
68299
|
-
setOpenEditAutomationPopup,
|
|
68300
|
-
logoUrl,
|
|
68301
|
-
getExtraMergeFields,
|
|
68302
|
-
onBeforeSchedule
|
|
68303
|
-
}
|
|
68304
|
-
)
|
|
68305
|
-
]
|
|
68306
|
-
}
|
|
68307
|
-
)
|
|
68308
|
-
}
|
|
68309
|
-
);
|
|
68310
|
-
const renderCancelAutomationDialog = () => /* @__PURE__ */ jsx(
|
|
68311
|
-
Dialog,
|
|
68312
|
-
{
|
|
68313
|
-
open: cancelAutomationConfirmationPopup,
|
|
68314
|
-
onOpenChange: setCancelAutomationConfirmationPopup,
|
|
68315
|
-
children: /* @__PURE__ */ jsxs(DialogContent, { className: "sm:max-w-[425px]", children: [
|
|
68316
|
-
/* @__PURE__ */ jsx(DialogTitle, { className: "text-xl font-semibold", children: "Cancel Automation" }),
|
|
68317
|
-
/* @__PURE__ */ jsx(DialogDescription, { className: "text-gray-600 mt-2 text-center", children: "Are you sure you want to cancel this automation? This action cannot be undone." }),
|
|
68318
|
-
/* @__PURE__ */ jsxs("div", { className: "flex justify-center gap-3 mt-6", children: [
|
|
68319
|
-
/* @__PURE__ */ jsx(
|
|
68320
|
-
Button$1,
|
|
68321
|
-
{
|
|
68322
|
-
variant: "outline",
|
|
68323
|
-
onClick: () => setCancelAutomationConfirmationPopup(false),
|
|
68324
|
-
children: "Keep Running"
|
|
68325
|
-
}
|
|
68326
|
-
),
|
|
68327
|
-
/* @__PURE__ */ jsx(Button$1, { variant: "destructive", onClick: handleCancelAutomation, children: "Yes, Cancel Automation" })
|
|
68328
|
-
] })
|
|
68329
|
-
] })
|
|
68330
|
-
}
|
|
68331
|
-
);
|
|
68332
|
-
const renderPreviewSmsDialog = () => /* @__PURE__ */ jsx(
|
|
68333
|
-
Dialog,
|
|
68334
|
-
{
|
|
68335
|
-
open: openSendPreviewSmsPopup,
|
|
68336
|
-
onOpenChange: setOpenSendPreviewSmsPopup,
|
|
68337
|
-
children: /* @__PURE__ */ jsxs(DialogContent, { children: [
|
|
68338
|
-
/* @__PURE__ */ jsxs(VisuallyHidden$2, { children: [
|
|
68339
|
-
/* @__PURE__ */ jsx(DialogTitle, { children: "Send Preview SMS" }),
|
|
68340
|
-
/* @__PURE__ */ jsx(DialogDescription, { children: "Send a preview SMS to the automation." })
|
|
68341
|
-
] }),
|
|
68342
|
-
/* @__PURE__ */ jsx(
|
|
68343
|
-
SendPreviewPopup,
|
|
68344
|
-
{
|
|
68345
|
-
automation: automation2,
|
|
68346
|
-
type: "sms",
|
|
68347
|
-
setOpenSendPreviewPopup: setOpenSendPreviewSmsPopup,
|
|
68348
|
-
iconDefinitions: mergedIconDefinitions
|
|
68349
|
-
}
|
|
68350
|
-
)
|
|
68351
|
-
] })
|
|
68352
|
-
}
|
|
68353
|
-
);
|
|
68354
|
-
const renderPreviewEmailDialog = () => /* @__PURE__ */ jsx(
|
|
68355
|
-
Dialog,
|
|
68356
|
-
{
|
|
68357
|
-
open: openSendPreviewEmailPopup,
|
|
68358
|
-
onOpenChange: setOpenSendPreviewEmailPopup,
|
|
68359
|
-
children: /* @__PURE__ */ jsxs(DialogContent, { children: [
|
|
68360
|
-
/* @__PURE__ */ jsxs(VisuallyHidden$2, { children: [
|
|
68361
|
-
/* @__PURE__ */ jsx(DialogTitle, { children: "Send Preview Email" }),
|
|
68362
|
-
/* @__PURE__ */ jsx(DialogDescription, { children: "Send a preview email to the automation." })
|
|
68363
|
-
] }),
|
|
68364
|
-
/* @__PURE__ */ jsx(
|
|
68365
|
-
SendPreviewPopup,
|
|
68366
|
-
{
|
|
68367
|
-
automation: automation2,
|
|
68368
|
-
type: "email",
|
|
68369
|
-
setOpenSendPreviewPopup: setOpenSendPreviewEmailPopup,
|
|
68370
|
-
iconDefinitions: mergedIconDefinitions
|
|
68371
|
-
}
|
|
68372
|
-
)
|
|
68373
|
-
] })
|
|
68374
|
-
}
|
|
68375
|
-
);
|
|
68376
68389
|
const renderBackButton = () => {
|
|
68377
68390
|
if (!showBackButton) return null;
|
|
68378
68391
|
return /* @__PURE__ */ jsx("div", { className: "flex justify-between items-start mb-4", children: /* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsx(Button$1, { onClick: () => navigate(-1), children: "Back" }) }) });
|
|
@@ -68448,10 +68461,46 @@ const ViewAutomationHeaderContainer = ({
|
|
|
68448
68461
|
] })
|
|
68449
68462
|
] }) });
|
|
68450
68463
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
68451
|
-
|
|
68452
|
-
|
|
68453
|
-
|
|
68454
|
-
|
|
68464
|
+
/* @__PURE__ */ jsx(
|
|
68465
|
+
EditAutomationDialog,
|
|
68466
|
+
{
|
|
68467
|
+
open: openEditAutomationPopup,
|
|
68468
|
+
onOpenChange: handleEditDialogChange,
|
|
68469
|
+
iconDefinitions: mergedIconDefinitions,
|
|
68470
|
+
setOpenEditAutomationPopup,
|
|
68471
|
+
logoUrl,
|
|
68472
|
+
getExtraMergeFields,
|
|
68473
|
+
onBeforeSchedule
|
|
68474
|
+
}
|
|
68475
|
+
),
|
|
68476
|
+
/* @__PURE__ */ jsx(
|
|
68477
|
+
CancelAutomationDialog,
|
|
68478
|
+
{
|
|
68479
|
+
open: cancelAutomationConfirmationPopup,
|
|
68480
|
+
onOpenChange: setCancelAutomationConfirmationPopup,
|
|
68481
|
+
onCancel: handleCancelAutomation
|
|
68482
|
+
}
|
|
68483
|
+
),
|
|
68484
|
+
/* @__PURE__ */ jsx(
|
|
68485
|
+
PreviewSmsDialog,
|
|
68486
|
+
{
|
|
68487
|
+
open: openSendPreviewSmsPopup,
|
|
68488
|
+
onOpenChange: setOpenSendPreviewSmsPopup,
|
|
68489
|
+
automation: automation2,
|
|
68490
|
+
iconDefinitions: mergedIconDefinitions,
|
|
68491
|
+
setOpenSendPreviewPopup: setOpenSendPreviewSmsPopup
|
|
68492
|
+
}
|
|
68493
|
+
),
|
|
68494
|
+
/* @__PURE__ */ jsx(
|
|
68495
|
+
PreviewEmailDialog,
|
|
68496
|
+
{
|
|
68497
|
+
open: openSendPreviewEmailPopup,
|
|
68498
|
+
onOpenChange: setOpenSendPreviewEmailPopup,
|
|
68499
|
+
automation: automation2,
|
|
68500
|
+
iconDefinitions: mergedIconDefinitions,
|
|
68501
|
+
setOpenSendPreviewPopup: setOpenSendPreviewEmailPopup
|
|
68502
|
+
}
|
|
68503
|
+
),
|
|
68455
68504
|
/* @__PURE__ */ jsxs("div", { className: "p-6 border-b border-gray-200 bg-background", children: [
|
|
68456
68505
|
renderBackButton(),
|
|
68457
68506
|
renderHeaderInfo(),
|
|
@@ -68460,7 +68509,7 @@ const ViewAutomationHeaderContainer = ({
|
|
|
68460
68509
|
] });
|
|
68461
68510
|
};
|
|
68462
68511
|
const ViewAutomationHeader = React__default.memo(ViewAutomationHeaderContainer);
|
|
68463
|
-
const
|
|
68512
|
+
const ViewAutomationMain = ({
|
|
68464
68513
|
autoOpenEditPopup,
|
|
68465
68514
|
showBackButton = false,
|
|
68466
68515
|
logoUrl,
|
|
@@ -68533,7 +68582,7 @@ const ViewAutomationContent = ({ ...props }) => {
|
|
|
68533
68582
|
const shouldAutoOpenEditPopup = props.autoOpenEditPopup || searchParams.get("autoOpenEditPopup");
|
|
68534
68583
|
const shouldShowBackButton = searchParams.get("showBackButton") === "true" || props.showBackButton;
|
|
68535
68584
|
return /* @__PURE__ */ jsx(ViewAutomationProvider, { automationId: effectiveAutomationId, children: /* @__PURE__ */ jsx("div", { className: "bg-background", children: /* @__PURE__ */ jsx(
|
|
68536
|
-
|
|
68585
|
+
ViewAutomationMain,
|
|
68537
68586
|
{
|
|
68538
68587
|
...props,
|
|
68539
68588
|
autoOpenEditPopup: shouldAutoOpenEditPopup,
|