@embedreach/components 0.3.17 → 0.3.18
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 +132 -49
- package/dist/index.umd.js +10 -10
- package/package.json +1 -1
package/dist/chunks/index.js
CHANGED
|
@@ -3233,6 +3233,7 @@ const useGetBusinessAutomationSentCommunications = (args) => {
|
|
|
3233
3233
|
return {
|
|
3234
3234
|
// Get automation sent communications query
|
|
3235
3235
|
sentCommunications: getSentCommunicationsQuery.data,
|
|
3236
|
+
totalCount: getSentCommunicationsQuery.data?.pagination.total ?? null,
|
|
3236
3237
|
isFetching: getSentCommunicationsQuery.isFetching,
|
|
3237
3238
|
isLoading: getSentCommunicationsQuery.isLoading,
|
|
3238
3239
|
isPlaceholderData: getSentCommunicationsQuery.isPlaceholderData,
|
|
@@ -3314,6 +3315,8 @@ const useListBusinessAutomations = (args) => {
|
|
|
3314
3315
|
// The cursor to be used to fetch the *next* page of results.
|
|
3315
3316
|
// Null or undefined if there are no more pages.
|
|
3316
3317
|
nextCursor: query.data?.pagination.cursor ?? null,
|
|
3318
|
+
// Total count of items for pagination display
|
|
3319
|
+
totalCount: query.data?.pagination.total ?? null,
|
|
3317
3320
|
isLoading: query.isLoading,
|
|
3318
3321
|
error: query.error,
|
|
3319
3322
|
isFetching: query.isFetching,
|
|
@@ -49151,6 +49154,8 @@ const useListSegments = (params) => {
|
|
|
49151
49154
|
// The cursor to be used to fetch the *next* page of results.
|
|
49152
49155
|
// Null or undefined if there are no more pages.
|
|
49153
49156
|
nextCursor: query.data?.pagination.cursor ?? null,
|
|
49157
|
+
// Total count of items for pagination display
|
|
49158
|
+
totalCount: query.data?.pagination.total ?? null,
|
|
49154
49159
|
isLoading: query.isLoading,
|
|
49155
49160
|
error: query.error,
|
|
49156
49161
|
isFetching: query.isFetching,
|
|
@@ -52901,7 +52906,7 @@ function useTanstackTable({
|
|
|
52901
52906
|
columns,
|
|
52902
52907
|
enableDebug = false,
|
|
52903
52908
|
paginationMode = "none",
|
|
52904
|
-
initialPageSize =
|
|
52909
|
+
initialPageSize = 20,
|
|
52905
52910
|
initialPageIndex = 0,
|
|
52906
52911
|
cursorPaginationQueryResult,
|
|
52907
52912
|
onQueryParametersChange,
|
|
@@ -53180,6 +53185,25 @@ function SortingHeader({
|
|
|
53180
53185
|
)
|
|
53181
53186
|
] });
|
|
53182
53187
|
}
|
|
53188
|
+
const formatValue = (value, options = {}) => {
|
|
53189
|
+
const { decimals = 0, suffix = "", useLocale = false } = options;
|
|
53190
|
+
const num = Number(value);
|
|
53191
|
+
if (!value || Number.isNaN(num)) {
|
|
53192
|
+
return `0${decimals > 0 ? "." + "0".repeat(decimals) : ""}${suffix}`;
|
|
53193
|
+
}
|
|
53194
|
+
let formatted;
|
|
53195
|
+
if (useLocale) {
|
|
53196
|
+
formatted = num.toLocaleString(void 0, {
|
|
53197
|
+
minimumFractionDigits: decimals,
|
|
53198
|
+
maximumFractionDigits: decimals
|
|
53199
|
+
});
|
|
53200
|
+
} else if (decimals > 0) {
|
|
53201
|
+
formatted = num.toFixed(decimals);
|
|
53202
|
+
} else {
|
|
53203
|
+
formatted = Math.round(num).toString();
|
|
53204
|
+
}
|
|
53205
|
+
return `${formatted}${suffix}`;
|
|
53206
|
+
};
|
|
53183
53207
|
function DebouncedInput({
|
|
53184
53208
|
value: initialValue,
|
|
53185
53209
|
onChange,
|
|
@@ -53207,7 +53231,8 @@ function TanstackTable({
|
|
|
53207
53231
|
columns,
|
|
53208
53232
|
enableDebug = false,
|
|
53209
53233
|
paginationMode = "none",
|
|
53210
|
-
initialPageSize =
|
|
53234
|
+
initialPageSize = 20,
|
|
53235
|
+
totalCount,
|
|
53211
53236
|
initialPageIndex = 0,
|
|
53212
53237
|
headerActions,
|
|
53213
53238
|
isLoading = false,
|
|
@@ -53260,7 +53285,8 @@ function TanstackTable({
|
|
|
53260
53285
|
manualSorting,
|
|
53261
53286
|
enableSortingRemoval,
|
|
53262
53287
|
onSortingChange: handleSortingChangeInternal,
|
|
53263
|
-
manualFiltering
|
|
53288
|
+
manualFiltering,
|
|
53289
|
+
manualPageCount: totalCount ? Math.ceil(totalCount / initialPageSize) : void 0
|
|
53264
53290
|
});
|
|
53265
53291
|
const scrollContainerRef = useRef(null);
|
|
53266
53292
|
const [isScrolled, setIsScrolled] = useState(false);
|
|
@@ -53338,7 +53364,20 @@ function TanstackTable({
|
|
|
53338
53364
|
))
|
|
53339
53365
|
},
|
|
53340
53366
|
row.id
|
|
53341
|
-
)) : /* @__PURE__ */ jsx(TableRow, { children: /* @__PURE__ */ jsx(TableCell, { colSpan: columns.length, className: "h-24 text-center", children: "No results found" }) }) })
|
|
53367
|
+
)) : /* @__PURE__ */ jsx(TableRow, { children: /* @__PURE__ */ jsx(TableCell, { colSpan: columns.length, className: "h-24 text-center", children: "No results found" }) }) }),
|
|
53368
|
+
enableFooter && !!data?.length && /* @__PURE__ */ jsx(TableFooter, { className: "sticky bottom-0 z-10 bg-card border-t", children: table.getFooterGroups().map((footerGroup) => /* @__PURE__ */ jsx(TableRow, { children: footerGroup.headers.map((header2) => /* @__PURE__ */ jsx(
|
|
53369
|
+
TableHead,
|
|
53370
|
+
{
|
|
53371
|
+
colSpan: header2.colSpan,
|
|
53372
|
+
style: { width: header2.getSize() },
|
|
53373
|
+
className: "bg-card text-card-foreground font-medium",
|
|
53374
|
+
children: header2.isPlaceholder ? null : flexRender(
|
|
53375
|
+
header2.column.columnDef.footer,
|
|
53376
|
+
header2.getContext()
|
|
53377
|
+
)
|
|
53378
|
+
},
|
|
53379
|
+
header2.id
|
|
53380
|
+
)) }, footerGroup.id)) })
|
|
53342
53381
|
] });
|
|
53343
53382
|
const TableSkeleton = () => /* @__PURE__ */ jsx("div", { className: "h-full w-full flex items-center justify-center min-h-[250px]", children: /* @__PURE__ */ jsx(BasicLoader, {}) });
|
|
53344
53383
|
const isTableLoading = hideLoadingState ? isLoading && (!data || data.length === 0) : isLoading;
|
|
@@ -53358,8 +53397,8 @@ function TanstackTable({
|
|
|
53358
53397
|
/* @__PURE__ */ jsx(LoaderCircle, { className: "h-4 w-4 animate-spin text-primary" }),
|
|
53359
53398
|
/* @__PURE__ */ jsx("span", { className: "text-sm text-foreground", children: "Loading..." })
|
|
53360
53399
|
] }) }),
|
|
53361
|
-
(onSearchChange || isStandardPagination || isCursorPagination) && !isTableLoading && /* @__PURE__ */ jsx("div", { className: "sticky top-0 z-20 bg-card border-b px-4 py-3", children: /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between", children: [
|
|
53362
|
-
|
|
53400
|
+
(onSearchChange || isStandardPagination || isCursorPagination) && !isTableLoading && /* @__PURE__ */ jsx("div", { className: "sticky top-0 z-20 bg-card border-b px-4 py-3", children: /* @__PURE__ */ jsxs("div", { className: "flex flex-col sm:flex-row sm:items-center sm:justify-between gap-4", children: [
|
|
53401
|
+
onSearchChange && /* @__PURE__ */ jsxs("div", { className: "relative w-full sm:w-auto", children: [
|
|
53363
53402
|
/* @__PURE__ */ jsx(
|
|
53364
53403
|
DebouncedInput,
|
|
53365
53404
|
{
|
|
@@ -53385,7 +53424,7 @@ function TanstackTable({
|
|
|
53385
53424
|
}
|
|
53386
53425
|
},
|
|
53387
53426
|
className: cn$1(
|
|
53388
|
-
"w-80 h-9 text-sm border border-border rounded-md px-3 bg-background text-foreground placeholder:text-muted-foreground focus:outline-none focus:ring-1 focus:ring-ring",
|
|
53427
|
+
"w-full sm:w-80 h-9 text-sm border border-border rounded-md px-3 bg-background text-foreground placeholder:text-muted-foreground focus:outline-none focus:ring-1 focus:ring-ring",
|
|
53389
53428
|
isFetching && "pr-10"
|
|
53390
53429
|
// Add padding for spinner
|
|
53391
53430
|
),
|
|
@@ -53394,31 +53433,32 @@ function TanstackTable({
|
|
|
53394
53433
|
}
|
|
53395
53434
|
),
|
|
53396
53435
|
!hideLoadingState && isFetching && /* @__PURE__ */ jsx("div", { className: "absolute right-3 top-1/2 transform -translate-y-1/2", children: /* @__PURE__ */ jsx(LoaderCircle, { className: "h-4 w-4 animate-spin text-muted-foreground" }) })
|
|
53397
|
-
] })
|
|
53436
|
+
] }),
|
|
53398
53437
|
/* @__PURE__ */ jsx("div", { children: (isStandardPagination || isCursorPagination) && /* @__PURE__ */ jsxs("div", { className: "flex items-center space-x-4", children: [
|
|
53399
53438
|
/* @__PURE__ */ jsx("div", { className: "text-sm text-muted-foreground", children: (() => {
|
|
53400
|
-
if (paginationMode === "cursor") {
|
|
53401
|
-
return null;
|
|
53402
|
-
}
|
|
53403
|
-
const totalRows = table.getPrePaginationRowModel().rows.length;
|
|
53404
53439
|
const currentPageRows = table.getRowModel().rows.length;
|
|
53405
|
-
|
|
53406
|
-
|
|
53440
|
+
const total = totalCount && totalCount > 0 ? formatValue(totalCount, {
|
|
53441
|
+
decimals: 0,
|
|
53442
|
+
useLocale: true
|
|
53443
|
+
}) : table.getPrePaginationRowModel().rows.length;
|
|
53444
|
+
if (currentPageRows === 0) {
|
|
53445
|
+
return null;
|
|
53407
53446
|
}
|
|
53408
|
-
const
|
|
53409
|
-
const
|
|
53447
|
+
const logicalPageNumber = isCursorPagination ? table.logicalPage ?? 0 : pageIndex;
|
|
53448
|
+
const startItem = logicalPageNumber * pageSize + 1;
|
|
53449
|
+
const endItem = logicalPageNumber * pageSize + currentPageRows;
|
|
53410
53450
|
return /* @__PURE__ */ jsxs("span", { children: [
|
|
53411
53451
|
"Showing ",
|
|
53412
53452
|
startItem,
|
|
53413
53453
|
"–",
|
|
53414
53454
|
endItem,
|
|
53415
53455
|
" of ",
|
|
53416
|
-
|
|
53456
|
+
total,
|
|
53417
53457
|
" items"
|
|
53418
53458
|
] });
|
|
53419
53459
|
})() }),
|
|
53420
53460
|
/* @__PURE__ */ jsxs("div", { className: "flex items-center space-x-2", children: [
|
|
53421
|
-
/* @__PURE__ */
|
|
53461
|
+
/* @__PURE__ */ jsx(
|
|
53422
53462
|
Button$1,
|
|
53423
53463
|
{
|
|
53424
53464
|
"data-testid": "previous-button",
|
|
@@ -53432,13 +53472,10 @@ function TanstackTable({
|
|
|
53432
53472
|
}
|
|
53433
53473
|
},
|
|
53434
53474
|
disabled: !actualCanPreviousPage || (hideLoadingState ? false : isLoading || isFetching),
|
|
53435
|
-
children:
|
|
53436
|
-
/* @__PURE__ */ jsx(ChevronLeft, { className: "h-4 w-4 mr-1" }),
|
|
53437
|
-
"Previous"
|
|
53438
|
-
]
|
|
53475
|
+
children: /* @__PURE__ */ jsx(ChevronLeft, { className: "h-4 w-4 mr-1" })
|
|
53439
53476
|
}
|
|
53440
53477
|
),
|
|
53441
|
-
/* @__PURE__ */
|
|
53478
|
+
/* @__PURE__ */ jsx(
|
|
53442
53479
|
Button$1,
|
|
53443
53480
|
{
|
|
53444
53481
|
"data-testid": "next-button",
|
|
@@ -53452,10 +53489,7 @@ function TanstackTable({
|
|
|
53452
53489
|
}
|
|
53453
53490
|
},
|
|
53454
53491
|
disabled: !actualCanNextPage || (hideLoadingState ? false : isLoading || isFetching),
|
|
53455
|
-
children:
|
|
53456
|
-
"Next",
|
|
53457
|
-
/* @__PURE__ */ jsx(ChevronRight, { className: "h-4 w-4 ml-1" })
|
|
53458
|
-
]
|
|
53492
|
+
children: /* @__PURE__ */ jsx(ChevronRight, { className: "h-4 w-4 ml-1" })
|
|
53459
53493
|
}
|
|
53460
53494
|
)
|
|
53461
53495
|
] })
|
|
@@ -53470,18 +53504,6 @@ function TanstackTable({
|
|
|
53470
53504
|
children: isTableLoading ? /* @__PURE__ */ jsx(TableSkeleton, {}) : /* @__PURE__ */ jsx(TableContent, {})
|
|
53471
53505
|
}
|
|
53472
53506
|
),
|
|
53473
|
-
enableFooter && !isTableLoading && !!data?.length && /* @__PURE__ */ jsx("div", { className: "sticky bottom-0 z-10 bg-card border-t", children: /* @__PURE__ */ jsx("div", { className: "w-full overflow-x-auto", children: /* @__PURE__ */ jsx(Table$1, { className: "table-fixed", children: /* @__PURE__ */ jsx(TableFooter, { children: table.getFooterGroups().map((footerGroup) => /* @__PURE__ */ jsx(TableRow, { children: footerGroup.headers.map((header2) => /* @__PURE__ */ jsx(
|
|
53474
|
-
TableHead,
|
|
53475
|
-
{
|
|
53476
|
-
colSpan: header2.colSpan,
|
|
53477
|
-
style: { width: header2.getSize() },
|
|
53478
|
-
children: header2.isPlaceholder ? null : flexRender(
|
|
53479
|
-
header2.column.columnDef.footer,
|
|
53480
|
-
header2.getContext()
|
|
53481
|
-
)
|
|
53482
|
-
},
|
|
53483
|
-
header2.id
|
|
53484
|
-
)) }, footerGroup.id)) }) }) }) }),
|
|
53485
53507
|
enableDebug && /* @__PURE__ */ jsx("div", { className: "mt-4", children: /* @__PURE__ */ jsx("pre", { className: "p-2 bg-gray-50 text-xs overflow-x-auto", children: /* @__PURE__ */ jsx("code", { children: JSON.stringify(table.getState(), null, 2) }) }) })
|
|
53486
53508
|
] });
|
|
53487
53509
|
}
|
|
@@ -102536,6 +102558,8 @@ const ChannelToggleButton = ({
|
|
|
102536
102558
|
isUpdating,
|
|
102537
102559
|
onToggle
|
|
102538
102560
|
}) => {
|
|
102561
|
+
const automation2 = useAutomation();
|
|
102562
|
+
const disableToggle = !automation2 || automation2.status !== AutomationStatus.DRAFT;
|
|
102539
102563
|
return /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
|
|
102540
102564
|
/* @__PURE__ */ jsx(
|
|
102541
102565
|
Switch,
|
|
@@ -102546,7 +102570,7 @@ const ChannelToggleButton = ({
|
|
|
102546
102570
|
onToggle();
|
|
102547
102571
|
}
|
|
102548
102572
|
},
|
|
102549
|
-
disabled: isUpdating,
|
|
102573
|
+
disabled: isUpdating || disableToggle,
|
|
102550
102574
|
className: "data-[state=checked]:bg-green-500 data-[state=unchecked]:bg-gray-300"
|
|
102551
102575
|
}
|
|
102552
102576
|
),
|
|
@@ -103724,16 +103748,14 @@ const AutomationEditorSMSPreview = ({
|
|
|
103724
103748
|
() => communicationGroup?.textMessageMediaUrls ?? [],
|
|
103725
103749
|
[communicationGroup?.textMessageMediaUrls]
|
|
103726
103750
|
);
|
|
103751
|
+
const isLoading = !communicationGroup || !channelSenders || !channelAccounts;
|
|
103727
103752
|
const dynamicMergeFieldImages = useMemo(() => {
|
|
103728
103753
|
return getDynamicMergeFieldImages(smsBody);
|
|
103729
103754
|
}, [getDynamicMergeFieldImages, smsBody]);
|
|
103730
103755
|
const allImageUrls = useMemo(() => {
|
|
103731
|
-
|
|
103732
|
-
|
|
103733
|
-
...imageUrls
|
|
103734
|
-
];
|
|
103756
|
+
const dynamicUrls = dynamicMergeFieldImages.map((img) => img.placeholderUrl);
|
|
103757
|
+
return [...dynamicUrls, ...imageUrls];
|
|
103735
103758
|
}, [imageUrls, dynamicMergeFieldImages]);
|
|
103736
|
-
const isLoading = !communicationGroup || !channelSenders || !channelAccounts;
|
|
103737
103759
|
const lastValidCompanyName = useRef(null);
|
|
103738
103760
|
const lastChangeTime = useRef(0);
|
|
103739
103761
|
const companyName = useMemo(() => {
|
|
@@ -103868,7 +103890,17 @@ const AutomationEditorSMSPreview = ({
|
|
|
103868
103890
|
if (prevWithoutCompany === nextWithoutCompany) {
|
|
103869
103891
|
return true;
|
|
103870
103892
|
}
|
|
103871
|
-
|
|
103893
|
+
const prevImageUrls = prevProps.imageUrls || [];
|
|
103894
|
+
const nextImageUrls = nextProps.imageUrls || [];
|
|
103895
|
+
if (prevImageUrls.length !== nextImageUrls.length) {
|
|
103896
|
+
return false;
|
|
103897
|
+
}
|
|
103898
|
+
for (let i3 = 0; i3 < prevImageUrls.length; i3++) {
|
|
103899
|
+
if (prevImageUrls[i3] !== nextImageUrls[i3]) {
|
|
103900
|
+
return false;
|
|
103901
|
+
}
|
|
103902
|
+
}
|
|
103903
|
+
return true;
|
|
103872
103904
|
});
|
|
103873
103905
|
return /* @__PURE__ */ jsx("div", { className: "h-full", children: hasAnySMSsenders === false ? /* @__PURE__ */ jsx("div", { className: "w-full pt-8 mx-auto", children: /* @__PURE__ */ jsx(SMSSetup, {}) }) : /* @__PURE__ */ jsxs(
|
|
103874
103906
|
motion.div,
|
|
@@ -103968,7 +104000,7 @@ const AutomationEditorSMSPreview = ({
|
|
|
103968
104000
|
)
|
|
103969
104001
|
] })
|
|
103970
104002
|
] }),
|
|
103971
|
-
/* @__PURE__ */ jsx(
|
|
104003
|
+
isLoading ? /* @__PURE__ */ jsx("div", { className: "flex items-center justify-center h-32", children: /* @__PURE__ */ jsx("div", { className: "text-sm text-muted-foreground", children: "Loading preview..." }) }) : /* @__PURE__ */ jsx(
|
|
103972
104004
|
MemoizedSMSPreview,
|
|
103973
104005
|
{
|
|
103974
104006
|
body: finalSMSBody,
|
|
@@ -111115,6 +111147,7 @@ function AutomationList() {
|
|
|
111115
111147
|
const {
|
|
111116
111148
|
automations,
|
|
111117
111149
|
nextCursor,
|
|
111150
|
+
totalCount,
|
|
111118
111151
|
isLoading,
|
|
111119
111152
|
error: error2,
|
|
111120
111153
|
isFetching,
|
|
@@ -111209,6 +111242,7 @@ function AutomationList() {
|
|
|
111209
111242
|
data: mappedItems,
|
|
111210
111243
|
columns,
|
|
111211
111244
|
paginationMode: "cursor",
|
|
111245
|
+
totalCount: totalCount ?? void 0,
|
|
111212
111246
|
initialPageSize: pageSizeForQuery,
|
|
111213
111247
|
isLoading: isLoading && !isPlaceholderData,
|
|
111214
111248
|
onRowClick: (row) => {
|
|
@@ -111251,6 +111285,7 @@ function BroadcastList() {
|
|
|
111251
111285
|
const [searchQuery, setSearchQuery] = useState("");
|
|
111252
111286
|
const {
|
|
111253
111287
|
automations,
|
|
111288
|
+
totalCount,
|
|
111254
111289
|
nextCursor,
|
|
111255
111290
|
isLoading,
|
|
111256
111291
|
error: error2,
|
|
@@ -111409,6 +111444,7 @@ function BroadcastList() {
|
|
|
111409
111444
|
paginationMode: "cursor",
|
|
111410
111445
|
initialPageSize: pageSizeForQuery,
|
|
111411
111446
|
isLoading: isLoading && !isPlaceholderData,
|
|
111447
|
+
totalCount: totalCount ?? void 0,
|
|
111412
111448
|
cursorPaginationQueryResult: {
|
|
111413
111449
|
nextCursor,
|
|
111414
111450
|
isLoading,
|
|
@@ -111444,7 +111480,14 @@ function SegmentList() {
|
|
|
111444
111480
|
void 0
|
|
111445
111481
|
);
|
|
111446
111482
|
const [searchQuery, setSearchQuery] = useState("");
|
|
111447
|
-
const {
|
|
111483
|
+
const {
|
|
111484
|
+
segments,
|
|
111485
|
+
isLoading,
|
|
111486
|
+
nextCursor,
|
|
111487
|
+
totalCount,
|
|
111488
|
+
isFetching,
|
|
111489
|
+
isPlaceholderData
|
|
111490
|
+
} = useListSegments({
|
|
111448
111491
|
search: searchQuery || void 0,
|
|
111449
111492
|
cursor: cursorForQuery,
|
|
111450
111493
|
limit: pageSizeForQuery
|
|
@@ -111500,6 +111543,7 @@ function SegmentList() {
|
|
|
111500
111543
|
paginationMode: "cursor",
|
|
111501
111544
|
initialPageSize: pageSizeForQuery,
|
|
111502
111545
|
isLoading: isLoading && !isPlaceholderData,
|
|
111546
|
+
totalCount: totalCount ?? void 0,
|
|
111503
111547
|
cursorPaginationQueryResult: {
|
|
111504
111548
|
nextCursor,
|
|
111505
111549
|
isLoading,
|
|
@@ -112956,6 +113000,7 @@ const AutomationRecipientsTable = () => {
|
|
|
112956
113000
|
const [searchQuery, setSearchQuery] = useState("");
|
|
112957
113001
|
const {
|
|
112958
113002
|
sentCommunications,
|
|
113003
|
+
totalCount,
|
|
112959
113004
|
isLoading: isLoadingRecipients,
|
|
112960
113005
|
isFetching,
|
|
112961
113006
|
isPlaceholderData,
|
|
@@ -113109,6 +113154,7 @@ const AutomationRecipientsTable = () => {
|
|
|
113109
113154
|
{
|
|
113110
113155
|
data: sentCommunications?.results || [],
|
|
113111
113156
|
columns,
|
|
113157
|
+
totalCount: totalCount ?? void 0,
|
|
113112
113158
|
paginationMode: "cursor",
|
|
113113
113159
|
initialPageSize: pageSizeForQuery,
|
|
113114
113160
|
isLoading: isLoadingRecipients && !isPlaceholderData,
|
|
@@ -115572,6 +115618,40 @@ const AutomationEditorTrigger = () => {
|
|
|
115572
115618
|
};
|
|
115573
115619
|
return /* @__PURE__ */ jsx(Fragment$1, { children: renderTriggerData() });
|
|
115574
115620
|
};
|
|
115621
|
+
const safelyTruncateWithMergeFields = (text2, maxLength) => {
|
|
115622
|
+
if (text2.length <= maxLength) {
|
|
115623
|
+
return text2;
|
|
115624
|
+
}
|
|
115625
|
+
const mergeFieldRegex = /\{\{[^}]+\}\}/g;
|
|
115626
|
+
const mergeFields = [];
|
|
115627
|
+
let match2;
|
|
115628
|
+
while ((match2 = mergeFieldRegex.exec(text2)) !== null) {
|
|
115629
|
+
mergeFields.push({
|
|
115630
|
+
start: match2.index,
|
|
115631
|
+
end: match2.index + match2[0].length,
|
|
115632
|
+
field: match2[0]
|
|
115633
|
+
});
|
|
115634
|
+
}
|
|
115635
|
+
let truncationPoint = maxLength;
|
|
115636
|
+
for (const mergeField of mergeFields) {
|
|
115637
|
+
if (truncationPoint > mergeField.start && truncationPoint < mergeField.end) {
|
|
115638
|
+
truncationPoint = mergeField.start;
|
|
115639
|
+
break;
|
|
115640
|
+
}
|
|
115641
|
+
if (truncationPoint === mergeField.start) {
|
|
115642
|
+
const lastSpace = text2.lastIndexOf(" ", mergeField.start - 1);
|
|
115643
|
+
truncationPoint = lastSpace > 0 ? lastSpace : mergeField.start;
|
|
115644
|
+
break;
|
|
115645
|
+
}
|
|
115646
|
+
}
|
|
115647
|
+
if (truncationPoint === 0) {
|
|
115648
|
+
if (mergeFields.length > 0) {
|
|
115649
|
+
return mergeFields[0].field;
|
|
115650
|
+
}
|
|
115651
|
+
return text2.substring(0, Math.min(maxLength, text2.length));
|
|
115652
|
+
}
|
|
115653
|
+
return text2.substring(0, truncationPoint) + "...";
|
|
115654
|
+
};
|
|
115575
115655
|
const AutomationEditorSubStep = ({
|
|
115576
115656
|
type,
|
|
115577
115657
|
actionId
|
|
@@ -115702,7 +115782,10 @@ const AutomationEditorSubStep = ({
|
|
|
115702
115782
|
) : isGettingMergeFields ? /* @__PURE__ */ jsx("span", { className: "text-[10px] font-medium text-muted-foreground", children: "..." }) : /* @__PURE__ */ jsx(
|
|
115703
115783
|
MergeFieldRenderer,
|
|
115704
115784
|
{
|
|
115705
|
-
content: communicationGroup?.smsMessageBody ?
|
|
115785
|
+
content: communicationGroup?.smsMessageBody ? safelyTruncateWithMergeFields(
|
|
115786
|
+
communicationGroup.smsMessageBody,
|
|
115787
|
+
40
|
|
115788
|
+
) : "No message set",
|
|
115706
115789
|
mergeFieldsResponse: getMergeFields2,
|
|
115707
115790
|
variant: "minimal",
|
|
115708
115791
|
className: "text-[10px] font-medium text-muted-foreground"
|