@embedreach/components 0.2.70 → 0.2.72
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 +105 -69
- package/dist/index.umd.js +1 -1
- package/package.json +1 -1
package/dist/chunks/index.js
CHANGED
|
@@ -77831,23 +77831,6 @@ const SMSPreview = ({ mergeFieldsResponse }) => {
|
|
|
77831
77831
|
smsApplication
|
|
77832
77832
|
});
|
|
77833
77833
|
}, [channelSenders, channelAccounts, smsApplication]);
|
|
77834
|
-
useEffect(() => {
|
|
77835
|
-
if (showSmsEditor) {
|
|
77836
|
-
if (editingMessage === null) {
|
|
77837
|
-
setEditingMessage(message2);
|
|
77838
|
-
}
|
|
77839
|
-
if (imageUrls.length > 0 && !imagePreview && !isRemovingImage) {
|
|
77840
|
-
setImagePreview(imageUrls[0]);
|
|
77841
|
-
}
|
|
77842
|
-
}
|
|
77843
|
-
}, [
|
|
77844
|
-
showSmsEditor,
|
|
77845
|
-
message2,
|
|
77846
|
-
imageUrls,
|
|
77847
|
-
imagePreview,
|
|
77848
|
-
isRemovingImage,
|
|
77849
|
-
editingMessage
|
|
77850
|
-
]);
|
|
77851
77834
|
useEffect(() => {
|
|
77852
77835
|
if (!showSmsEditor) {
|
|
77853
77836
|
setImagePreview(imageUrls.length > 0 ? imageUrls[0] : null);
|
|
@@ -77855,6 +77838,11 @@ const SMSPreview = ({ mergeFieldsResponse }) => {
|
|
|
77855
77838
|
setIsRemovingImage(false);
|
|
77856
77839
|
}
|
|
77857
77840
|
}, [showSmsEditor, imageUrls]);
|
|
77841
|
+
useEffect(() => {
|
|
77842
|
+
if (communicationGroup?.textMessageMediaUrls) {
|
|
77843
|
+
setImageUrls(communicationGroup.textMessageMediaUrls);
|
|
77844
|
+
}
|
|
77845
|
+
}, [communicationGroup?.textMessageMediaUrls]);
|
|
77858
77846
|
const handleSaveSMS = () => {
|
|
77859
77847
|
if (editingMessage && editingMessage.length > SMS_ABSOLUTE_LIMIT) {
|
|
77860
77848
|
toast2({
|
|
@@ -77863,6 +77851,13 @@ const SMSPreview = ({ mergeFieldsResponse }) => {
|
|
|
77863
77851
|
});
|
|
77864
77852
|
return;
|
|
77865
77853
|
}
|
|
77854
|
+
if (editingMessage === null || editingMessage.length === 0) {
|
|
77855
|
+
toast2({
|
|
77856
|
+
title: "Oops",
|
|
77857
|
+
description: "Please enter a message"
|
|
77858
|
+
});
|
|
77859
|
+
return;
|
|
77860
|
+
}
|
|
77866
77861
|
setMessage(editingMessage);
|
|
77867
77862
|
const communicationGroupId = _getCommunicationGroupFromAutomation();
|
|
77868
77863
|
if (communicationGroupId) {
|
|
@@ -77903,12 +77898,36 @@ const SMSPreview = ({ mergeFieldsResponse }) => {
|
|
|
77903
77898
|
setIsRemovingImage(false);
|
|
77904
77899
|
};
|
|
77905
77900
|
const handleRemoveImage = () => {
|
|
77906
|
-
setImagePreview(null);
|
|
77907
|
-
setImageBase64(null);
|
|
77908
|
-
setIsRemovingImage(false);
|
|
77909
77901
|
if (fileInputRef.current) {
|
|
77910
77902
|
fileInputRef.current.value = "";
|
|
77911
77903
|
}
|
|
77904
|
+
if (communicationGroup?.id) {
|
|
77905
|
+
updateCommunicationGroup2(
|
|
77906
|
+
{
|
|
77907
|
+
groupId: communicationGroup.id,
|
|
77908
|
+
params: {
|
|
77909
|
+
textMessageMedia: []
|
|
77910
|
+
}
|
|
77911
|
+
},
|
|
77912
|
+
{
|
|
77913
|
+
onSuccess: () => {
|
|
77914
|
+
setImagePreview(null);
|
|
77915
|
+
setImageBase64(null);
|
|
77916
|
+
setIsRemovingImage(false);
|
|
77917
|
+
setImageUrls([]);
|
|
77918
|
+
if (fileInputRef.current) {
|
|
77919
|
+
fileInputRef.current.value = "";
|
|
77920
|
+
}
|
|
77921
|
+
},
|
|
77922
|
+
onError: () => {
|
|
77923
|
+
toast2({
|
|
77924
|
+
title: "Error removing image",
|
|
77925
|
+
description: "Please contact your administrator"
|
|
77926
|
+
});
|
|
77927
|
+
}
|
|
77928
|
+
}
|
|
77929
|
+
);
|
|
77930
|
+
}
|
|
77912
77931
|
};
|
|
77913
77932
|
const handleImageUpload = async (event) => {
|
|
77914
77933
|
const file = event.target.files?.[0];
|
|
@@ -77921,6 +77940,22 @@ const SMSPreview = ({ mergeFieldsResponse }) => {
|
|
|
77921
77940
|
setImageBase64(base64String);
|
|
77922
77941
|
setImagePreview(pngDataUrl);
|
|
77923
77942
|
setIsRemovingImage(false);
|
|
77943
|
+
if (communicationGroup?.id) {
|
|
77944
|
+
updateCommunicationGroup2(
|
|
77945
|
+
{
|
|
77946
|
+
groupId: communicationGroup.id,
|
|
77947
|
+
params: { textMessageMedia: [base64String] }
|
|
77948
|
+
},
|
|
77949
|
+
{
|
|
77950
|
+
onError: () => {
|
|
77951
|
+
toast2({
|
|
77952
|
+
title: "Error updating image",
|
|
77953
|
+
description: "Please contact your administrator"
|
|
77954
|
+
});
|
|
77955
|
+
}
|
|
77956
|
+
}
|
|
77957
|
+
);
|
|
77958
|
+
}
|
|
77924
77959
|
} catch (error2) {
|
|
77925
77960
|
console.error("Failed to convert image:", error2);
|
|
77926
77961
|
toast2({
|
|
@@ -77941,12 +77976,13 @@ const SMSPreview = ({ mergeFieldsResponse }) => {
|
|
|
77941
77976
|
)?.channelSender.channelSenderMetadata.from ?? channelSenderId;
|
|
77942
77977
|
};
|
|
77943
77978
|
useEffect(() => {
|
|
77944
|
-
if (communicationGroup) {
|
|
77945
|
-
if (fromNumber === null) {
|
|
77979
|
+
if (communicationGroup && initialState2 === false) {
|
|
77980
|
+
if (communicationGroup.smsChannelSenderId && fromNumber === null) {
|
|
77946
77981
|
setFromNumber(communicationGroup.smsChannelSenderId);
|
|
77947
77982
|
}
|
|
77948
|
-
if (message2 === null) {
|
|
77983
|
+
if (communicationGroup.smsMessageBody && message2 === null) {
|
|
77949
77984
|
setMessage(communicationGroup.smsMessageBody);
|
|
77985
|
+
setEditingMessage(communicationGroup.smsMessageBody);
|
|
77950
77986
|
}
|
|
77951
77987
|
if (communicationGroup.textMessageCompanyName && companyName === null) {
|
|
77952
77988
|
setCompanyName(communicationGroup.textMessageCompanyName);
|
|
@@ -77954,49 +77990,58 @@ const SMSPreview = ({ mergeFieldsResponse }) => {
|
|
|
77954
77990
|
if (communicationGroup.textMessageMediaUrls && imageUrls.length === 0) {
|
|
77955
77991
|
setImageUrls(communicationGroup.textMessageMediaUrls);
|
|
77956
77992
|
}
|
|
77957
|
-
|
|
77958
|
-
|
|
77959
|
-
|
|
77960
|
-
|
|
77961
|
-
|
|
77962
|
-
|
|
77963
|
-
useEffect(() => {
|
|
77964
|
-
if (channelSenders === void 0 || !initialState2) {
|
|
77965
|
-
return;
|
|
77966
|
-
}
|
|
77967
|
-
if (!fromNumber) {
|
|
77968
|
-
if (smsChannelSenders?.[0]) {
|
|
77969
|
-
setFromNumber(smsChannelSenders[0].channelSender.id);
|
|
77970
|
-
if (communicationGroup?.id) {
|
|
77971
|
-
updateCommunicationGroup2({
|
|
77972
|
-
groupId: communicationGroup.id,
|
|
77973
|
-
params: {
|
|
77974
|
-
smsChannelSenderId: smsChannelSenders[0].channelSender.id
|
|
77975
|
-
}
|
|
77976
|
-
});
|
|
77993
|
+
if (showSmsEditor) {
|
|
77994
|
+
if (editingMessage === null) {
|
|
77995
|
+
setEditingMessage(message2);
|
|
77996
|
+
}
|
|
77997
|
+
if (imageUrls.length > 0 && !imagePreview && !isRemovingImage) {
|
|
77998
|
+
setImagePreview(imageUrls[0]);
|
|
77977
77999
|
}
|
|
77978
78000
|
}
|
|
77979
|
-
|
|
77980
|
-
|
|
77981
|
-
|
|
77982
|
-
|
|
77983
|
-
|
|
77984
|
-
|
|
78001
|
+
if (channelSenders !== void 0) {
|
|
78002
|
+
if (!fromNumber) {
|
|
78003
|
+
if (smsChannelSenders?.[0]) {
|
|
78004
|
+
setFromNumber(smsChannelSenders[0].channelSender.id);
|
|
78005
|
+
if (communicationGroup?.id) {
|
|
78006
|
+
updateCommunicationGroup2({
|
|
78007
|
+
groupId: communicationGroup.id,
|
|
78008
|
+
params: {
|
|
78009
|
+
smsChannelSenderId: smsChannelSenders[0].channelSender.id
|
|
78010
|
+
}
|
|
78011
|
+
});
|
|
78012
|
+
}
|
|
77985
78013
|
}
|
|
77986
|
-
})
|
|
78014
|
+
} else if (fromNumber) {
|
|
78015
|
+
if (communicationGroup?.id) {
|
|
78016
|
+
updateCommunicationGroup2({
|
|
78017
|
+
groupId: communicationGroup.id,
|
|
78018
|
+
params: {
|
|
78019
|
+
smsChannelSenderId: fromNumber
|
|
78020
|
+
}
|
|
78021
|
+
});
|
|
78022
|
+
}
|
|
78023
|
+
}
|
|
77987
78024
|
}
|
|
78025
|
+
setInitialState(true);
|
|
77988
78026
|
}
|
|
77989
78027
|
}, [
|
|
77990
|
-
|
|
78028
|
+
communicationGroup,
|
|
77991
78029
|
fromNumber,
|
|
77992
|
-
|
|
77993
|
-
|
|
77994
|
-
|
|
77995
|
-
|
|
77996
|
-
|
|
78030
|
+
message2,
|
|
78031
|
+
companyName,
|
|
78032
|
+
imageUrls,
|
|
78033
|
+
initialState2,
|
|
78034
|
+
showSmsEditor,
|
|
78035
|
+
editingMessage,
|
|
78036
|
+
imagePreview,
|
|
78037
|
+
isRemovingImage,
|
|
78038
|
+
channelSenders,
|
|
77997
78039
|
smsChannelSenders,
|
|
77998
|
-
|
|
78040
|
+
updateCommunicationGroup2
|
|
77999
78041
|
]);
|
|
78042
|
+
const updateCompanyName = (newCompanyName) => {
|
|
78043
|
+
setCompanyName(newCompanyName);
|
|
78044
|
+
};
|
|
78000
78045
|
useEffect(() => {
|
|
78001
78046
|
if (!companyName && me2?.name && !initCompanyName) {
|
|
78002
78047
|
setInitCompanyName(true);
|
|
@@ -78103,7 +78148,7 @@ const SMSPreview = ({ mergeFieldsResponse }) => {
|
|
|
78103
78148
|
variant: "outline",
|
|
78104
78149
|
onClick: handleRemoveImage,
|
|
78105
78150
|
className: "px-4",
|
|
78106
|
-
disabled:
|
|
78151
|
+
disabled: isRemovingImage || isUpdating,
|
|
78107
78152
|
children: "Remove Image"
|
|
78108
78153
|
}
|
|
78109
78154
|
) : /* @__PURE__ */ jsx(
|
|
@@ -78112,7 +78157,7 @@ const SMSPreview = ({ mergeFieldsResponse }) => {
|
|
|
78112
78157
|
variant: "outline",
|
|
78113
78158
|
onClick: handleAddImage,
|
|
78114
78159
|
className: "px-4",
|
|
78115
|
-
disabled: imageUrls.length >= 1 || isRemovingImage || imageBase64 !== null,
|
|
78160
|
+
disabled: imageUrls.length >= 1 || isRemovingImage || imageBase64 !== null || isUpdating,
|
|
78116
78161
|
children: "Add Image"
|
|
78117
78162
|
}
|
|
78118
78163
|
),
|
|
@@ -90979,16 +91024,7 @@ const AutomationsEditorHeader = ({ showBackButton, onDuplicationCreated, onBefor
|
|
|
90979
91024
|
alertText,
|
|
90980
91025
|
asChild: false,
|
|
90981
91026
|
className: "!cursor-not-allowed",
|
|
90982
|
-
children: /* @__PURE__ */ jsx(
|
|
90983
|
-
Button$1,
|
|
90984
|
-
{
|
|
90985
|
-
variant: "outline",
|
|
90986
|
-
className: "flex items-center gap-2",
|
|
90987
|
-
disabled: true,
|
|
90988
|
-
asChild: false,
|
|
90989
|
-
children: sendText
|
|
90990
|
-
}
|
|
90991
|
-
)
|
|
91027
|
+
children: /* @__PURE__ */ jsx("div", { className: "px-4 py-2 rounded border border-input bg-background text-muted-foreground cursor-not-allowed text-sm font-medium", children: /* @__PURE__ */ jsx("span", { children: sendText }) })
|
|
90992
91028
|
}
|
|
90993
91029
|
) });
|
|
90994
91030
|
};
|