@embedreach/components 0.2.14 → 0.2.16
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 +90 -222
- package/dist/index.umd.js +119 -119
- package/dist/styles.css +1 -1
- package/package.json +1 -1
package/dist/chunks/index.js
CHANGED
|
@@ -6,7 +6,6 @@ import ReactDOM__default from "react-dom";
|
|
|
6
6
|
const BUSINESS_PATH = "/businesses/me";
|
|
7
7
|
const BUSINESS_SEGMENT_PATH = "/segments";
|
|
8
8
|
const BUSINESS_AUTOMATION_PATH = "/automations";
|
|
9
|
-
const BUSINESS_AUTOMATION_INTERNAL_PATH = "/automations/internal";
|
|
10
9
|
const WEB_PRESENCE_PATH = "/web-presence";
|
|
11
10
|
const WEBSITE_BRAND_SETTINGS_PATH = `${WEB_PRESENCE_PATH}/brand-settings`;
|
|
12
11
|
const CHANNEL_SENDER_PATH = "/channel/senders";
|
|
@@ -2622,14 +2621,7 @@ const createQueryClient = () => new QueryClient({
|
|
|
2622
2621
|
const automationKeys = {
|
|
2623
2622
|
all: ["automations"],
|
|
2624
2623
|
single: (id2) => [...automationKeys.all, id2],
|
|
2625
|
-
|
|
2626
|
-
...automationKeys.all,
|
|
2627
|
-
args.automationId,
|
|
2628
|
-
"sentCommunications",
|
|
2629
|
-
...args.cursor ? [args.cursor] : [],
|
|
2630
|
-
...args.limit ? [args.limit] : [],
|
|
2631
|
-
...args.search ? [args.search] : []
|
|
2632
|
-
],
|
|
2624
|
+
recipients: (id2) => [...automationKeys.all, id2, "recipients"],
|
|
2633
2625
|
statistics: (id2) => [...automationKeys.all, id2, "statistics"],
|
|
2634
2626
|
list: (args) => [
|
|
2635
2627
|
...automationKeys.all,
|
|
@@ -2657,21 +2649,10 @@ const getAutomation = async (automationId) => {
|
|
|
2657
2649
|
);
|
|
2658
2650
|
return response.data;
|
|
2659
2651
|
};
|
|
2660
|
-
const
|
|
2661
|
-
const
|
|
2662
|
-
|
|
2663
|
-
|
|
2664
|
-
}
|
|
2665
|
-
if (args.limit) {
|
|
2666
|
-
params.append("limit", args.limit.toString());
|
|
2667
|
-
}
|
|
2668
|
-
if (args.search) {
|
|
2669
|
-
params.append("search", args.search);
|
|
2670
|
-
}
|
|
2671
|
-
const url = `${BUSINESS_AUTOMATION_INTERNAL_PATH}/${args.automationId}/sent${params.toString() ? `?${params.toString()}` : ""}`;
|
|
2672
|
-
const response = await baseRequest(url, {
|
|
2673
|
-
method: "GET"
|
|
2674
|
-
});
|
|
2652
|
+
const getAutomationRecipients = async (automationId) => {
|
|
2653
|
+
const response = await baseRequest(
|
|
2654
|
+
`${BUSINESS_AUTOMATION_PATH}/${automationId}/recipients`
|
|
2655
|
+
);
|
|
2675
2656
|
return response.data;
|
|
2676
2657
|
};
|
|
2677
2658
|
const updateAutomation = async (id2, params) => {
|
|
@@ -2755,30 +2736,18 @@ const useGetBusinessAutomation = (automationId) => {
|
|
|
2755
2736
|
})
|
|
2756
2737
|
};
|
|
2757
2738
|
};
|
|
2758
|
-
const
|
|
2759
|
-
const
|
|
2760
|
-
queryKey: automationKeys.
|
|
2761
|
-
queryFn: () =>
|
|
2762
|
-
// placeholderData: keepPreviousData is a powerful feature from TanStack Query.
|
|
2763
|
-
// What it does:
|
|
2764
|
-
// 1. When new data is being fetched for a query (e.g., due to a queryKey change like a new cursor),
|
|
2765
|
-
// TanStack Query will continue to show the data from the previous successful fetch (the "placeholder" data)
|
|
2766
|
-
// until the new data arrives.
|
|
2767
|
-
// 2. While this placeholder data is being shown, `isPlaceholderData` will be true.
|
|
2768
|
-
// 3. `isLoading` will only be true if there's no data at all (initial fetch or hard refresh with no cache).
|
|
2769
|
-
// It will be false if placeholder data is being shown, even though a new fetch is in progress (`isFetching` will be true).
|
|
2770
|
-
// This provides a much smoother UX, as the UI doesn't jump to a loading state on pagination or filter changes
|
|
2771
|
-
// if previous data is available to show in the meantime.
|
|
2772
|
-
placeholderData: keepPreviousData
|
|
2739
|
+
const useGetBusinessAutomationRecipients = (automationId) => {
|
|
2740
|
+
const getAutomationRecipientsQuery = useQuery({
|
|
2741
|
+
queryKey: automationKeys.recipients(automationId),
|
|
2742
|
+
queryFn: () => getAutomationRecipients(automationId)
|
|
2773
2743
|
});
|
|
2774
2744
|
return {
|
|
2775
|
-
// Get automation
|
|
2776
|
-
|
|
2777
|
-
isFetching:
|
|
2778
|
-
isLoading:
|
|
2779
|
-
|
|
2780
|
-
|
|
2781
|
-
refetchSentCommunications: getSentCommunicationsQuery.refetch
|
|
2745
|
+
// Get automation recipients query
|
|
2746
|
+
recipients: getAutomationRecipientsQuery.data,
|
|
2747
|
+
isFetching: getAutomationRecipientsQuery.isFetching,
|
|
2748
|
+
isLoading: getAutomationRecipientsQuery.isLoading,
|
|
2749
|
+
fetchError: getAutomationRecipientsQuery.error,
|
|
2750
|
+
refetchAutomationRecipients: getAutomationRecipientsQuery.refetch
|
|
2782
2751
|
};
|
|
2783
2752
|
};
|
|
2784
2753
|
const useCreateBusinessAutomation = () => {
|
|
@@ -2883,11 +2852,6 @@ var AutomationStatus = /* @__PURE__ */ ((AutomationStatus2) => {
|
|
|
2883
2852
|
AutomationStatus2["DEACTIVATED"] = "deactivated";
|
|
2884
2853
|
return AutomationStatus2;
|
|
2885
2854
|
})(AutomationStatus || {});
|
|
2886
|
-
var ChannelIntegrationTypeEnum = /* @__PURE__ */ ((ChannelIntegrationTypeEnum2) => {
|
|
2887
|
-
ChannelIntegrationTypeEnum2["EMAIL"] = "email";
|
|
2888
|
-
ChannelIntegrationTypeEnum2["SMS"] = "sms";
|
|
2889
|
-
return ChannelIntegrationTypeEnum2;
|
|
2890
|
-
})(ChannelIntegrationTypeEnum || {});
|
|
2891
2855
|
var sharedConfig = {
|
|
2892
2856
|
context: void 0,
|
|
2893
2857
|
registry: void 0,
|
|
@@ -63089,6 +63053,44 @@ const MissingSenderForPreview = ({
|
|
|
63089
63053
|
] });
|
|
63090
63054
|
};
|
|
63091
63055
|
const StripoEditor = ({ containerRef, stripoDialogDimensions, showSaving }) => {
|
|
63056
|
+
useEffect(() => {
|
|
63057
|
+
const handleWheel = (e4) => {
|
|
63058
|
+
const container22 = containerRef.current;
|
|
63059
|
+
if (!container22) return;
|
|
63060
|
+
const uiEditor = container22.querySelector("ui-editor");
|
|
63061
|
+
if (!uiEditor) return;
|
|
63062
|
+
const shadowRoot = uiEditor.shadowRoot;
|
|
63063
|
+
if (!shadowRoot) return;
|
|
63064
|
+
const rect = shadowRoot.host.getBoundingClientRect();
|
|
63065
|
+
const x3 = e4.clientX - rect.left;
|
|
63066
|
+
const y4 = e4.clientY - rect.top;
|
|
63067
|
+
const el = shadowRoot.elementFromPoint(x3, y4);
|
|
63068
|
+
function findScrollable(node) {
|
|
63069
|
+
while (node) {
|
|
63070
|
+
const style2 = getComputedStyle(node);
|
|
63071
|
+
if ((style2.overflowY === "auto" || style2.overflowY === "scroll") && node.scrollHeight > node.clientHeight) {
|
|
63072
|
+
return node;
|
|
63073
|
+
}
|
|
63074
|
+
node = node.parentElement;
|
|
63075
|
+
}
|
|
63076
|
+
return null;
|
|
63077
|
+
}
|
|
63078
|
+
const scrollable = findScrollable(el) || shadowRoot.firstElementChild;
|
|
63079
|
+
if (!scrollable) return;
|
|
63080
|
+
scrollable.scrollTop += e4.deltaY;
|
|
63081
|
+
scrollable.scrollLeft += e4.deltaX;
|
|
63082
|
+
e4.preventDefault();
|
|
63083
|
+
};
|
|
63084
|
+
const container2 = containerRef.current;
|
|
63085
|
+
if (container2) {
|
|
63086
|
+
container2.addEventListener("wheel", handleWheel, { passive: false });
|
|
63087
|
+
}
|
|
63088
|
+
return () => {
|
|
63089
|
+
if (container2) {
|
|
63090
|
+
container2.removeEventListener("wheel", handleWheel);
|
|
63091
|
+
}
|
|
63092
|
+
};
|
|
63093
|
+
}, [containerRef]);
|
|
63092
63094
|
return /* @__PURE__ */ jsxs("div", { className: "w-full h-full flex flex-col items-center justify-center", children: [
|
|
63093
63095
|
/* @__PURE__ */ jsx(
|
|
63094
63096
|
"div",
|
|
@@ -63659,7 +63661,7 @@ const EmailPreview = ({
|
|
|
63659
63661
|
/* @__PURE__ */ jsxs("div", { className: "grid grid-cols-2 gap-6", children: [
|
|
63660
63662
|
/* @__PURE__ */ jsxs("div", { className: "space-y-4", children: [
|
|
63661
63663
|
/* @__PURE__ */ jsxs("div", { children: [
|
|
63662
|
-
/* @__PURE__ */ jsx(Label$1, {
|
|
63664
|
+
/* @__PURE__ */ jsx(Label$1, { children: "From Email" }),
|
|
63663
63665
|
/* @__PURE__ */ jsxs(
|
|
63664
63666
|
Select,
|
|
63665
63667
|
{
|
|
@@ -63694,7 +63696,7 @@ const EmailPreview = ({
|
|
|
63694
63696
|
)
|
|
63695
63697
|
] }),
|
|
63696
63698
|
/* @__PURE__ */ jsxs("div", { children: [
|
|
63697
|
-
/* @__PURE__ */ jsx(Label$1, { className: "
|
|
63699
|
+
/* @__PURE__ */ jsx(Label$1, { className: "", children: /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 py-1", children: [
|
|
63698
63700
|
"From Name",
|
|
63699
63701
|
/* @__PURE__ */ jsx(
|
|
63700
63702
|
InfoTooltip,
|
|
@@ -63716,7 +63718,7 @@ const EmailPreview = ({
|
|
|
63716
63718
|
)
|
|
63717
63719
|
] }),
|
|
63718
63720
|
/* @__PURE__ */ jsxs("div", { children: [
|
|
63719
|
-
/* @__PURE__ */ jsx(Label$1, { className: "
|
|
63721
|
+
/* @__PURE__ */ jsx(Label$1, { className: "", children: /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 py-1", children: [
|
|
63720
63722
|
"Reply To Email",
|
|
63721
63723
|
/* @__PURE__ */ jsx(
|
|
63722
63724
|
InfoTooltip,
|
|
@@ -63745,7 +63747,7 @@ const EmailPreview = ({
|
|
|
63745
63747
|
replyToEmailError && /* @__PURE__ */ jsx("p", { className: "text-sm text-red-500 mt-1", children: replyToEmailError })
|
|
63746
63748
|
] }),
|
|
63747
63749
|
/* @__PURE__ */ jsxs("div", { children: [
|
|
63748
|
-
/* @__PURE__ */ jsx(Label$1, {
|
|
63750
|
+
/* @__PURE__ */ jsx(Label$1, { children: "Subject" }),
|
|
63749
63751
|
/* @__PURE__ */ jsx(
|
|
63750
63752
|
Input,
|
|
63751
63753
|
{
|
|
@@ -63759,7 +63761,7 @@ const EmailPreview = ({
|
|
|
63759
63761
|
] }),
|
|
63760
63762
|
/* @__PURE__ */ jsxs("div", { children: [
|
|
63761
63763
|
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 py-1", children: [
|
|
63762
|
-
/* @__PURE__ */ jsx(Label$1, {
|
|
63764
|
+
/* @__PURE__ */ jsx(Label$1, { children: "Preview Text" }),
|
|
63763
63765
|
/* @__PURE__ */ jsx(InfoTooltip, { title: "This text will be used for the preview text of the email in the inbox" })
|
|
63764
63766
|
] }),
|
|
63765
63767
|
/* @__PURE__ */ jsx(
|
|
@@ -63776,7 +63778,7 @@ const EmailPreview = ({
|
|
|
63776
63778
|
] }),
|
|
63777
63779
|
/* @__PURE__ */ jsxs("div", { className: "border rounded-lg p-4 h-full flex flex-col", children: [
|
|
63778
63780
|
/* @__PURE__ */ jsxs("div", { className: "flex justify-between items-center mb-4", children: [
|
|
63779
|
-
/* @__PURE__ */ jsx("h3", { className: "font-medium
|
|
63781
|
+
/* @__PURE__ */ jsx("h3", { className: "font-medium", children: "Preview" }),
|
|
63780
63782
|
/* @__PURE__ */ jsxs("div", { children: [
|
|
63781
63783
|
/* @__PURE__ */ jsx(
|
|
63782
63784
|
Button$1,
|
|
@@ -64022,7 +64024,7 @@ const SelectEmailOrSMS = ({
|
|
|
64022
64024
|
];
|
|
64023
64025
|
return /* @__PURE__ */ jsxs("div", { className: "space-y-4", children: [
|
|
64024
64026
|
/* @__PURE__ */ jsxs("div", { children: [
|
|
64025
|
-
/* @__PURE__ */ jsx("h3", { className: "text-xl
|
|
64027
|
+
/* @__PURE__ */ jsx("h3", { className: "text-xl font-medium", children: "Message Types" }),
|
|
64026
64028
|
/* @__PURE__ */ jsx("p", { className: "text-gray-600 mb-2 text-sm", children: "Select the channels you want to use in this automation" })
|
|
64027
64029
|
] }),
|
|
64028
64030
|
/* @__PURE__ */ jsx("div", { className: "w-full grid grid-cols-2 gap-3", children: channelOptions.map((option) => /* @__PURE__ */ jsxs(
|
|
@@ -64036,7 +64038,7 @@ const SelectEmailOrSMS = ({
|
|
|
64036
64038
|
toggleSMS();
|
|
64037
64039
|
}
|
|
64038
64040
|
},
|
|
64039
|
-
className: "relative ring-[1px] ring-border rounded-lg px-4 py-3 text-start text-muted-foreground data-[state=checked]:ring-2 data-[state=checked]:ring-primary data-[state=checked]:
|
|
64041
|
+
className: "relative ring-[1px] ring-border rounded-lg px-4 py-3 text-start text-muted-foreground data-[state=checked]:ring-2 data-[state=checked]:ring-primary data-[state=checked]:font-medium",
|
|
64040
64042
|
children: [
|
|
64041
64043
|
/* @__PURE__ */ jsx(option.icon, { className: "mb-3", size: 20 }),
|
|
64042
64044
|
/* @__PURE__ */ jsx("span", { className: "font-medium tracking-tight", children: option.label }),
|
|
@@ -64314,7 +64316,7 @@ const SMSPreview = ({ mergeFieldsResponse, smsChannelSenders }) => {
|
|
|
64314
64316
|
/* @__PURE__ */ jsxs("div", { className: "grid grid-cols-2 gap-6", children: [
|
|
64315
64317
|
/* @__PURE__ */ jsxs("div", { className: "space-y-4", children: [
|
|
64316
64318
|
/* @__PURE__ */ jsxs("div", { children: [
|
|
64317
|
-
/* @__PURE__ */ jsx(Label$1, {
|
|
64319
|
+
/* @__PURE__ */ jsx(Label$1, { children: "From Number" }),
|
|
64318
64320
|
/* @__PURE__ */ jsxs(
|
|
64319
64321
|
Select,
|
|
64320
64322
|
{
|
|
@@ -64331,7 +64333,7 @@ const SMSPreview = ({ mergeFieldsResponse, smsChannelSenders }) => {
|
|
|
64331
64333
|
] }),
|
|
64332
64334
|
/* @__PURE__ */ jsxs("div", { children: [
|
|
64333
64335
|
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 py-1", children: [
|
|
64334
|
-
/* @__PURE__ */ jsx(Label$1, {
|
|
64336
|
+
/* @__PURE__ */ jsx(Label$1, { children: "Company Name" }),
|
|
64335
64337
|
/* @__PURE__ */ jsx(InfoTooltip, { title: "Adding your company name can help customers identify who they are talking to" })
|
|
64336
64338
|
] }),
|
|
64337
64339
|
/* @__PURE__ */ jsx(
|
|
@@ -64350,7 +64352,7 @@ const SMSPreview = ({ mergeFieldsResponse, smsChannelSenders }) => {
|
|
|
64350
64352
|
] }),
|
|
64351
64353
|
/* @__PURE__ */ jsxs("div", { className: "border rounded-lg p-4", children: [
|
|
64352
64354
|
/* @__PURE__ */ jsxs("div", { className: "flex justify-between items-center mb-4", children: [
|
|
64353
|
-
/* @__PURE__ */ jsx("h3", { className: "font-medium
|
|
64355
|
+
/* @__PURE__ */ jsx("h3", { className: "font-medium", children: "Preview" }),
|
|
64354
64356
|
/* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsx(
|
|
64355
64357
|
Button$1,
|
|
64356
64358
|
{
|
|
@@ -64436,7 +64438,7 @@ const TitleAndResetButton = ({ title: title2, type }) => {
|
|
|
64436
64438
|
};
|
|
64437
64439
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
64438
64440
|
/* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between", children: [
|
|
64439
|
-
/* @__PURE__ */ jsx("h4", { className: "text-xl
|
|
64441
|
+
/* @__PURE__ */ jsx("h4", { className: "text-xl font-medium", children: title2 }),
|
|
64440
64442
|
/* @__PURE__ */ jsx("div", { className: "flex items-center gap-2", children: showResetButton && /* @__PURE__ */ jsx(Fragment, { children: loading2 ? /* @__PURE__ */ jsx(BasicLoader, {}) : /* @__PURE__ */ jsx(
|
|
64441
64443
|
Button$1,
|
|
64442
64444
|
{
|
|
@@ -65799,8 +65801,8 @@ const PreviewButton = ({
|
|
|
65799
65801
|
className: "rounded-lg px-3 py-2 flex items-center gap-2 shadow-sm bg-white/80 hover:bg-zinc-100 border border-zinc-200",
|
|
65800
65802
|
onClick,
|
|
65801
65803
|
children: [
|
|
65802
|
-
/* @__PURE__ */ jsx(IconDefinitions.PreviewButton, { className: "w-4 h-4
|
|
65803
|
-
/* @__PURE__ */ jsx("span", { className: "font-medium text-sm
|
|
65804
|
+
/* @__PURE__ */ jsx(IconDefinitions.PreviewButton, { className: "w-4 h-4" }),
|
|
65805
|
+
/* @__PURE__ */ jsx("span", { className: "font-medium text-sm", children: "Preview" })
|
|
65804
65806
|
]
|
|
65805
65807
|
}
|
|
65806
65808
|
);
|
|
@@ -81989,13 +81991,13 @@ const useAutomationStatusToggle = (id2) => {
|
|
|
81989
81991
|
}, [isUpdateSuccess, updateError, toast2]);
|
|
81990
81992
|
return { toggleStatus };
|
|
81991
81993
|
};
|
|
81992
|
-
const DEFAULT_PAGE_SIZE$
|
|
81994
|
+
const DEFAULT_PAGE_SIZE$2 = 10;
|
|
81993
81995
|
function AutomationList() {
|
|
81994
81996
|
const { toast: toast2 } = useToast();
|
|
81995
81997
|
const [updatingId, setUpdatingId] = useState(null);
|
|
81996
81998
|
const { toggleStatus } = useAutomationStatusToggle(updatingId || "");
|
|
81997
81999
|
const navigate = useNavigate();
|
|
81998
|
-
const [pageSizeForQuery, setPageSizeForQuery] = useState(DEFAULT_PAGE_SIZE$
|
|
82000
|
+
const [pageSizeForQuery, setPageSizeForQuery] = useState(DEFAULT_PAGE_SIZE$2);
|
|
81999
82001
|
const [cursorForQuery, setCursorForQuery] = useState(
|
|
82000
82002
|
void 0
|
|
82001
82003
|
);
|
|
@@ -82085,14 +82087,14 @@ function AutomationList() {
|
|
|
82085
82087
|
}
|
|
82086
82088
|
) }) });
|
|
82087
82089
|
}
|
|
82088
|
-
const DEFAULT_PAGE_SIZE$
|
|
82090
|
+
const DEFAULT_PAGE_SIZE$1 = 10;
|
|
82089
82091
|
function BroadcastList() {
|
|
82090
82092
|
const { toast: toast2 } = useToast();
|
|
82091
82093
|
const [createDialogOpen, setCreateDialogOpen] = useState(false);
|
|
82092
82094
|
const [updatingId, setUpdatingId] = useState(null);
|
|
82093
82095
|
const { toggleStatus } = useAutomationStatusToggle(updatingId || "");
|
|
82094
82096
|
const navigate = useNavigate();
|
|
82095
|
-
const [pageSizeForQuery, setPageSizeForQuery] = useState(DEFAULT_PAGE_SIZE$
|
|
82097
|
+
const [pageSizeForQuery, setPageSizeForQuery] = useState(DEFAULT_PAGE_SIZE$1);
|
|
82096
82098
|
const [cursorForQuery, setCursorForQuery] = useState(
|
|
82097
82099
|
void 0
|
|
82098
82100
|
);
|
|
@@ -82146,7 +82148,7 @@ function BroadcastList() {
|
|
|
82146
82148
|
);
|
|
82147
82149
|
const resetListPagination = () => {
|
|
82148
82150
|
setCursorForQuery(void 0);
|
|
82149
|
-
setPageSizeForQuery(DEFAULT_PAGE_SIZE$
|
|
82151
|
+
setPageSizeForQuery(DEFAULT_PAGE_SIZE$1);
|
|
82150
82152
|
setSearchQuery("");
|
|
82151
82153
|
};
|
|
82152
82154
|
const onDialogClose = (result) => {
|
|
@@ -82214,12 +82216,12 @@ function BroadcastList() {
|
|
|
82214
82216
|
)
|
|
82215
82217
|
] });
|
|
82216
82218
|
}
|
|
82217
|
-
const DEFAULT_PAGE_SIZE
|
|
82219
|
+
const DEFAULT_PAGE_SIZE = 10;
|
|
82218
82220
|
function SegmentList() {
|
|
82219
82221
|
const { toast: toast2 } = useToast();
|
|
82220
82222
|
const [createDialogOpen, setCreateDialogOpen] = useState(false);
|
|
82221
82223
|
const [selectedSegment, setSelectedSegment] = useState(null);
|
|
82222
|
-
const [pageSizeForQuery, setPageSizeForQuery] = useState(DEFAULT_PAGE_SIZE
|
|
82224
|
+
const [pageSizeForQuery, setPageSizeForQuery] = useState(DEFAULT_PAGE_SIZE);
|
|
82223
82225
|
const [cursorForQuery, setCursorForQuery] = useState(
|
|
82224
82226
|
void 0
|
|
82225
82227
|
);
|
|
@@ -82273,7 +82275,7 @@ function SegmentList() {
|
|
|
82273
82275
|
);
|
|
82274
82276
|
const resetListPagination = () => {
|
|
82275
82277
|
setCursorForQuery(void 0);
|
|
82276
|
-
setPageSizeForQuery(DEFAULT_PAGE_SIZE
|
|
82278
|
+
setPageSizeForQuery(DEFAULT_PAGE_SIZE);
|
|
82277
82279
|
setSearchQuery("");
|
|
82278
82280
|
};
|
|
82279
82281
|
const onDialogClose = (result) => {
|
|
@@ -82903,59 +82905,14 @@ const AutomationsEditorStatsTab = ({ hideSms, hideSales }) => {
|
|
|
82903
82905
|
}
|
|
82904
82906
|
) });
|
|
82905
82907
|
};
|
|
82906
|
-
const
|
|
82907
|
-
const AutomationRecipientsTable = () => {
|
|
82908
|
+
const AutomationsEditorRecipientsTab = () => {
|
|
82908
82909
|
const automation2 = useAutomation();
|
|
82909
|
-
const [pageSizeForQuery, setPageSizeForQuery] = useState(DEFAULT_PAGE_SIZE);
|
|
82910
|
-
const [cursorForQuery, setCursorForQuery] = useState(
|
|
82911
|
-
void 0
|
|
82912
|
-
);
|
|
82913
|
-
const [searchQuery, setSearchQuery] = useState("");
|
|
82914
82910
|
const {
|
|
82915
|
-
|
|
82911
|
+
recipients,
|
|
82916
82912
|
isLoading: isLoadingRecipients,
|
|
82917
|
-
isFetching,
|
|
82918
|
-
isPlaceholderData,
|
|
82919
82913
|
fetchError
|
|
82920
|
-
} =
|
|
82921
|
-
automationId: automation2?.id ?? "",
|
|
82922
|
-
cursor: cursorForQuery,
|
|
82923
|
-
limit: pageSizeForQuery,
|
|
82924
|
-
search: searchQuery || void 0
|
|
82925
|
-
});
|
|
82926
|
-
const handleQueryParametersChange = useCallback(
|
|
82927
|
-
(params) => {
|
|
82928
|
-
setCursorForQuery(params.cursor);
|
|
82929
|
-
setPageSizeForQuery(params.pageSize);
|
|
82930
|
-
},
|
|
82931
|
-
[]
|
|
82932
|
-
);
|
|
82914
|
+
} = useGetBusinessAutomationRecipients(automation2?.id ?? "");
|
|
82933
82915
|
const columns = [
|
|
82934
|
-
{
|
|
82935
|
-
accessorKey: "communicationsSent",
|
|
82936
|
-
id: "lastCommunication",
|
|
82937
|
-
header: "Updated At",
|
|
82938
|
-
cell: ({ row }) => {
|
|
82939
|
-
const communications = row.original.communicationsSent || [];
|
|
82940
|
-
if (communications.length === 0) {
|
|
82941
|
-
return /* @__PURE__ */ jsx("span", { className: "text-gray-400", children: "None" });
|
|
82942
|
-
}
|
|
82943
|
-
const latestCommunication = communications.reduce(
|
|
82944
|
-
(latest, current) => {
|
|
82945
|
-
if (!latest || !latest.updatedAt) return current;
|
|
82946
|
-
if (!current.updatedAt) return latest;
|
|
82947
|
-
return new Date(current.updatedAt) > new Date(latest.updatedAt) ? current : latest;
|
|
82948
|
-
}
|
|
82949
|
-
);
|
|
82950
|
-
if (!latestCommunication?.updatedAt) {
|
|
82951
|
-
return /* @__PURE__ */ jsx("span", { className: "text-gray-400", children: "Not available" });
|
|
82952
|
-
}
|
|
82953
|
-
return /* @__PURE__ */ jsx("div", { className: "flex items-center gap-2", children: /* @__PURE__ */ jsx("span", { className: "text-sm text-gray-600", children: format$1(
|
|
82954
|
-
new Date(latestCommunication.updatedAt),
|
|
82955
|
-
"MMM d, yyyy h:mm a"
|
|
82956
|
-
) }) });
|
|
82957
|
-
}
|
|
82958
|
-
},
|
|
82959
82916
|
{
|
|
82960
82917
|
accessorFn: (row) => `${row.firstName || ""} ${row.lastName || ""}`.trim(),
|
|
82961
82918
|
id: "name",
|
|
@@ -82976,73 +82933,9 @@ const AutomationRecipientsTable = () => {
|
|
|
82976
82933
|
accessorKey: "phone",
|
|
82977
82934
|
header: "Phone",
|
|
82978
82935
|
cell: ({ row }) => row.original.phone || /* @__PURE__ */ jsx("span", { className: "text-gray-400", children: "Not provided" })
|
|
82979
|
-
},
|
|
82980
|
-
{
|
|
82981
|
-
accessorKey: "communicationsSent",
|
|
82982
|
-
id: "communicationsSent",
|
|
82983
|
-
header: "Communications Sent",
|
|
82984
|
-
cell: ({ row }) => {
|
|
82985
|
-
const communications = row.original.communicationsSent || [];
|
|
82986
|
-
const emailCommunications = communications.filter(
|
|
82987
|
-
(c2) => c2.type === ChannelIntegrationTypeEnum.EMAIL
|
|
82988
|
-
);
|
|
82989
|
-
const smsCommunications = communications.filter(
|
|
82990
|
-
(c2) => c2.type === ChannelIntegrationTypeEnum.SMS
|
|
82991
|
-
);
|
|
82992
|
-
const hasEmail = emailCommunications.length > 0;
|
|
82993
|
-
const hasSms = smsCommunications.length > 0;
|
|
82994
|
-
const emailDelivered = emailCommunications.some((c2) => c2.delivered);
|
|
82995
|
-
const smsDelivered = smsCommunications.some((c2) => c2.delivered);
|
|
82996
|
-
return /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-3", children: [
|
|
82997
|
-
hasEmail && /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-1.5", children: [
|
|
82998
|
-
/* @__PURE__ */ jsxs("div", { className: "relative", children: [
|
|
82999
|
-
/* @__PURE__ */ jsx(
|
|
83000
|
-
IconDefinitions.EmailIcon,
|
|
83001
|
-
{
|
|
83002
|
-
className: `h-4 w-4 ${emailDelivered ? "text-green-500" : "text-gray-400"}`
|
|
83003
|
-
}
|
|
83004
|
-
),
|
|
83005
|
-
emailDelivered && /* @__PURE__ */ jsx("div", { className: "absolute -right-1 -top-1 h-2 w-2 rounded-full bg-green-500 ring-1 ring-white" })
|
|
83006
|
-
] }),
|
|
83007
|
-
/* @__PURE__ */ jsxs("div", { className: "flex flex-col", children: [
|
|
83008
|
-
/* @__PURE__ */ jsx("span", { className: "text-sm font-medium", children: "Email" }),
|
|
83009
|
-
/* @__PURE__ */ jsx(
|
|
83010
|
-
"span",
|
|
83011
|
-
{
|
|
83012
|
-
className: `text-xs ${emailDelivered ? "text-green-600" : "text-gray-500"}`,
|
|
83013
|
-
children: emailDelivered ? "Delivered" : "Pending"
|
|
83014
|
-
}
|
|
83015
|
-
)
|
|
83016
|
-
] })
|
|
83017
|
-
] }),
|
|
83018
|
-
hasEmail && hasSms && /* @__PURE__ */ jsx("div", { className: "h-8 w-px bg-gray-200" }),
|
|
83019
|
-
hasSms && /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-1.5", children: [
|
|
83020
|
-
/* @__PURE__ */ jsxs("div", { className: "relative", children: [
|
|
83021
|
-
/* @__PURE__ */ jsx(
|
|
83022
|
-
IconDefinitions.SmsIcon,
|
|
83023
|
-
{
|
|
83024
|
-
className: `h-4 w-4 ${smsDelivered ? "text-green-500" : "text-gray-400"}`
|
|
83025
|
-
}
|
|
83026
|
-
),
|
|
83027
|
-
smsDelivered && /* @__PURE__ */ jsx("div", { className: "absolute -right-1 -top-1 h-2 w-2 rounded-full bg-green-500 ring-1 ring-white" })
|
|
83028
|
-
] }),
|
|
83029
|
-
/* @__PURE__ */ jsxs("div", { className: "flex flex-col", children: [
|
|
83030
|
-
/* @__PURE__ */ jsx("span", { className: "text-sm font-medium", children: "SMS" }),
|
|
83031
|
-
/* @__PURE__ */ jsx(
|
|
83032
|
-
"span",
|
|
83033
|
-
{
|
|
83034
|
-
className: `text-xs ${smsDelivered ? "text-green-600" : "text-gray-500"}`,
|
|
83035
|
-
children: smsDelivered ? "Delivered" : "Pending"
|
|
83036
|
-
}
|
|
83037
|
-
)
|
|
83038
|
-
] })
|
|
83039
|
-
] }),
|
|
83040
|
-
!hasEmail && !hasSms && /* @__PURE__ */ jsx("span", { className: "text-sm text-gray-400", children: "None" })
|
|
83041
|
-
] });
|
|
83042
|
-
}
|
|
83043
82936
|
}
|
|
83044
82937
|
];
|
|
83045
|
-
if (!automation2 || isLoadingRecipients || !
|
|
82938
|
+
if (!automation2 || isLoadingRecipients || !recipients) {
|
|
83046
82939
|
return /* @__PURE__ */ jsx(BasicLoader, { text: ["Fetching Recipients", "Finishing up"] });
|
|
83047
82940
|
}
|
|
83048
82941
|
if (fetchError) {
|
|
@@ -83051,56 +82944,31 @@ const AutomationRecipientsTable = () => {
|
|
|
83051
82944
|
fetchError.message
|
|
83052
82945
|
] });
|
|
83053
82946
|
}
|
|
83054
|
-
if (!
|
|
82947
|
+
if (!recipients || recipients.recipients.length === 0) {
|
|
83055
82948
|
return /* @__PURE__ */ jsxs("div", { className: "flex flex-col items-center justify-center p-8 text-center", children: [
|
|
83056
82949
|
/* @__PURE__ */ jsx("div", { className: "mb-4", children: /* @__PURE__ */ jsx(IconDefinitions.UserIcon, { className: "h-12 w-12 text-gray-400" }) }),
|
|
83057
|
-
/* @__PURE__ */ jsx("h3", { className: "mb-2 text-lg font-semibold text-gray-700", children: "No
|
|
82950
|
+
/* @__PURE__ */ jsx("h3", { className: "mb-2 text-lg font-semibold text-gray-700", children: "No Recipients Found" }),
|
|
83058
82951
|
/* @__PURE__ */ jsxs("p", { className: "text-gray-500", children: [
|
|
83059
|
-
"This",
|
|
82952
|
+
"This ",
|
|
82953
|
+
t$1("engage:automation"),
|
|
82954
|
+
" currently has no assigned recipients. Please update the include or exclude",
|
|
83060
82955
|
" ",
|
|
83061
|
-
|
|
83062
|
-
" "
|
|
83063
|
-
"hasn't sent any communications yet. Please check back later to see recipient details once communications have been sent."
|
|
82956
|
+
t$1("engage:segment", { count: 2 }),
|
|
82957
|
+
" to add recipients."
|
|
83064
82958
|
] })
|
|
83065
82959
|
] });
|
|
83066
82960
|
}
|
|
83067
82961
|
return /* @__PURE__ */ jsx("div", { className: "h-full p-4", children: /* @__PURE__ */ jsx(
|
|
83068
82962
|
TanstackTable,
|
|
83069
82963
|
{
|
|
83070
|
-
data:
|
|
82964
|
+
data: recipients.recipients,
|
|
83071
82965
|
columns,
|
|
83072
|
-
paginationMode: "
|
|
83073
|
-
initialPageSize:
|
|
83074
|
-
isLoading: isLoadingRecipients
|
|
83075
|
-
cursorPaginationQueryResult: {
|
|
83076
|
-
nextCursor: sentCommunications.pagination.cursor,
|
|
83077
|
-
isLoading: isLoadingRecipients,
|
|
83078
|
-
isFetching,
|
|
83079
|
-
isPlaceholderData
|
|
83080
|
-
},
|
|
83081
|
-
onQueryParametersChange: handleQueryParametersChange,
|
|
83082
|
-
searchValue: searchQuery,
|
|
83083
|
-
onSearchChange: setSearchQuery
|
|
82966
|
+
paginationMode: "standard",
|
|
82967
|
+
initialPageSize: 10,
|
|
82968
|
+
isLoading: isLoadingRecipients
|
|
83084
82969
|
}
|
|
83085
82970
|
) });
|
|
83086
82971
|
};
|
|
83087
|
-
const AutomationsEditorRecipientsTab = () => {
|
|
83088
|
-
const automation2 = useAutomation();
|
|
83089
|
-
if (automation2?.triggerType === AutomationTriggerType.ONE_TIME && automation2?.status === AutomationStatus.DRAFT) {
|
|
83090
|
-
return /* @__PURE__ */ jsxs("div", { className: "flex flex-col items-center justify-center p-8 text-center", children: [
|
|
83091
|
-
/* @__PURE__ */ jsx("div", { className: "mb-4", children: /* @__PURE__ */ jsx(IconDefinitions.UserIcon, { className: "h-12 w-12 text-gray-400" }) }),
|
|
83092
|
-
/* @__PURE__ */ jsx("h3", { className: "mb-2 text-lg font-semibold text-gray-700", children: "No Recipients Available Yet" }),
|
|
83093
|
-
/* @__PURE__ */ jsxs("p", { className: "text-gray-500", children: [
|
|
83094
|
-
"Recipients will be available once this",
|
|
83095
|
-
" ",
|
|
83096
|
-
automation2.triggerType === AutomationTriggerType.ONE_TIME ? t$1("engage:one_time") : t$1("engage:automation"),
|
|
83097
|
-
" ",
|
|
83098
|
-
"has completed running. Please check back after the automation has finished."
|
|
83099
|
-
] })
|
|
83100
|
-
] });
|
|
83101
|
-
}
|
|
83102
|
-
return /* @__PURE__ */ jsx(AutomationRecipientsTable, {});
|
|
83103
|
-
};
|
|
83104
82972
|
const PanelGroupContext = createContext$1(null);
|
|
83105
82973
|
PanelGroupContext.displayName = "PanelGroupContext";
|
|
83106
82974
|
const DATA_ATTRIBUTES = {
|