@embedreach/components 0.1.88 → 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 +526 -469
- package/dist/index.umd.js +111 -111
- package/package.json +1 -1
package/dist/chunks/index.js
CHANGED
|
@@ -45317,14 +45317,16 @@ const BasicLoader = ({
|
|
|
45317
45317
|
] });
|
|
45318
45318
|
};
|
|
45319
45319
|
const BlurDiv = ({ children: children2, className: className2 }) => {
|
|
45320
|
-
return (
|
|
45321
|
-
|
|
45322
|
-
|
|
45323
|
-
|
|
45324
|
-
|
|
45325
|
-
|
|
45326
|
-
|
|
45327
|
-
|
|
45320
|
+
return /* @__PURE__ */ jsx(
|
|
45321
|
+
motion.div,
|
|
45322
|
+
{
|
|
45323
|
+
initial: { opacity: 0, filter: "blur(8px)" },
|
|
45324
|
+
animate: { opacity: 1, filter: "blur(0px)" },
|
|
45325
|
+
exit: { opacity: 0, filter: "blur(8px)" },
|
|
45326
|
+
transition: { duration: 0.3, ease: "easeInOut" },
|
|
45327
|
+
className: className2,
|
|
45328
|
+
children: children2
|
|
45329
|
+
}
|
|
45328
45330
|
);
|
|
45329
45331
|
};
|
|
45330
45332
|
const IconDefinitions = {
|
|
@@ -62826,87 +62828,6 @@ const useSendTestCommunication = () => {
|
|
|
62826
62828
|
isSendSuccess: sendTestCommunicationMutation.isSuccess
|
|
62827
62829
|
};
|
|
62828
62830
|
};
|
|
62829
|
-
var AutomationSteps = /* @__PURE__ */ ((AutomationSteps2) => {
|
|
62830
|
-
AutomationSteps2[AutomationSteps2["SelectTrigger"] = 0] = "SelectTrigger";
|
|
62831
|
-
AutomationSteps2[AutomationSteps2["SelectAudience"] = 1] = "SelectAudience";
|
|
62832
|
-
AutomationSteps2[AutomationSteps2["SelectCommunication"] = 2] = "SelectCommunication";
|
|
62833
|
-
AutomationSteps2[AutomationSteps2["PreviewAndSchedule"] = 3] = "PreviewAndSchedule";
|
|
62834
|
-
return AutomationSteps2;
|
|
62835
|
-
})(AutomationSteps || {});
|
|
62836
|
-
const validateAutomationStep = async (args) => {
|
|
62837
|
-
const { currentStep, automation: automation2, communicationGroup } = args;
|
|
62838
|
-
if (currentStep === 0) {
|
|
62839
|
-
return {
|
|
62840
|
-
canMove: true,
|
|
62841
|
-
errorMessage: null
|
|
62842
|
-
};
|
|
62843
|
-
}
|
|
62844
|
-
if (currentStep === 1) {
|
|
62845
|
-
return {
|
|
62846
|
-
canMove: automation2.includeSegmentIds.length > 0,
|
|
62847
|
-
errorMessage: "Please ensure you have selected at least one segment"
|
|
62848
|
-
};
|
|
62849
|
-
}
|
|
62850
|
-
if (currentStep === 2) {
|
|
62851
|
-
const actionDataCommunication = automation2.action_data?.find(
|
|
62852
|
-
(action) => action.action_type === "send_communication"
|
|
62853
|
-
);
|
|
62854
|
-
if (!actionDataCommunication) {
|
|
62855
|
-
return {
|
|
62856
|
-
canMove: false,
|
|
62857
|
-
errorMessage: "Please ensure you have selected either a email communication or text communication"
|
|
62858
|
-
};
|
|
62859
|
-
}
|
|
62860
|
-
if (!communicationGroup || !communicationGroup.sms_channel_sender_id && !communicationGroup.email_channel_sender_id) {
|
|
62861
|
-
return {
|
|
62862
|
-
canMove: false,
|
|
62863
|
-
errorMessage: "Please ensure you have selected either a email communication or text communication"
|
|
62864
|
-
};
|
|
62865
|
-
}
|
|
62866
|
-
if (communicationGroup.email_channel_sender_id) {
|
|
62867
|
-
if (!communicationGroup.email_html_body || !communicationGroup.email_subject) {
|
|
62868
|
-
return {
|
|
62869
|
-
canMove: false,
|
|
62870
|
-
errorMessage: "Please ensure you have a email body and subject"
|
|
62871
|
-
};
|
|
62872
|
-
}
|
|
62873
|
-
}
|
|
62874
|
-
if (communicationGroup.sms_channel_sender_id) {
|
|
62875
|
-
if (!communicationGroup.sms_message_body) {
|
|
62876
|
-
return {
|
|
62877
|
-
canMove: false,
|
|
62878
|
-
errorMessage: "Please ensure you have a sms message body"
|
|
62879
|
-
};
|
|
62880
|
-
}
|
|
62881
|
-
}
|
|
62882
|
-
}
|
|
62883
|
-
if (currentStep === 3) {
|
|
62884
|
-
const isOneTime = isOneTimeTriggerMetadata(automation2.trigger_metadata);
|
|
62885
|
-
if (isOneTime) {
|
|
62886
|
-
const oneTimeMetadata = automation2.trigger_metadata;
|
|
62887
|
-
return {
|
|
62888
|
-
canMove: Boolean(
|
|
62889
|
-
oneTimeMetadata.scheduled_at && new Date(oneTimeMetadata.scheduled_at) > /* @__PURE__ */ new Date() && automation2.action_data?.some(
|
|
62890
|
-
(action) => action.action_type === "send_communication" && action.action_metadata.communication_group_id
|
|
62891
|
-
)
|
|
62892
|
-
),
|
|
62893
|
-
errorMessage: "Please ensure you have set a valid future date for your one-time automation"
|
|
62894
|
-
};
|
|
62895
|
-
}
|
|
62896
|
-
return {
|
|
62897
|
-
canMove: Boolean(
|
|
62898
|
-
automation2.action_data?.some(
|
|
62899
|
-
(action) => action.action_type === "send_communication" && action.action_metadata.communication_group_id
|
|
62900
|
-
)
|
|
62901
|
-
),
|
|
62902
|
-
errorMessage: null
|
|
62903
|
-
};
|
|
62904
|
-
}
|
|
62905
|
-
return {
|
|
62906
|
-
canMove: true,
|
|
62907
|
-
errorMessage: null
|
|
62908
|
-
};
|
|
62909
|
-
};
|
|
62910
62831
|
const useRecipientStats = (automation2) => {
|
|
62911
62832
|
const { data: estimatedMatches } = useGetCountOfBusinessAutomationRecipients({
|
|
62912
62833
|
include_segments: automation2?.includeSegmentIds ?? [],
|
|
@@ -62927,29 +62848,66 @@ const useRecipientStats = (automation2) => {
|
|
|
62927
62848
|
estimatedMatchesStats
|
|
62928
62849
|
};
|
|
62929
62850
|
};
|
|
62930
|
-
const
|
|
62851
|
+
const AutomationContext = createContext$1(
|
|
62852
|
+
null
|
|
62853
|
+
);
|
|
62854
|
+
const useAutomation = () => {
|
|
62855
|
+
const context2 = useContext$1(AutomationContext);
|
|
62856
|
+
if (!context2) {
|
|
62857
|
+
throw new Error(
|
|
62858
|
+
"useAutomation must be used within a ViewAutomationProvider"
|
|
62859
|
+
);
|
|
62860
|
+
}
|
|
62861
|
+
return context2;
|
|
62862
|
+
};
|
|
62863
|
+
const CommunicationContext = createContext$1(null);
|
|
62864
|
+
const useCommunication = () => {
|
|
62865
|
+
const context2 = useContext$1(CommunicationContext);
|
|
62866
|
+
if (!context2) {
|
|
62867
|
+
throw new Error(
|
|
62868
|
+
"useCommunication must be used within a ViewAutomationProvider"
|
|
62869
|
+
);
|
|
62870
|
+
}
|
|
62871
|
+
return context2;
|
|
62872
|
+
};
|
|
62873
|
+
const LoadingContext = createContext$1(null);
|
|
62874
|
+
const useLoading = () => {
|
|
62875
|
+
const context2 = useContext$1(LoadingContext);
|
|
62876
|
+
if (!context2) {
|
|
62877
|
+
throw new Error("useLoading must be used within a ViewAutomationProvider");
|
|
62878
|
+
}
|
|
62879
|
+
return context2;
|
|
62880
|
+
};
|
|
62881
|
+
const ValidationContext = createContext$1(
|
|
62882
|
+
null
|
|
62883
|
+
);
|
|
62884
|
+
const useValidation = () => {
|
|
62885
|
+
const context2 = useContext$1(ValidationContext);
|
|
62886
|
+
if (!context2) {
|
|
62887
|
+
throw new Error(
|
|
62888
|
+
"useValidation must be used within a ViewAutomationProvider"
|
|
62889
|
+
);
|
|
62890
|
+
}
|
|
62891
|
+
return context2;
|
|
62892
|
+
};
|
|
62893
|
+
const ViewAutomationProvider = ({
|
|
62894
|
+
automationId,
|
|
62895
|
+
existingAutomation,
|
|
62896
|
+
children: children2
|
|
62897
|
+
}) => {
|
|
62931
62898
|
const mountedRef = useRef(true);
|
|
62932
|
-
const
|
|
62933
|
-
const
|
|
62934
|
-
automation: fetchedAutomation,
|
|
62935
|
-
isLoading: isFetchLoading,
|
|
62936
|
-
invalidateAutomation: originalInvalidateAutomation
|
|
62937
|
-
} = useGetBusinessAutomation(automationId);
|
|
62938
|
-
const automation2 = fetchedAutomation;
|
|
62939
|
-
const { updateAutomation: updateAutomation2, isUpdating } = useUpdateBusinessAutomation(automationId);
|
|
62899
|
+
const { automation: fetchedAutomation, isLoading: isFetchLoading } = useGetBusinessAutomation(automationId);
|
|
62900
|
+
const automation2 = existingAutomation || fetchedAutomation;
|
|
62940
62901
|
const communicationGroupId = automation2?.action_data?.find(
|
|
62941
62902
|
(action) => action.action_type === "send_communication"
|
|
62942
62903
|
)?.action_metadata.communication_group_id;
|
|
62904
|
+
const { isUpdating } = useUpdateBusinessAutomation(automationId);
|
|
62943
62905
|
const { communicationGroup, isGetting: isLoadingCommunicationGroup } = useGetCommunicationGroup(communicationGroupId || void 0);
|
|
62944
|
-
const { updateCommunicationGroup: updateCommunicationGroup2, isUpdating: isUpdatingCommunicationGroup } = useUpdateCommunicationGroup();
|
|
62945
62906
|
const { estimatedMatchesStats } = useRecipientStats(automation2);
|
|
62946
|
-
const
|
|
62907
|
+
const { isUpdating: isUpdatingCommunicationGroup } = useUpdateCommunicationGroup();
|
|
62947
62908
|
const [isLoading, setIsLoading] = useState(false);
|
|
62948
|
-
const invalidateAutomation = useCallback(() => {
|
|
62949
|
-
originalInvalidateAutomation();
|
|
62950
|
-
}, [originalInvalidateAutomation]);
|
|
62951
62909
|
useEffect(() => {
|
|
62952
|
-
const loadingState = (isFetchLoading || isUpdating || isLoadingCommunicationGroup ||
|
|
62910
|
+
const loadingState = (!existingAutomation && isFetchLoading || isUpdating || isLoadingCommunicationGroup || isUpdatingCommunicationGroup) && mountedRef.current;
|
|
62953
62911
|
setIsLoading(loadingState);
|
|
62954
62912
|
}, [
|
|
62955
62913
|
existingAutomation,
|
|
@@ -62957,54 +62915,46 @@ const useAutomation = (automationId, existingAutomation) => {
|
|
|
62957
62915
|
isFetchLoading,
|
|
62958
62916
|
isUpdating,
|
|
62959
62917
|
isLoadingCommunicationGroup,
|
|
62960
|
-
|
|
62961
|
-
isUpdatingCommunicationGroup,
|
|
62962
|
-
manualLoading
|
|
62918
|
+
isUpdatingCommunicationGroup
|
|
62963
62919
|
]);
|
|
62964
62920
|
useEffect(() => {
|
|
62965
62921
|
return () => {
|
|
62966
62922
|
mountedRef.current = false;
|
|
62967
62923
|
};
|
|
62968
62924
|
}, []);
|
|
62969
|
-
|
|
62970
|
-
|
|
62971
|
-
|
|
62972
|
-
|
|
62973
|
-
|
|
62974
|
-
|
|
62975
|
-
|
|
62976
|
-
|
|
62977
|
-
|
|
62978
|
-
|
|
62979
|
-
|
|
62980
|
-
|
|
62981
|
-
|
|
62982
|
-
|
|
62983
|
-
|
|
62984
|
-
|
|
62985
|
-
|
|
62986
|
-
|
|
62925
|
+
return /* @__PURE__ */ jsx(
|
|
62926
|
+
AutomationContext.Provider,
|
|
62927
|
+
{
|
|
62928
|
+
value: {
|
|
62929
|
+
automation: automation2
|
|
62930
|
+
},
|
|
62931
|
+
children: /* @__PURE__ */ jsx(
|
|
62932
|
+
CommunicationContext.Provider,
|
|
62933
|
+
{
|
|
62934
|
+
value: {
|
|
62935
|
+
communicationGroup
|
|
62936
|
+
},
|
|
62937
|
+
children: /* @__PURE__ */ jsx(
|
|
62938
|
+
LoadingContext.Provider,
|
|
62939
|
+
{
|
|
62940
|
+
value: {
|
|
62941
|
+
isLoading
|
|
62942
|
+
},
|
|
62943
|
+
children: /* @__PURE__ */ jsx(
|
|
62944
|
+
ValidationContext.Provider,
|
|
62945
|
+
{
|
|
62946
|
+
value: {
|
|
62947
|
+
estimatedMatchesStats
|
|
62948
|
+
},
|
|
62949
|
+
children: children2
|
|
62950
|
+
}
|
|
62951
|
+
)
|
|
62952
|
+
}
|
|
62953
|
+
)
|
|
62987
62954
|
}
|
|
62988
|
-
|
|
62989
|
-
},
|
|
62990
|
-
[automation2, communicationGroup]
|
|
62991
|
-
);
|
|
62992
|
-
const setIsLoadingSafe = useCallback((loading2) => {
|
|
62993
|
-
if (mountedRef.current) {
|
|
62994
|
-
setManualLoading(loading2);
|
|
62955
|
+
)
|
|
62995
62956
|
}
|
|
62996
|
-
|
|
62997
|
-
return {
|
|
62998
|
-
automation: automation2,
|
|
62999
|
-
updateAutomation: updateAutomation2,
|
|
63000
|
-
communicationGroup,
|
|
63001
|
-
updateCommunicationGroup: updateCommunicationGroup2,
|
|
63002
|
-
isLoading,
|
|
63003
|
-
setIsLoading: setIsLoadingSafe,
|
|
63004
|
-
invalidateAutomation,
|
|
63005
|
-
validateStep,
|
|
63006
|
-
estimatedMatchesStats
|
|
63007
|
-
};
|
|
62957
|
+
);
|
|
63008
62958
|
};
|
|
63009
62959
|
const getChannelSenders = async () => {
|
|
63010
62960
|
const response = await baseRequest(
|
|
@@ -63289,13 +63239,13 @@ ${smsPreview.body}` : smsPreview.body
|
|
|
63289
63239
|
};
|
|
63290
63240
|
const AutomationContent = ({
|
|
63291
63241
|
iconDefinitions,
|
|
63292
|
-
isLoading: isLoadingCommunicationGroup
|
|
63293
|
-
communicationGroup
|
|
63242
|
+
isLoading: isLoadingCommunicationGroup
|
|
63294
63243
|
}) => {
|
|
63295
63244
|
const { channelSenders } = useChannelSender();
|
|
63296
63245
|
const [emailData, setEmailData] = useState(null);
|
|
63297
63246
|
const [smsData, setSmsData] = useState(null);
|
|
63298
63247
|
const [loading2, setLoading2] = useState(false);
|
|
63248
|
+
const { communicationGroup } = useCommunication();
|
|
63299
63249
|
useEffect(() => {
|
|
63300
63250
|
if (!communicationGroup || !channelSenders) {
|
|
63301
63251
|
setLoading2(false);
|
|
@@ -65039,6 +64989,20 @@ const DropdownMenuSeparator = React.forwardRef(({ className: className2, ...prop
|
|
|
65039
64989
|
}
|
|
65040
64990
|
));
|
|
65041
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
|
+
};
|
|
65042
65006
|
const stepIndicatorContainer = "reach-styles-module__stepIndicatorContainer___FoKXB";
|
|
65043
65007
|
const iconContainer = "reach-styles-module__iconContainer___Ki-1n";
|
|
65044
65008
|
const checkIcon = "reach-styles-module__checkIcon___-krUS";
|
|
@@ -65088,6 +65052,87 @@ const StepIndicator = ({
|
|
|
65088
65052
|
)
|
|
65089
65053
|
] });
|
|
65090
65054
|
};
|
|
65055
|
+
var AutomationSteps = /* @__PURE__ */ ((AutomationSteps2) => {
|
|
65056
|
+
AutomationSteps2[AutomationSteps2["SelectTrigger"] = 0] = "SelectTrigger";
|
|
65057
|
+
AutomationSteps2[AutomationSteps2["SelectAudience"] = 1] = "SelectAudience";
|
|
65058
|
+
AutomationSteps2[AutomationSteps2["SelectCommunication"] = 2] = "SelectCommunication";
|
|
65059
|
+
AutomationSteps2[AutomationSteps2["PreviewAndSchedule"] = 3] = "PreviewAndSchedule";
|
|
65060
|
+
return AutomationSteps2;
|
|
65061
|
+
})(AutomationSteps || {});
|
|
65062
|
+
const validateAutomationStep = async (args) => {
|
|
65063
|
+
const { currentStep, automation: automation2, communicationGroup } = args;
|
|
65064
|
+
if (currentStep === 0) {
|
|
65065
|
+
return {
|
|
65066
|
+
canMove: true,
|
|
65067
|
+
errorMessage: null
|
|
65068
|
+
};
|
|
65069
|
+
}
|
|
65070
|
+
if (currentStep === 1) {
|
|
65071
|
+
return {
|
|
65072
|
+
canMove: automation2.includeSegmentIds.length > 0,
|
|
65073
|
+
errorMessage: "Please ensure you have selected at least one segment"
|
|
65074
|
+
};
|
|
65075
|
+
}
|
|
65076
|
+
if (currentStep === 2) {
|
|
65077
|
+
const actionDataCommunication = automation2.action_data?.find(
|
|
65078
|
+
(action) => action.action_type === "send_communication"
|
|
65079
|
+
);
|
|
65080
|
+
if (!actionDataCommunication) {
|
|
65081
|
+
return {
|
|
65082
|
+
canMove: false,
|
|
65083
|
+
errorMessage: "Please ensure you have selected either a email communication or text communication"
|
|
65084
|
+
};
|
|
65085
|
+
}
|
|
65086
|
+
if (!communicationGroup || !communicationGroup.sms_channel_sender_id && !communicationGroup.email_channel_sender_id) {
|
|
65087
|
+
return {
|
|
65088
|
+
canMove: false,
|
|
65089
|
+
errorMessage: "Please ensure you have selected either a email communication or text communication"
|
|
65090
|
+
};
|
|
65091
|
+
}
|
|
65092
|
+
if (communicationGroup.email_channel_sender_id) {
|
|
65093
|
+
if (!communicationGroup.email_html_body || !communicationGroup.email_subject) {
|
|
65094
|
+
return {
|
|
65095
|
+
canMove: false,
|
|
65096
|
+
errorMessage: "Please ensure you have a email body and subject"
|
|
65097
|
+
};
|
|
65098
|
+
}
|
|
65099
|
+
}
|
|
65100
|
+
if (communicationGroup.sms_channel_sender_id) {
|
|
65101
|
+
if (!communicationGroup.sms_message_body) {
|
|
65102
|
+
return {
|
|
65103
|
+
canMove: false,
|
|
65104
|
+
errorMessage: "Please ensure you have a sms message body"
|
|
65105
|
+
};
|
|
65106
|
+
}
|
|
65107
|
+
}
|
|
65108
|
+
}
|
|
65109
|
+
if (currentStep === 3) {
|
|
65110
|
+
const isOneTime = isOneTimeTriggerMetadata(automation2.trigger_metadata);
|
|
65111
|
+
if (isOneTime) {
|
|
65112
|
+
const oneTimeMetadata = automation2.trigger_metadata;
|
|
65113
|
+
return {
|
|
65114
|
+
canMove: Boolean(
|
|
65115
|
+
oneTimeMetadata.scheduled_at && new Date(oneTimeMetadata.scheduled_at) > /* @__PURE__ */ new Date() && automation2.action_data?.some(
|
|
65116
|
+
(action) => action.action_type === "send_communication" && action.action_metadata.communication_group_id
|
|
65117
|
+
)
|
|
65118
|
+
),
|
|
65119
|
+
errorMessage: "Please ensure you have set a valid future date for your one-time automation"
|
|
65120
|
+
};
|
|
65121
|
+
}
|
|
65122
|
+
return {
|
|
65123
|
+
canMove: Boolean(
|
|
65124
|
+
automation2.action_data?.some(
|
|
65125
|
+
(action) => action.action_type === "send_communication" && action.action_metadata.communication_group_id
|
|
65126
|
+
)
|
|
65127
|
+
),
|
|
65128
|
+
errorMessage: null
|
|
65129
|
+
};
|
|
65130
|
+
}
|
|
65131
|
+
return {
|
|
65132
|
+
canMove: true,
|
|
65133
|
+
errorMessage: null
|
|
65134
|
+
};
|
|
65135
|
+
};
|
|
65091
65136
|
const mergeFieldTemplateCreator = (args) => {
|
|
65092
65137
|
const { mergeFieldName } = args;
|
|
65093
65138
|
return `{{${mergeFieldName}}}`;
|
|
@@ -65383,24 +65428,28 @@ const StripoWrapper = ({
|
|
|
65383
65428
|
}
|
|
65384
65429
|
) });
|
|
65385
65430
|
};
|
|
65386
|
-
const EmailPreview = ({
|
|
65387
|
-
|
|
65388
|
-
|
|
65389
|
-
|
|
65390
|
-
|
|
65391
|
-
|
|
65431
|
+
const EmailPreview = ({ mergeFieldsResponse }) => {
|
|
65432
|
+
const { communicationGroup } = useCommunication();
|
|
65433
|
+
const { automation: automation2 } = useAutomation();
|
|
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();
|
|
65392
65441
|
const [isUpdating, setIsUpdating] = useState(false);
|
|
65393
65442
|
const [fromEmail, setFromEmail] = useState(
|
|
65394
|
-
communicationGroup
|
|
65443
|
+
communicationGroup?.email_channel_sender_id || null
|
|
65395
65444
|
);
|
|
65396
65445
|
const [subject, setSubject] = useState(
|
|
65397
|
-
communicationGroup
|
|
65446
|
+
communicationGroup?.email_subject || null
|
|
65398
65447
|
);
|
|
65399
65448
|
const [previewText, setPreviewText] = useState(
|
|
65400
|
-
communicationGroup
|
|
65449
|
+
communicationGroup?.email_preview_text || null
|
|
65401
65450
|
);
|
|
65402
65451
|
const [body, setBody] = useState(
|
|
65403
|
-
communicationGroup
|
|
65452
|
+
communicationGroup?.email_html_body || null
|
|
65404
65453
|
);
|
|
65405
65454
|
const [showStripoEditor, setShowStripoEditor] = useState(false);
|
|
65406
65455
|
const [saveClicked, setSaveClicked] = useState(false);
|
|
@@ -65409,20 +65458,19 @@ const EmailPreview = ({
|
|
|
65409
65458
|
const [replyToEmailError, setReplyToEmailError] = useState(
|
|
65410
65459
|
null
|
|
65411
65460
|
);
|
|
65412
|
-
const { refetchAutomation: refreshAutomation } = useGetBusinessAutomation(
|
|
65413
|
-
automation2.id
|
|
65414
|
-
);
|
|
65415
65461
|
const [showHelpDialog, setShowHelpDialog] = useState(false);
|
|
65416
65462
|
const initialRenderRef = useRef(true);
|
|
65417
65463
|
const [isFormLoading, setIsFormLoading] = useState(true);
|
|
65418
65464
|
const [userModifiedEmail, setUserModifiedEmail] = useState(false);
|
|
65465
|
+
const [stripoDialogDimensions, setStripoDialogDimensions] = useState({
|
|
65466
|
+
width: 0,
|
|
65467
|
+
height: 0
|
|
65468
|
+
});
|
|
65469
|
+
const [updatingField, setUpdatingField] = useState(null);
|
|
65419
65470
|
const debouncedSubject = useDebounce(subject, 500);
|
|
65420
65471
|
const debouncedPreviewText = useDebounce(previewText, 500);
|
|
65421
65472
|
const debouncedFromName = useDebounce(fromName, 500);
|
|
65422
65473
|
const debouncedReplyToEmail = useDebounce(replyToEmail, 500);
|
|
65423
|
-
const { channelSenders } = useChannelSender();
|
|
65424
|
-
const { channelAccounts } = useChannelAccount();
|
|
65425
|
-
const { updateChannelSender: updateChannelSender2 } = useUpdateChannelSender();
|
|
65426
65474
|
const emailChannelSendersWithChannelAccounts = useMemo(
|
|
65427
65475
|
() => channelSenders?.results?.filter((sender) => sender.channel_sender_metadata.userPart)?.flatMap((sender) => {
|
|
65428
65476
|
const channelAccount = channelAccounts?.results?.find(
|
|
@@ -65441,10 +65489,6 @@ const EmailPreview = ({
|
|
|
65441
65489
|
}) || [],
|
|
65442
65490
|
[channelSenders?.results, channelAccounts?.results]
|
|
65443
65491
|
);
|
|
65444
|
-
const [stripoDialogDimensions, setStripoDialogDimensions] = useState({
|
|
65445
|
-
width: 0,
|
|
65446
|
-
height: 0
|
|
65447
|
-
});
|
|
65448
65492
|
const emailPreviewDimensions = useMemo(
|
|
65449
65493
|
() => ({
|
|
65450
65494
|
width: 800,
|
|
@@ -65460,10 +65504,10 @@ const EmailPreview = ({
|
|
|
65460
65504
|
return () => clearTimeout(timer);
|
|
65461
65505
|
}, []);
|
|
65462
65506
|
useEffect(() => {
|
|
65463
|
-
if (communicationGroup
|
|
65507
|
+
if (communicationGroup?.email_html_body) {
|
|
65464
65508
|
setBody(communicationGroup.email_html_body);
|
|
65465
65509
|
}
|
|
65466
|
-
}, [communicationGroup
|
|
65510
|
+
}, [communicationGroup?.email_html_body, refreshAutomation]);
|
|
65467
65511
|
useEffect(() => {
|
|
65468
65512
|
if (isUpdating) {
|
|
65469
65513
|
const timer = setTimeout(() => {
|
|
@@ -65486,7 +65530,7 @@ const EmailPreview = ({
|
|
|
65486
65530
|
};
|
|
65487
65531
|
}, []);
|
|
65488
65532
|
useEffect(() => {
|
|
65489
|
-
if (!initialRenderRef.current && fromEmail && debouncedSubject && body && communicationGroup
|
|
65533
|
+
if (!initialRenderRef.current && fromEmail && debouncedSubject && body && communicationGroup?.id) {
|
|
65490
65534
|
setIsUpdating(true);
|
|
65491
65535
|
const updateGroup = async () => {
|
|
65492
65536
|
try {
|
|
@@ -65514,7 +65558,7 @@ const EmailPreview = ({
|
|
|
65514
65558
|
debouncedSubject,
|
|
65515
65559
|
debouncedPreviewText,
|
|
65516
65560
|
body,
|
|
65517
|
-
communicationGroup
|
|
65561
|
+
communicationGroup?.id,
|
|
65518
65562
|
updateCommunicationGroup2
|
|
65519
65563
|
]);
|
|
65520
65564
|
useEffect(() => {
|
|
@@ -65523,10 +65567,12 @@ const EmailPreview = ({
|
|
|
65523
65567
|
(sender) => sender.id === fromEmail
|
|
65524
65568
|
);
|
|
65525
65569
|
if (channelSender) {
|
|
65526
|
-
setFromName(channelSender.channel_sender_metadata.emailFromName);
|
|
65527
65570
|
if (!userModifiedEmail || isFormLoading) {
|
|
65528
65571
|
setReplyToEmail(channelSender.channel_sender_metadata.emailReplyTo);
|
|
65529
65572
|
}
|
|
65573
|
+
if (isFormLoading) {
|
|
65574
|
+
setFromName(channelSender.channel_sender_metadata.emailFromName);
|
|
65575
|
+
}
|
|
65530
65576
|
setIsFormLoading(false);
|
|
65531
65577
|
}
|
|
65532
65578
|
}
|
|
@@ -65540,7 +65586,7 @@ const EmailPreview = ({
|
|
|
65540
65586
|
const channelSender = allEmailSenders[0];
|
|
65541
65587
|
setFromEmail(channelSender.id);
|
|
65542
65588
|
updateCommunicationGroup2({
|
|
65543
|
-
groupId: communicationGroup
|
|
65589
|
+
groupId: communicationGroup?.id || "",
|
|
65544
65590
|
params: {
|
|
65545
65591
|
email_channel_sender_id: channelSender.id
|
|
65546
65592
|
}
|
|
@@ -65550,12 +65596,12 @@ const EmailPreview = ({
|
|
|
65550
65596
|
}, [
|
|
65551
65597
|
channelSenders?.results,
|
|
65552
65598
|
fromEmail,
|
|
65553
|
-
communicationGroup
|
|
65599
|
+
communicationGroup?.id,
|
|
65554
65600
|
updateCommunicationGroup2
|
|
65555
65601
|
]);
|
|
65556
65602
|
useEffect(() => {
|
|
65557
65603
|
if (!initialRenderRef.current && debouncedFromName && fromEmail) {
|
|
65558
|
-
|
|
65604
|
+
setUpdatingField("fromName");
|
|
65559
65605
|
const updateSender = async () => {
|
|
65560
65606
|
try {
|
|
65561
65607
|
const channelSender = channelSenders?.results?.find(
|
|
@@ -65575,7 +65621,7 @@ const EmailPreview = ({
|
|
|
65575
65621
|
} catch (error2) {
|
|
65576
65622
|
console.error("Error updating from name:", error2);
|
|
65577
65623
|
} finally {
|
|
65578
|
-
|
|
65624
|
+
setUpdatingField(null);
|
|
65579
65625
|
}
|
|
65580
65626
|
};
|
|
65581
65627
|
updateSender();
|
|
@@ -65598,31 +65644,42 @@ const EmailPreview = ({
|
|
|
65598
65644
|
}
|
|
65599
65645
|
}, [debouncedReplyToEmail]);
|
|
65600
65646
|
useEffect(() => {
|
|
65601
|
-
|
|
65602
|
-
|
|
65603
|
-
|
|
65604
|
-
|
|
65605
|
-
|
|
65606
|
-
|
|
65607
|
-
);
|
|
65608
|
-
|
|
65609
|
-
|
|
65610
|
-
|
|
65611
|
-
|
|
65612
|
-
channel_sender_metadata
|
|
65613
|
-
|
|
65614
|
-
emailReplyTo: debouncedReplyToEmail
|
|
65615
|
-
}
|
|
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
|
|
65616
65660
|
}
|
|
65617
|
-
}
|
|
65618
|
-
}
|
|
65619
|
-
} catch (error2) {
|
|
65620
|
-
console.error("Error updating reply-to email:", error2);
|
|
65621
|
-
} finally {
|
|
65622
|
-
setIsUpdating(false);
|
|
65661
|
+
}
|
|
65662
|
+
});
|
|
65623
65663
|
}
|
|
65624
|
-
}
|
|
65625
|
-
|
|
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
|
+
}
|
|
65626
65683
|
}
|
|
65627
65684
|
}, [
|
|
65628
65685
|
debouncedReplyToEmail,
|
|
@@ -65632,10 +65689,10 @@ const EmailPreview = ({
|
|
|
65632
65689
|
replyToEmailError
|
|
65633
65690
|
]);
|
|
65634
65691
|
useEffect(() => {
|
|
65635
|
-
if (showStripoEditor === false && communicationGroup
|
|
65692
|
+
if (showStripoEditor === false && communicationGroup?.id) {
|
|
65636
65693
|
refreshAutomation();
|
|
65637
65694
|
}
|
|
65638
|
-
}, [showStripoEditor, communicationGroup
|
|
65695
|
+
}, [showStripoEditor, communicationGroup?.id, refreshAutomation]);
|
|
65639
65696
|
if (!channelAccounts || !channelSenders) {
|
|
65640
65697
|
return /* @__PURE__ */ jsx("div", { className: "flex justify-center items-center flex-1 h-full bg-white rounded-2xl w-full border border-gray-200 p-6 space-y-4 relative", children: /* @__PURE__ */ jsx(BasicLoader, { text: ["Fetching Email Preview..."] }) });
|
|
65641
65698
|
}
|
|
@@ -65673,7 +65730,7 @@ const EmailPreview = ({
|
|
|
65673
65730
|
}
|
|
65674
65731
|
)
|
|
65675
65732
|
] }),
|
|
65676
|
-
/* @__PURE__ */ jsx("div", { className: " w-full", children: /* @__PURE__ */ jsx(
|
|
65733
|
+
/* @__PURE__ */ jsx("div", { className: " w-full", children: automation2 && /* @__PURE__ */ jsx(
|
|
65677
65734
|
StripoWrapper,
|
|
65678
65735
|
{
|
|
65679
65736
|
showStripoEditor,
|
|
@@ -65736,7 +65793,7 @@ const EmailPreview = ({
|
|
|
65736
65793
|
placeholder: "Enter from name",
|
|
65737
65794
|
value: fromName ?? "",
|
|
65738
65795
|
onChange: (e4) => setFromName(e4.target.value),
|
|
65739
|
-
disabled: isUpdating || !fromEmail || isFormLoading
|
|
65796
|
+
disabled: isUpdating && updatingField !== "fromName" || !fromEmail || isFormLoading
|
|
65740
65797
|
}
|
|
65741
65798
|
)
|
|
65742
65799
|
] }),
|
|
@@ -65757,10 +65814,13 @@ const EmailPreview = ({
|
|
|
65757
65814
|
placeholder: "Enter reply to email",
|
|
65758
65815
|
value: replyToEmail ?? "",
|
|
65759
65816
|
onChange: (e4) => {
|
|
65760
|
-
|
|
65761
|
-
|
|
65817
|
+
const newValue = e4.target.value;
|
|
65818
|
+
setReplyToEmail(newValue);
|
|
65819
|
+
if (!userModifiedEmail) {
|
|
65820
|
+
setUserModifiedEmail(true);
|
|
65821
|
+
}
|
|
65762
65822
|
},
|
|
65763
|
-
disabled: isUpdating || !fromEmail || isFormLoading
|
|
65823
|
+
disabled: isUpdating && updatingField !== "replyToEmail" || !fromEmail || isFormLoading
|
|
65764
65824
|
}
|
|
65765
65825
|
),
|
|
65766
65826
|
replyToEmailError && /* @__PURE__ */ jsx("p", { className: "text-sm text-red-500 mt-1", children: replyToEmailError })
|
|
@@ -66063,20 +66123,14 @@ const useMe = () => {
|
|
|
66063
66123
|
});
|
|
66064
66124
|
return query;
|
|
66065
66125
|
};
|
|
66066
|
-
const SMSPreview = ({
|
|
66067
|
-
const
|
|
66126
|
+
const SMSPreview = ({ iconDefinitions, mergeFieldsResponse }) => {
|
|
66127
|
+
const { automation: automation2 } = useAutomation();
|
|
66068
66128
|
const _getCommunicationGroupFromAutomation = useCallback(() => {
|
|
66069
|
-
const actionGroup = automation2
|
|
66129
|
+
const actionGroup = automation2?.action_data?.find(
|
|
66070
66130
|
(action) => action.action_type === "send_communication"
|
|
66071
66131
|
);
|
|
66072
66132
|
return actionGroup?.action_metadata.communication_group_id;
|
|
66073
|
-
}, [automation2
|
|
66074
|
-
const [mergeFieldValue, setMergeFieldValue] = useState("");
|
|
66075
|
-
const [fromNumber, setFromNumber] = useState(null);
|
|
66076
|
-
const [initCompanyName, setInitCompanyName] = useState(false);
|
|
66077
|
-
const [companyName, setCompanyName] = useState(null);
|
|
66078
|
-
const [message2, setMessage] = useState(null);
|
|
66079
|
-
const [showSmsEditor, setShowSmsEditor] = useState(false);
|
|
66133
|
+
}, [automation2?.action_data]);
|
|
66080
66134
|
const { channelSenders } = useChannelSender();
|
|
66081
66135
|
const { data: me2, isLoading: isMeLoading } = useMe();
|
|
66082
66136
|
const { channelAccounts } = useChannelAccount();
|
|
@@ -66084,6 +66138,13 @@ const SMSPreview = ({ automation: automation2, iconDefinitions, mergeFieldsRespo
|
|
|
66084
66138
|
const { communicationGroup } = useGetCommunicationGroup(
|
|
66085
66139
|
_getCommunicationGroupFromAutomation() ?? void 0
|
|
66086
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);
|
|
66087
66148
|
const inputRef = useRef(null);
|
|
66088
66149
|
const debouncedMessage = useDebounce(message2, 1e3);
|
|
66089
66150
|
const debouncedFromNumber = useDebounce(fromNumber, 1e3);
|
|
@@ -66294,16 +66355,15 @@ ${message2}` : message2
|
|
|
66294
66355
|
] });
|
|
66295
66356
|
};
|
|
66296
66357
|
const EditCampaignContent = ({
|
|
66297
|
-
automation: automation2,
|
|
66298
66358
|
iconDefinitions,
|
|
66299
|
-
getExtraMergeFields
|
|
66300
|
-
communicationGroup,
|
|
66301
|
-
updateAutomation: updateAutomation2,
|
|
66302
|
-
updateCommunicationGroup: updateCommunicationGroup2
|
|
66359
|
+
getExtraMergeFields
|
|
66303
66360
|
}) => {
|
|
66304
66361
|
const [selectedChannels, setSelectedChannels] = useState(null);
|
|
66305
66362
|
const emailContainerRef = useRef(null);
|
|
66306
66363
|
const { toast: toast2 } = useToast();
|
|
66364
|
+
const { communicationGroup } = useCommunication();
|
|
66365
|
+
const { updateCommunicationGroup: updateCommunicationGroup2 } = useUpdateCommunicationGroup();
|
|
66366
|
+
const { automation: automation2 } = useAutomation();
|
|
66307
66367
|
const { getMergeFields: getMergeFields2, isGetting: isGetMergeFieldsLoading } = useGetMergeFields(communicationGroup?.id ?? void 0);
|
|
66308
66368
|
const [mergeFieldsResponse, setMergeFieldsResponse] = useState(void 0);
|
|
66309
66369
|
useEffect(() => {
|
|
@@ -66506,11 +66566,7 @@ const EditCampaignContent = ({
|
|
|
66506
66566
|
/* @__PURE__ */ jsx(
|
|
66507
66567
|
EmailPreview,
|
|
66508
66568
|
{
|
|
66509
|
-
automation: automation2,
|
|
66510
66569
|
iconDefinitions,
|
|
66511
|
-
updateAutomation: updateAutomation2,
|
|
66512
|
-
communicationGroup,
|
|
66513
|
-
updateCommunicationGroup: updateCommunicationGroup2,
|
|
66514
66570
|
mergeFieldsResponse
|
|
66515
66571
|
}
|
|
66516
66572
|
)
|
|
@@ -66522,7 +66578,6 @@ const EditCampaignContent = ({
|
|
|
66522
66578
|
/* @__PURE__ */ jsx(
|
|
66523
66579
|
SMSPreview,
|
|
66524
66580
|
{
|
|
66525
|
-
automation: automation2,
|
|
66526
66581
|
iconDefinitions,
|
|
66527
66582
|
mergeFieldsResponse
|
|
66528
66583
|
}
|
|
@@ -67031,16 +67086,15 @@ const SelectTime = ({ iconDefinitions, automation: automation2, updateAutomation
|
|
|
67031
67086
|
) });
|
|
67032
67087
|
};
|
|
67033
67088
|
const PreviewAndSchedule = ({
|
|
67034
|
-
automation: automation2,
|
|
67035
67089
|
iconDefinitions,
|
|
67036
|
-
isLoading,
|
|
67037
|
-
communicationGroup,
|
|
67038
67090
|
updateAutomation: externalUpdateAutomation
|
|
67039
67091
|
}) => {
|
|
67040
|
-
const {
|
|
67041
|
-
const
|
|
67092
|
+
const { automation: automation2 } = useAutomation();
|
|
67093
|
+
const { communicationGroup } = useCommunication();
|
|
67094
|
+
const { updateAutomation: businessUpdateAutomation } = useUpdateBusinessAutomation(automation2?.id || "");
|
|
67042
67095
|
const { channelSenders } = useChannelSender();
|
|
67043
67096
|
const { channelAccounts } = useChannelAccount();
|
|
67097
|
+
const updateAutomation2 = externalUpdateAutomation || ((params) => businessUpdateAutomation(params));
|
|
67044
67098
|
const [emailPreview, setEmailPreview] = useState(null);
|
|
67045
67099
|
const [smsPreview, setSmsPreview] = useState(null);
|
|
67046
67100
|
const [channelSenderData, setChannelSenderData] = useState(null);
|
|
@@ -67102,7 +67156,7 @@ const PreviewAndSchedule = ({
|
|
|
67102
67156
|
}
|
|
67103
67157
|
}
|
|
67104
67158
|
}, [communicationGroup, channelSenderData, channelAccountsData]);
|
|
67105
|
-
if (
|
|
67159
|
+
if (!automation2) {
|
|
67106
67160
|
return /* @__PURE__ */ jsx(BasicLoader, { text: ["Loading..."] });
|
|
67107
67161
|
}
|
|
67108
67162
|
if (!emailPreview && !smsPreview) {
|
|
@@ -67123,8 +67177,8 @@ const PreviewAndSchedule = ({
|
|
|
67123
67177
|
{
|
|
67124
67178
|
subtitle: "Estimated recipient count may vary at time of delivery",
|
|
67125
67179
|
iconDefinitions,
|
|
67126
|
-
includeSegments: automation2.includeSegmentIds,
|
|
67127
|
-
excludeSegments: automation2.excludeSegmentIds
|
|
67180
|
+
includeSegments: automation2.includeSegmentIds || [],
|
|
67181
|
+
excludeSegments: automation2.excludeSegmentIds || []
|
|
67128
67182
|
}
|
|
67129
67183
|
)
|
|
67130
67184
|
] }),
|
|
@@ -67487,29 +67541,19 @@ const TitleAndContent = ({ title: title2, subtitle, content: content2, className
|
|
|
67487
67541
|
/* @__PURE__ */ jsx("div", { className: "bg-white rounded-2xl w-full border border-gray-200 p-6 relative", children: content2 })
|
|
67488
67542
|
] });
|
|
67489
67543
|
};
|
|
67490
|
-
const containerVariants = {
|
|
67491
|
-
hidden: { opacity: 0 },
|
|
67492
|
-
visible: {
|
|
67493
|
-
opacity: 1,
|
|
67494
|
-
transition: {
|
|
67495
|
-
duration: 0.5,
|
|
67496
|
-
staggerChildren: 0.1
|
|
67497
|
-
}
|
|
67498
|
-
}
|
|
67499
|
-
};
|
|
67500
|
-
const itemVariants = {
|
|
67501
|
-
hidden: { opacity: 0, y: 10 },
|
|
67502
|
-
visible: {
|
|
67503
|
-
opacity: 1,
|
|
67504
|
-
y: 0,
|
|
67505
|
-
transition: {
|
|
67506
|
-
type: "spring",
|
|
67507
|
-
stiffness: 300,
|
|
67508
|
-
damping: 24
|
|
67509
|
-
}
|
|
67510
|
-
}
|
|
67511
|
-
};
|
|
67512
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
|
+
};
|
|
67513
67557
|
if (!automation2.name) {
|
|
67514
67558
|
return /* @__PURE__ */ jsx("div", { className: "flex items-center justify-center min-h-[200px]", children: /* @__PURE__ */ jsx(BasicLoader, {}) });
|
|
67515
67559
|
}
|
|
@@ -67517,7 +67561,16 @@ const TriggerEditAutomation = ({ automation: automation2 }) => {
|
|
|
67517
67561
|
motion.div,
|
|
67518
67562
|
{
|
|
67519
67563
|
className: "bg-white rounded-2xl shadow-sm border border-gray-100 p-6 max-w-lg",
|
|
67520
|
-
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
|
+
},
|
|
67521
67574
|
initial: "hidden",
|
|
67522
67575
|
animate: "visible",
|
|
67523
67576
|
children: [
|
|
@@ -67558,15 +67611,12 @@ const TriggerEditAutomation = ({ automation: automation2 }) => {
|
|
|
67558
67611
|
}
|
|
67559
67612
|
) });
|
|
67560
67613
|
};
|
|
67561
|
-
const
|
|
67614
|
+
const getAutomationSteps = ({
|
|
67562
67615
|
automation: automation2,
|
|
67563
|
-
updateAutomation: updateAutomation2,
|
|
67564
67616
|
communicationGroup,
|
|
67565
|
-
updateCommunicationGroup: updateCommunicationGroup2,
|
|
67566
67617
|
iconDefinitions,
|
|
67567
67618
|
getExtraMergeFields,
|
|
67568
|
-
handleSaveAsDraft
|
|
67569
|
-
isLoading
|
|
67619
|
+
handleSaveAsDraft
|
|
67570
67620
|
}) => {
|
|
67571
67621
|
if (!automation2) return [];
|
|
67572
67622
|
return [
|
|
@@ -67662,10 +67712,6 @@ const useAutomationSteps = ({
|
|
|
67662
67712
|
/* @__PURE__ */ jsx(
|
|
67663
67713
|
EditCampaignContent,
|
|
67664
67714
|
{
|
|
67665
|
-
automation: automation2,
|
|
67666
|
-
updateAutomation: updateAutomation2,
|
|
67667
|
-
communicationGroup,
|
|
67668
|
-
updateCommunicationGroup: updateCommunicationGroup2,
|
|
67669
67715
|
iconDefinitions,
|
|
67670
67716
|
getExtraMergeFields
|
|
67671
67717
|
}
|
|
@@ -67698,15 +67744,7 @@ const useAutomationSteps = ({
|
|
|
67698
67744
|
{
|
|
67699
67745
|
className: "flex-1",
|
|
67700
67746
|
title: "Preview and Schedule",
|
|
67701
|
-
content: /* @__PURE__ */ jsx(
|
|
67702
|
-
PreviewAndSchedule,
|
|
67703
|
-
{
|
|
67704
|
-
automation: automation2,
|
|
67705
|
-
iconDefinitions,
|
|
67706
|
-
isLoading,
|
|
67707
|
-
communicationGroup
|
|
67708
|
-
}
|
|
67709
|
-
)
|
|
67747
|
+
content: /* @__PURE__ */ jsx(PreviewAndSchedule, { iconDefinitions })
|
|
67710
67748
|
},
|
|
67711
67749
|
"send"
|
|
67712
67750
|
),
|
|
@@ -67741,6 +67779,29 @@ const useAutomationSteps = ({
|
|
|
67741
67779
|
}
|
|
67742
67780
|
];
|
|
67743
67781
|
};
|
|
67782
|
+
const useValidateStep = () => {
|
|
67783
|
+
const { automation: automation2 } = useAutomation();
|
|
67784
|
+
const { communicationGroup } = useCommunication();
|
|
67785
|
+
const validateStep = useCallback(
|
|
67786
|
+
async (currentStep) => {
|
|
67787
|
+
if (!automation2) {
|
|
67788
|
+
return {
|
|
67789
|
+
canMove: false,
|
|
67790
|
+
errorMessage: "Automation not loaded"
|
|
67791
|
+
};
|
|
67792
|
+
}
|
|
67793
|
+
return await validateAutomationStep({
|
|
67794
|
+
currentStep,
|
|
67795
|
+
automation: automation2,
|
|
67796
|
+
communicationGroup
|
|
67797
|
+
});
|
|
67798
|
+
},
|
|
67799
|
+
[automation2, communicationGroup]
|
|
67800
|
+
);
|
|
67801
|
+
return {
|
|
67802
|
+
validateStep
|
|
67803
|
+
};
|
|
67804
|
+
};
|
|
67744
67805
|
const BackNextButtonGroup = ({
|
|
67745
67806
|
iconDefinitions,
|
|
67746
67807
|
handleBack,
|
|
@@ -67797,30 +67858,38 @@ const BackNextButtonGroup = ({
|
|
|
67797
67858
|
] });
|
|
67798
67859
|
};
|
|
67799
67860
|
const EditAutomation = ({
|
|
67800
|
-
automation: automation2,
|
|
67801
|
-
updateAutomation: updateAutomation2,
|
|
67802
|
-
communicationGroup,
|
|
67803
|
-
updateCommunicationGroup: updateCommunicationGroup2,
|
|
67804
67861
|
iconDefinitions,
|
|
67805
67862
|
setOpenEditAutomationPopup,
|
|
67806
67863
|
logoUrl,
|
|
67807
67864
|
getExtraMergeFields,
|
|
67808
|
-
onBeforeSchedule
|
|
67809
|
-
estimatedMatchesStats,
|
|
67810
|
-
isLoading,
|
|
67811
|
-
validateCanGoToNextStep,
|
|
67812
|
-
setIsLoading
|
|
67865
|
+
onBeforeSchedule
|
|
67813
67866
|
}) => {
|
|
67814
67867
|
const { toast: toast2 } = useToast();
|
|
67868
|
+
const { automation: automation2 } = useAutomation();
|
|
67869
|
+
const { communicationGroup } = useCommunication();
|
|
67870
|
+
const { estimatedMatchesStats } = useValidation();
|
|
67871
|
+
const { validateStep } = useValidateStep();
|
|
67815
67872
|
const [currentStep, setCurrentStep] = useState(
|
|
67816
|
-
|
|
67817
|
-
* We dont show the trigger step for trigger based automations
|
|
67818
|
-
*/
|
|
67819
|
-
automation2.trigger_type === AutomationTriggerType.TRIGGER_BASED ? AutomationSteps.SelectTrigger : AutomationSteps.SelectAudience
|
|
67873
|
+
void 0
|
|
67820
67874
|
);
|
|
67821
67875
|
const [isValidatingStep, setIsValidatingStep] = useState(false);
|
|
67876
|
+
const { updateAutomation: updateAutomation2 } = useUpdateBusinessAutomation(
|
|
67877
|
+
automation2?.id || ""
|
|
67878
|
+
);
|
|
67879
|
+
useEffect(() => {
|
|
67880
|
+
if (automation2) {
|
|
67881
|
+
setCurrentStep(
|
|
67882
|
+
automation2.trigger_type === AutomationTriggerType.TRIGGER_BASED ? AutomationSteps.SelectTrigger : AutomationSteps.SelectAudience
|
|
67883
|
+
);
|
|
67884
|
+
}
|
|
67885
|
+
}, [automation2]);
|
|
67886
|
+
if (!automation2 || !currentStep || !communicationGroup) {
|
|
67887
|
+
return /* @__PURE__ */ jsx("div", { className: "flex-1 flex flex-col @container justify-center items-center h-[500px]", children: /* @__PURE__ */ jsx(BasicLoader, { text: ["Fetching Automation data", "Finishing up"] }) });
|
|
67888
|
+
}
|
|
67822
67889
|
const handleSaveAsDraft = () => {
|
|
67823
|
-
|
|
67890
|
+
if (!automation2) {
|
|
67891
|
+
return;
|
|
67892
|
+
}
|
|
67824
67893
|
updateAutomation2({
|
|
67825
67894
|
status: AutomationStatus.DRAFT
|
|
67826
67895
|
});
|
|
@@ -67829,21 +67898,14 @@ const EditAutomation = ({
|
|
|
67829
67898
|
title: "Automation saved as draft",
|
|
67830
67899
|
description: "You can continue editing it later"
|
|
67831
67900
|
});
|
|
67832
|
-
setIsLoading(false);
|
|
67833
67901
|
};
|
|
67834
|
-
const STEPS =
|
|
67902
|
+
const STEPS = getAutomationSteps({
|
|
67835
67903
|
automation: automation2,
|
|
67904
|
+
communicationGroup,
|
|
67836
67905
|
iconDefinitions,
|
|
67837
67906
|
getExtraMergeFields,
|
|
67838
|
-
handleSaveAsDraft
|
|
67839
|
-
isLoading,
|
|
67840
|
-
communicationGroup,
|
|
67841
|
-
updateAutomation: updateAutomation2,
|
|
67842
|
-
updateCommunicationGroup: updateCommunicationGroup2
|
|
67907
|
+
handleSaveAsDraft
|
|
67843
67908
|
});
|
|
67844
|
-
if (isLoading) {
|
|
67845
|
-
return /* @__PURE__ */ jsx("div", { className: "flex-1 flex flex-col @container justify-center items-center h-[500px]", children: /* @__PURE__ */ jsx(BasicLoader, { text: ["Fetching Automation data", "Finishing up"] }) });
|
|
67846
|
-
}
|
|
67847
67909
|
const handleScheduleAutomation = async () => {
|
|
67848
67910
|
if (onBeforeSchedule) {
|
|
67849
67911
|
try {
|
|
@@ -67852,7 +67914,6 @@ const EditAutomation = ({
|
|
|
67852
67914
|
estimatedSmsRecipients: estimatedMatchesStats.phones
|
|
67853
67915
|
});
|
|
67854
67916
|
if (result === true) {
|
|
67855
|
-
setIsLoading(true);
|
|
67856
67917
|
updateAutomation2({
|
|
67857
67918
|
status: AutomationStatus.ACTIVE
|
|
67858
67919
|
});
|
|
@@ -67860,7 +67921,6 @@ const EditAutomation = ({
|
|
|
67860
67921
|
toast2({
|
|
67861
67922
|
title: "Automation scheduled!"
|
|
67862
67923
|
});
|
|
67863
|
-
setIsLoading(false);
|
|
67864
67924
|
} else {
|
|
67865
67925
|
toast2({
|
|
67866
67926
|
title: "Oops!",
|
|
@@ -67876,21 +67936,15 @@ const EditAutomation = ({
|
|
|
67876
67936
|
});
|
|
67877
67937
|
}
|
|
67878
67938
|
} else {
|
|
67879
|
-
setIsLoading(true);
|
|
67880
67939
|
updateAutomation2({ status: AutomationStatus.ACTIVE });
|
|
67881
67940
|
setOpenEditAutomationPopup(false);
|
|
67882
67941
|
toast2({
|
|
67883
67942
|
title: "Automation scheduled!"
|
|
67884
67943
|
});
|
|
67885
|
-
setIsLoading(false);
|
|
67886
67944
|
}
|
|
67887
67945
|
};
|
|
67888
67946
|
const handleNextStep = async () => {
|
|
67889
|
-
const { canMove, errorMessage } = await
|
|
67890
|
-
currentStep,
|
|
67891
|
-
automation: automation2,
|
|
67892
|
-
communicationGroup
|
|
67893
|
-
});
|
|
67947
|
+
const { canMove, errorMessage } = await validateStep(currentStep);
|
|
67894
67948
|
if (!canMove) {
|
|
67895
67949
|
toast2({
|
|
67896
67950
|
title: "Oops!",
|
|
@@ -67917,11 +67971,7 @@ const EditAutomation = ({
|
|
|
67917
67971
|
setIsValidatingStep(true);
|
|
67918
67972
|
try {
|
|
67919
67973
|
for (let step = currentStep; step < targetStep; step++) {
|
|
67920
|
-
const { canMove, errorMessage } = await
|
|
67921
|
-
currentStep: step,
|
|
67922
|
-
automation: automation2,
|
|
67923
|
-
communicationGroup
|
|
67924
|
-
});
|
|
67974
|
+
const { canMove, errorMessage } = await validateStep(step);
|
|
67925
67975
|
if (!canMove) {
|
|
67926
67976
|
return { canMove, errorMessage };
|
|
67927
67977
|
}
|
|
@@ -68024,6 +68074,39 @@ const EditAutomation = ({
|
|
|
68024
68074
|
renderFooter()
|
|
68025
68075
|
] });
|
|
68026
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
|
+
};
|
|
68027
68110
|
const validateEmail = (email) => {
|
|
68028
68111
|
const emailRegex = /^[^\s@.]+(?:\.[^\s@.]+)*@[^\s@.]+(?:\.[^\s@.]+)+$/;
|
|
68029
68112
|
return emailRegex.test(email);
|
|
@@ -68180,32 +68263,76 @@ const SendPreviewPopup = ({ automation: automation2, type, setOpenSendPreviewPop
|
|
|
68180
68263
|
)
|
|
68181
68264
|
] });
|
|
68182
68265
|
};
|
|
68183
|
-
const
|
|
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,
|
|
68184
68292
|
automation: automation2,
|
|
68185
|
-
|
|
68186
|
-
|
|
68187
|
-
|
|
68188
|
-
|
|
68189
|
-
|
|
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
|
+
};
|
|
68312
|
+
const ViewAutomationHeaderContainer = ({
|
|
68190
68313
|
iconDefinitions,
|
|
68191
68314
|
autoOpenEditPopup,
|
|
68192
68315
|
logoUrl,
|
|
68193
68316
|
getExtraMergeFields,
|
|
68194
68317
|
onDuplicationCreated,
|
|
68195
68318
|
onBeforeSchedule,
|
|
68196
|
-
invalidateAutomation,
|
|
68197
|
-
estimatedMatchesStats,
|
|
68198
|
-
validateStep,
|
|
68199
68319
|
showBackButton = false
|
|
68200
68320
|
}) => {
|
|
68321
|
+
const mergedIconDefinitions = mergeIconDefinitions(iconDefinitions);
|
|
68201
68322
|
const [openEditAutomationPopup, setOpenEditAutomationPopup] = useState(false);
|
|
68202
68323
|
const [openSendPreviewSmsPopup, setOpenSendPreviewSmsPopup] = useState(false);
|
|
68324
|
+
const [openSendPreviewEmailPopup, setOpenSendPreviewEmailPopup] = useState(false);
|
|
68203
68325
|
const [
|
|
68204
68326
|
cancelAutomationConfirmationPopup,
|
|
68205
68327
|
setCancelAutomationConfirmationPopup
|
|
68206
68328
|
] = useState(false);
|
|
68207
|
-
const
|
|
68208
|
-
const
|
|
68329
|
+
const { automation: automation2 } = useAutomation();
|
|
68330
|
+
const { updateAutomation: updateAutomation2 } = useUpdateBusinessAutomation(
|
|
68331
|
+
automation2?.id || ""
|
|
68332
|
+
);
|
|
68333
|
+
const { invalidateAutomation } = useGetBusinessAutomation(
|
|
68334
|
+
automation2?.id || ""
|
|
68335
|
+
);
|
|
68209
68336
|
const navigate = useNavigate();
|
|
68210
68337
|
const { toast: toast2 } = useToast();
|
|
68211
68338
|
useEffect(() => {
|
|
@@ -68231,6 +68358,13 @@ const ViewAutomationHeaderContainer = ({
|
|
|
68231
68358
|
updateAutomation2({ status: AutomationStatus.DRAFT });
|
|
68232
68359
|
};
|
|
68233
68360
|
const handleDuplicateAutomation = async () => {
|
|
68361
|
+
if (!automation2) {
|
|
68362
|
+
toast2({
|
|
68363
|
+
title: "Error duplicating automation",
|
|
68364
|
+
description: "Please try again"
|
|
68365
|
+
});
|
|
68366
|
+
return;
|
|
68367
|
+
}
|
|
68234
68368
|
const { id: duplicatedId } = await duplicateBusinessAutomation(
|
|
68235
68369
|
automation2.id
|
|
68236
68370
|
);
|
|
@@ -68249,113 +68383,9 @@ const ViewAutomationHeaderContainer = ({
|
|
|
68249
68383
|
description: "The automation has been duplicated"
|
|
68250
68384
|
});
|
|
68251
68385
|
};
|
|
68252
|
-
|
|
68253
|
-
return
|
|
68254
|
-
}
|
|
68255
|
-
const renderEditAutomationDialog = () => /* @__PURE__ */ jsx(
|
|
68256
|
-
Dialog,
|
|
68257
|
-
{
|
|
68258
|
-
open: openEditAutomationPopup,
|
|
68259
|
-
onOpenChange: handleEditDialogChange,
|
|
68260
|
-
children: /* @__PURE__ */ jsxs(
|
|
68261
|
-
DialogContent,
|
|
68262
|
-
{
|
|
68263
|
-
className: "max-w-7xl w-full overflow-hidden p-0 h-full max-h-[calc(100dvh-10dvh)]",
|
|
68264
|
-
hideCloseButton: true,
|
|
68265
|
-
children: [
|
|
68266
|
-
/* @__PURE__ */ jsxs(VisuallyHidden$2, { children: [
|
|
68267
|
-
/* @__PURE__ */ jsx(DialogTitle, { children: "Edit Automation" }),
|
|
68268
|
-
/* @__PURE__ */ jsx(DialogDescription, { children: "Edit the automation to change the content, schedule, and other details." })
|
|
68269
|
-
] }),
|
|
68270
|
-
/* @__PURE__ */ jsx(
|
|
68271
|
-
EditAutomation,
|
|
68272
|
-
{
|
|
68273
|
-
automation: automation2,
|
|
68274
|
-
updateAutomation: updateAutomation2,
|
|
68275
|
-
communicationGroup,
|
|
68276
|
-
updateCommunicationGroup: updateCommunicationGroup2,
|
|
68277
|
-
isLoading,
|
|
68278
|
-
setIsLoading,
|
|
68279
|
-
iconDefinitions: mergedIconDefinitions,
|
|
68280
|
-
setOpenEditAutomationPopup,
|
|
68281
|
-
logoUrl,
|
|
68282
|
-
getExtraMergeFields,
|
|
68283
|
-
onBeforeSchedule,
|
|
68284
|
-
estimatedMatchesStats,
|
|
68285
|
-
validateCanGoToNextStep: validateStepAdapter
|
|
68286
|
-
}
|
|
68287
|
-
)
|
|
68288
|
-
]
|
|
68289
|
-
}
|
|
68290
|
-
)
|
|
68291
|
-
}
|
|
68292
|
-
);
|
|
68293
|
-
const renderCancelAutomationDialog = () => /* @__PURE__ */ jsx(
|
|
68294
|
-
Dialog,
|
|
68295
|
-
{
|
|
68296
|
-
open: cancelAutomationConfirmationPopup,
|
|
68297
|
-
onOpenChange: setCancelAutomationConfirmationPopup,
|
|
68298
|
-
children: /* @__PURE__ */ jsxs(DialogContent, { className: "sm:max-w-[425px]", children: [
|
|
68299
|
-
/* @__PURE__ */ jsx(DialogTitle, { className: "text-xl font-semibold", children: "Cancel Automation" }),
|
|
68300
|
-
/* @__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." }),
|
|
68301
|
-
/* @__PURE__ */ jsxs("div", { className: "flex justify-center gap-3 mt-6", children: [
|
|
68302
|
-
/* @__PURE__ */ jsx(
|
|
68303
|
-
Button$1,
|
|
68304
|
-
{
|
|
68305
|
-
variant: "outline",
|
|
68306
|
-
onClick: () => setCancelAutomationConfirmationPopup(false),
|
|
68307
|
-
children: "Keep Running"
|
|
68308
|
-
}
|
|
68309
|
-
),
|
|
68310
|
-
/* @__PURE__ */ jsx(Button$1, { variant: "destructive", onClick: handleCancelAutomation, children: "Yes, Cancel Automation" })
|
|
68311
|
-
] })
|
|
68312
|
-
] })
|
|
68313
|
-
}
|
|
68314
|
-
);
|
|
68315
|
-
const renderPreviewSmsDialog = () => /* @__PURE__ */ jsx(
|
|
68316
|
-
Dialog,
|
|
68317
|
-
{
|
|
68318
|
-
open: openSendPreviewSmsPopup,
|
|
68319
|
-
onOpenChange: setOpenSendPreviewSmsPopup,
|
|
68320
|
-
children: /* @__PURE__ */ jsxs(DialogContent, { children: [
|
|
68321
|
-
/* @__PURE__ */ jsxs(VisuallyHidden$2, { children: [
|
|
68322
|
-
/* @__PURE__ */ jsx(DialogTitle, { children: "Send Preview SMS" }),
|
|
68323
|
-
/* @__PURE__ */ jsx(DialogDescription, { children: "Send a preview SMS to the automation." })
|
|
68324
|
-
] }),
|
|
68325
|
-
/* @__PURE__ */ jsx(
|
|
68326
|
-
SendPreviewPopup,
|
|
68327
|
-
{
|
|
68328
|
-
automation: automation2,
|
|
68329
|
-
type: "sms",
|
|
68330
|
-
setOpenSendPreviewPopup: setOpenSendPreviewSmsPopup,
|
|
68331
|
-
iconDefinitions: mergedIconDefinitions
|
|
68332
|
-
}
|
|
68333
|
-
)
|
|
68334
|
-
] })
|
|
68335
|
-
}
|
|
68336
|
-
);
|
|
68337
|
-
const renderPreviewEmailDialog = () => /* @__PURE__ */ jsx(
|
|
68338
|
-
Dialog,
|
|
68339
|
-
{
|
|
68340
|
-
open: openSendPreviewEmailPopup,
|
|
68341
|
-
onOpenChange: setOpenSendPreviewEmailPopup,
|
|
68342
|
-
children: /* @__PURE__ */ jsxs(DialogContent, { children: [
|
|
68343
|
-
/* @__PURE__ */ jsxs(VisuallyHidden$2, { children: [
|
|
68344
|
-
/* @__PURE__ */ jsx(DialogTitle, { children: "Send Preview Email" }),
|
|
68345
|
-
/* @__PURE__ */ jsx(DialogDescription, { children: "Send a preview email to the automation." })
|
|
68346
|
-
] }),
|
|
68347
|
-
/* @__PURE__ */ jsx(
|
|
68348
|
-
SendPreviewPopup,
|
|
68349
|
-
{
|
|
68350
|
-
automation: automation2,
|
|
68351
|
-
type: "email",
|
|
68352
|
-
setOpenSendPreviewPopup: setOpenSendPreviewEmailPopup,
|
|
68353
|
-
iconDefinitions: mergedIconDefinitions
|
|
68354
|
-
}
|
|
68355
|
-
)
|
|
68356
|
-
] })
|
|
68357
|
-
}
|
|
68358
|
-
);
|
|
68386
|
+
if (!automation2) {
|
|
68387
|
+
return /* @__PURE__ */ jsx("div", { className: "flex justify-center items-center h-full", children: /* @__PURE__ */ jsx(BasicLoader, { text: ["Fetching Automation data", "Finishing up"] }) });
|
|
68388
|
+
}
|
|
68359
68389
|
const renderBackButton = () => {
|
|
68360
68390
|
if (!showBackButton) return null;
|
|
68361
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" }) }) });
|
|
@@ -68431,10 +68461,46 @@ const ViewAutomationHeaderContainer = ({
|
|
|
68431
68461
|
] })
|
|
68432
68462
|
] }) });
|
|
68433
68463
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
68434
|
-
|
|
68435
|
-
|
|
68436
|
-
|
|
68437
|
-
|
|
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
|
+
),
|
|
68438
68504
|
/* @__PURE__ */ jsxs("div", { className: "p-6 border-b border-gray-200 bg-background", children: [
|
|
68439
68505
|
renderBackButton(),
|
|
68440
68506
|
renderHeaderInfo(),
|
|
@@ -68443,57 +68509,34 @@ const ViewAutomationHeaderContainer = ({
|
|
|
68443
68509
|
] });
|
|
68444
68510
|
};
|
|
68445
68511
|
const ViewAutomationHeader = React__default.memo(ViewAutomationHeaderContainer);
|
|
68446
|
-
const
|
|
68447
|
-
iconDefinitions,
|
|
68512
|
+
const ViewAutomationMain = ({
|
|
68448
68513
|
autoOpenEditPopup,
|
|
68449
|
-
automationId,
|
|
68450
68514
|
showBackButton = false,
|
|
68451
68515
|
logoUrl,
|
|
68452
68516
|
getExtraMergeFields,
|
|
68453
68517
|
onDuplicationCreated,
|
|
68454
|
-
onBeforeSchedule
|
|
68518
|
+
onBeforeSchedule,
|
|
68519
|
+
iconDefinitions
|
|
68455
68520
|
}) => {
|
|
68456
|
-
const
|
|
68457
|
-
const
|
|
68521
|
+
const { automation: automation2 } = useAutomation();
|
|
68522
|
+
const { communicationGroup } = useCommunication();
|
|
68523
|
+
const { isLoading } = useLoading();
|
|
68458
68524
|
const finalIconDefinitions = mergeIconDefinitions(iconDefinitions);
|
|
68459
68525
|
const [activeTab, setActiveTab] = React__default.useState("content");
|
|
68460
|
-
const effectiveAutomationId = automationId || params?.automationId || searchParams.get("automationId") || "";
|
|
68461
|
-
const shouldAutoOpenEditPopup = autoOpenEditPopup || searchParams.get("autoOpenEditPopup");
|
|
68462
|
-
const shouldShowBackButton = searchParams.get("showBackButton") === "true" || showBackButton;
|
|
68463
|
-
const {
|
|
68464
|
-
automation: automation2,
|
|
68465
|
-
updateAutomation: updateAutomation2,
|
|
68466
|
-
communicationGroup,
|
|
68467
|
-
updateCommunicationGroup: updateCommunicationGroup2,
|
|
68468
|
-
isLoading,
|
|
68469
|
-
setIsLoading,
|
|
68470
|
-
invalidateAutomation,
|
|
68471
|
-
validateStep,
|
|
68472
|
-
estimatedMatchesStats
|
|
68473
|
-
} = useAutomation(effectiveAutomationId);
|
|
68474
68526
|
if (!automation2 || !communicationGroup) {
|
|
68475
68527
|
return /* @__PURE__ */ jsx("div", { className: "flex h-screen items-center justify-center", children: /* @__PURE__ */ jsx(BasicLoader, { text: ["Fetching Automation data", "Finishing up"] }) });
|
|
68476
68528
|
}
|
|
68477
|
-
return /* @__PURE__ */ jsxs("div", {
|
|
68529
|
+
return /* @__PURE__ */ jsxs("div", { children: [
|
|
68478
68530
|
/* @__PURE__ */ jsx(
|
|
68479
68531
|
ViewAutomationHeader,
|
|
68480
68532
|
{
|
|
68481
|
-
automation: automation2,
|
|
68482
|
-
updateAutomation: updateAutomation2,
|
|
68483
|
-
communicationGroup,
|
|
68484
|
-
updateCommunicationGroup: updateCommunicationGroup2,
|
|
68485
|
-
isLoading,
|
|
68486
|
-
setIsLoading,
|
|
68487
68533
|
iconDefinitions: finalIconDefinitions,
|
|
68488
|
-
autoOpenEditPopup
|
|
68489
|
-
showBackButton
|
|
68534
|
+
autoOpenEditPopup,
|
|
68535
|
+
showBackButton,
|
|
68490
68536
|
logoUrl,
|
|
68491
68537
|
getExtraMergeFields,
|
|
68492
68538
|
onDuplicationCreated,
|
|
68493
|
-
onBeforeSchedule
|
|
68494
|
-
invalidateAutomation,
|
|
68495
|
-
estimatedMatchesStats,
|
|
68496
|
-
validateStep
|
|
68539
|
+
onBeforeSchedule
|
|
68497
68540
|
}
|
|
68498
68541
|
),
|
|
68499
68542
|
/* @__PURE__ */ jsx(
|
|
@@ -68507,8 +68550,7 @@ const ViewAutomationContent = ({
|
|
|
68507
68550
|
AutomationContent,
|
|
68508
68551
|
{
|
|
68509
68552
|
iconDefinitions: finalIconDefinitions,
|
|
68510
|
-
isLoading
|
|
68511
|
-
communicationGroup
|
|
68553
|
+
isLoading
|
|
68512
68554
|
}
|
|
68513
68555
|
)
|
|
68514
68556
|
},
|
|
@@ -68533,6 +68575,21 @@ const ViewAutomationContent = ({
|
|
|
68533
68575
|
)
|
|
68534
68576
|
] });
|
|
68535
68577
|
};
|
|
68578
|
+
const ViewAutomationContent = ({ ...props }) => {
|
|
68579
|
+
const params = useParams();
|
|
68580
|
+
const [searchParams] = useSearchParams();
|
|
68581
|
+
const effectiveAutomationId = props.automationId || params?.automationId || searchParams.get("automationId") || "";
|
|
68582
|
+
const shouldAutoOpenEditPopup = props.autoOpenEditPopup || searchParams.get("autoOpenEditPopup");
|
|
68583
|
+
const shouldShowBackButton = searchParams.get("showBackButton") === "true" || props.showBackButton;
|
|
68584
|
+
return /* @__PURE__ */ jsx(ViewAutomationProvider, { automationId: effectiveAutomationId, children: /* @__PURE__ */ jsx("div", { className: "bg-background", children: /* @__PURE__ */ jsx(
|
|
68585
|
+
ViewAutomationMain,
|
|
68586
|
+
{
|
|
68587
|
+
...props,
|
|
68588
|
+
autoOpenEditPopup: shouldAutoOpenEditPopup,
|
|
68589
|
+
showBackButton: shouldShowBackButton
|
|
68590
|
+
}
|
|
68591
|
+
) }) });
|
|
68592
|
+
};
|
|
68536
68593
|
const ViewAutomation = ({ inRouter = false, ...props }) => inRouter ? /* @__PURE__ */ jsx(ViewAutomationContent, { ...props }) : /* @__PURE__ */ jsx(MemoryRouter, { children: /* @__PURE__ */ jsx(ViewAutomationContent, { ...props }) });
|
|
68537
68594
|
Object.values(
|
|
68538
68595
|
/* @__PURE__ */ Object.assign({})
|