@embedreach/components 0.3.12 → 0.3.13
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 +22 -7
- package/dist/index.umd.js +2 -2
- package/package.json +1 -1
package/dist/chunks/index.js
CHANGED
|
@@ -49131,20 +49131,29 @@ const useValidationStats = () => {
|
|
|
49131
49131
|
const { state } = useViewAutomationContext();
|
|
49132
49132
|
return state.recipientStats;
|
|
49133
49133
|
};
|
|
49134
|
-
const useRecipientStatsTracking = (
|
|
49135
|
-
const { setRecipientStats: setRecipientStats2 } = useViewAutomationContext();
|
|
49134
|
+
const useRecipientStatsTracking = (existingAutomation) => {
|
|
49135
|
+
const { setRecipientStats: setRecipientStats2, state } = useViewAutomationContext();
|
|
49136
|
+
const automation2 = state.automation || existingAutomation;
|
|
49136
49137
|
const { estimatedMatchesStats } = useRecipientStats$1(automation2);
|
|
49137
49138
|
useEffect(() => {
|
|
49138
49139
|
if (estimatedMatchesStats) {
|
|
49139
49140
|
setRecipientStats2(estimatedMatchesStats);
|
|
49140
49141
|
}
|
|
49141
|
-
}, [estimatedMatchesStats, setRecipientStats2]);
|
|
49142
|
+
}, [estimatedMatchesStats, setRecipientStats2, automation2]);
|
|
49142
49143
|
};
|
|
49143
49144
|
const ViewAutomationProvider = ({
|
|
49144
49145
|
automationId,
|
|
49146
|
+
existingAutomation,
|
|
49145
49147
|
children
|
|
49146
49148
|
}) => {
|
|
49147
|
-
return /* @__PURE__ */ jsx(Provider$2, { children: /* @__PURE__ */ jsx(
|
|
49149
|
+
return /* @__PURE__ */ jsx(Provider$2, { children: /* @__PURE__ */ jsx(
|
|
49150
|
+
ViewAutomationContent$1,
|
|
49151
|
+
{
|
|
49152
|
+
automationId,
|
|
49153
|
+
existingAutomation,
|
|
49154
|
+
children
|
|
49155
|
+
}
|
|
49156
|
+
) });
|
|
49148
49157
|
};
|
|
49149
49158
|
const ViewAutomationContent$1 = ({ automationId, existingAutomation, children }) => {
|
|
49150
49159
|
useAutomationFetching(automationId);
|
|
@@ -106927,7 +106936,7 @@ const getAutomationSteps = ({
|
|
|
106927
106936
|
];
|
|
106928
106937
|
};
|
|
106929
106938
|
const useRecipientStats = (automation2) => {
|
|
106930
|
-
const { data: estimatedMatches } = useGetCountOfBusinessAutomationRecipients({
|
|
106939
|
+
const { data: estimatedMatches, isLoading } = useGetCountOfBusinessAutomationRecipients({
|
|
106931
106940
|
automationId: automation2?.id ?? "",
|
|
106932
106941
|
includeSegments: automation2?.includeSegmentIds ?? [],
|
|
106933
106942
|
excludeSegments: automation2?.excludeSegmentIds ?? []
|
|
@@ -106944,7 +106953,8 @@ const useRecipientStats = (automation2) => {
|
|
|
106944
106953
|
}, [estimatedMatches?.recipients]);
|
|
106945
106954
|
return {
|
|
106946
106955
|
estimatedMatches,
|
|
106947
|
-
estimatedMatchesStats
|
|
106956
|
+
estimatedMatchesStats,
|
|
106957
|
+
isLoading
|
|
106948
106958
|
};
|
|
106949
106959
|
};
|
|
106950
106960
|
const DEFAULT_LOGO_URL = "https://assets.embedreach.com/defaults/logo-placeholder-128.png";
|
|
@@ -107154,7 +107164,7 @@ const OneTimeWizardMain = ({ onFinish, getExtraMergeFields, onBeforeSchedule })
|
|
|
107154
107164
|
const { updateAutomation: updateAutomation2 } = useUpdateBusinessAutomation(
|
|
107155
107165
|
automation2?.id || ""
|
|
107156
107166
|
);
|
|
107157
|
-
const { estimatedMatchesStats } = useRecipientStats(automation2 ?? void 0);
|
|
107167
|
+
const { estimatedMatchesStats, isLoading: isLoadingRecipientStats } = useRecipientStats(automation2 ?? void 0);
|
|
107158
107168
|
const {
|
|
107159
107169
|
state: { selectedChannels }
|
|
107160
107170
|
} = useContext(Context);
|
|
@@ -107243,6 +107253,11 @@ const OneTimeWizardMain = ({ onFinish, getExtraMergeFields, onBeforeSchedule })
|
|
|
107243
107253
|
}
|
|
107244
107254
|
if (onBeforeSchedule) {
|
|
107245
107255
|
try {
|
|
107256
|
+
let attempts = 0;
|
|
107257
|
+
while (isLoadingRecipientStats && attempts < 10) {
|
|
107258
|
+
await new Promise((resolve) => setTimeout(resolve, 250));
|
|
107259
|
+
attempts++;
|
|
107260
|
+
}
|
|
107246
107261
|
const result = await onBeforeSchedule({
|
|
107247
107262
|
estimatedEmailRecipients: estimatedMatchesStats?.emails || 0,
|
|
107248
107263
|
estimatedSmsRecipients: estimatedMatchesStats?.phones || 0
|