@embedreach/components 0.2.12 → 0.2.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 +125 -10
- package/dist/index.umd.js +113 -113
- package/package.json +1 -1
package/dist/chunks/index.js
CHANGED
|
@@ -46033,6 +46033,20 @@ const sendTestCommunication = async (id2, params) => {
|
|
|
46033
46033
|
);
|
|
46034
46034
|
return response.data;
|
|
46035
46035
|
};
|
|
46036
|
+
const resetCommunicationGroupToDefault = async (args) => {
|
|
46037
|
+
const { communicationGroupId, automationId, type } = args;
|
|
46038
|
+
const response = await baseRequest(
|
|
46039
|
+
`${COMMUNICATION_GROUP_PATH}/${communicationGroupId}/${automationId}/reset`,
|
|
46040
|
+
{
|
|
46041
|
+
method: "POST",
|
|
46042
|
+
body: JSON.stringify({ type })
|
|
46043
|
+
}
|
|
46044
|
+
);
|
|
46045
|
+
return response.data;
|
|
46046
|
+
};
|
|
46047
|
+
const communicationGroupQueryKeys = {
|
|
46048
|
+
all: ["communication-group"]
|
|
46049
|
+
};
|
|
46036
46050
|
const useGetCommunicationGroup = (communicationGroupId) => {
|
|
46037
46051
|
const query = useQuery({
|
|
46038
46052
|
queryKey: ["communication-group", communicationGroupId],
|
|
@@ -46054,7 +46068,9 @@ const useUpdateCommunicationGroup = () => {
|
|
|
46054
46068
|
params
|
|
46055
46069
|
}) => updateCommunicationGroup(groupId, params),
|
|
46056
46070
|
onSuccess: () => {
|
|
46057
|
-
queryClient.invalidateQueries({
|
|
46071
|
+
queryClient.invalidateQueries({
|
|
46072
|
+
queryKey: communicationGroupQueryKeys.all
|
|
46073
|
+
});
|
|
46058
46074
|
}
|
|
46059
46075
|
});
|
|
46060
46076
|
return {
|
|
@@ -63065,8 +63081,13 @@ const stripoScriptId = "UiEditorScript";
|
|
|
63065
63081
|
const initStripo = (options) => {
|
|
63066
63082
|
return new Promise((resolve, reject) => {
|
|
63067
63083
|
const initStripoEditor = () => {
|
|
63084
|
+
let forceRecreate = true;
|
|
63085
|
+
if (options.updatedFromDefault) {
|
|
63086
|
+
forceRecreate = false;
|
|
63087
|
+
}
|
|
63068
63088
|
if (window.UIEditor) {
|
|
63069
63089
|
window.UIEditor.initEditor(options.container, {
|
|
63090
|
+
forceRecreate,
|
|
63070
63091
|
metadata: {
|
|
63071
63092
|
emailId: options.emailId
|
|
63072
63093
|
},
|
|
@@ -63226,7 +63247,8 @@ const StripoWrapper = ({
|
|
|
63226
63247
|
css: template2.css || "",
|
|
63227
63248
|
container: containerRef.current,
|
|
63228
63249
|
businessId: editorData.businessId,
|
|
63229
|
-
mergeFields: mergeFieldsResponse.mergeFields || []
|
|
63250
|
+
mergeFields: mergeFieldsResponse.mergeFields || [],
|
|
63251
|
+
updatedFromDefault: template2.updatedFromDefault
|
|
63230
63252
|
}).catch((error2) => {
|
|
63231
63253
|
console.error("Failed to initialize Stripo:", error2);
|
|
63232
63254
|
});
|
|
@@ -64316,6 +64338,103 @@ const SMSPreview = ({ mergeFieldsResponse, smsChannelSenders }) => {
|
|
|
64316
64338
|
] })
|
|
64317
64339
|
] });
|
|
64318
64340
|
};
|
|
64341
|
+
var CommunicationGroupTypeEnum = /* @__PURE__ */ ((CommunicationGroupTypeEnum2) => {
|
|
64342
|
+
CommunicationGroupTypeEnum2["CUSTOM"] = "custom";
|
|
64343
|
+
CommunicationGroupTypeEnum2["MANAGED"] = "managed";
|
|
64344
|
+
return CommunicationGroupTypeEnum2;
|
|
64345
|
+
})(CommunicationGroupTypeEnum || {});
|
|
64346
|
+
var BuiltInActionIds = /* @__PURE__ */ ((BuiltInActionIds2) => {
|
|
64347
|
+
BuiltInActionIds2["EditAudience"] = "edit-audience";
|
|
64348
|
+
BuiltInActionIds2["EditTime"] = "edit-time";
|
|
64349
|
+
return BuiltInActionIds2;
|
|
64350
|
+
})(BuiltInActionIds || {});
|
|
64351
|
+
const TitleAndResetButton = ({ title: title2, type }) => {
|
|
64352
|
+
const communicationGroup = useCommunicationGroup();
|
|
64353
|
+
const automation2 = useAutomation();
|
|
64354
|
+
const { toast: toast2 } = useToast();
|
|
64355
|
+
const queryClient = useQueryClient();
|
|
64356
|
+
const [loading2, setLoading2] = useState(false);
|
|
64357
|
+
const [showConfirm, setShowConfirmDialog] = useState(false);
|
|
64358
|
+
const showResetButton = (
|
|
64359
|
+
/**
|
|
64360
|
+
* If we haven't loaded in the communication group yet, don't show the reset button
|
|
64361
|
+
*/
|
|
64362
|
+
!communicationGroup ? false : (
|
|
64363
|
+
/**
|
|
64364
|
+
* First see if this is a managed communication group
|
|
64365
|
+
*/
|
|
64366
|
+
communicationGroup.type === CommunicationGroupTypeEnum.MANAGED && /**
|
|
64367
|
+
* If its SMS, check if the text_message_body was updated from the default template
|
|
64368
|
+
*/
|
|
64369
|
+
(type === "sms" ? communicationGroup.updatedFromDefault?.text_message_body : (
|
|
64370
|
+
/**
|
|
64371
|
+
* If its email, check if the email_text_body or email_html_body was updated from the default template
|
|
64372
|
+
*/
|
|
64373
|
+
communicationGroup.updatedFromDefault?.email_text_body || communicationGroup.updatedFromDefault?.email_html_body
|
|
64374
|
+
))
|
|
64375
|
+
)
|
|
64376
|
+
);
|
|
64377
|
+
const resetCommunicationGroup = async () => {
|
|
64378
|
+
if (!communicationGroup || !automation2) {
|
|
64379
|
+
toast2({
|
|
64380
|
+
title: "Error resetting communication",
|
|
64381
|
+
description: "Please contact your administrator",
|
|
64382
|
+
variant: "destructive"
|
|
64383
|
+
});
|
|
64384
|
+
return;
|
|
64385
|
+
}
|
|
64386
|
+
setLoading2(true);
|
|
64387
|
+
await resetCommunicationGroupToDefault({
|
|
64388
|
+
communicationGroupId: communicationGroup.id,
|
|
64389
|
+
automationId: automation2.id,
|
|
64390
|
+
type
|
|
64391
|
+
});
|
|
64392
|
+
queryClient.invalidateQueries({
|
|
64393
|
+
queryKey: communicationGroupQueryKeys.all
|
|
64394
|
+
});
|
|
64395
|
+
toast2({
|
|
64396
|
+
title: "Communication reset to default!"
|
|
64397
|
+
});
|
|
64398
|
+
setLoading2(false);
|
|
64399
|
+
setShowConfirmDialog(false);
|
|
64400
|
+
};
|
|
64401
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
64402
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between", children: [
|
|
64403
|
+
/* @__PURE__ */ jsx("h4", { className: "text-xl text-primary", children: title2 }),
|
|
64404
|
+
/* @__PURE__ */ jsx("div", { className: "flex items-center gap-2", children: showResetButton && /* @__PURE__ */ jsx(Fragment, { children: loading2 ? /* @__PURE__ */ jsx(BasicLoader, {}) : /* @__PURE__ */ jsx(
|
|
64405
|
+
Button$1,
|
|
64406
|
+
{
|
|
64407
|
+
variant: "outline",
|
|
64408
|
+
size: "sm",
|
|
64409
|
+
onClick: () => setShowConfirmDialog(true),
|
|
64410
|
+
children: "Reset To Default"
|
|
64411
|
+
}
|
|
64412
|
+
) }) })
|
|
64413
|
+
] }),
|
|
64414
|
+
/* @__PURE__ */ jsx(Dialog, { open: showConfirm, onOpenChange: setShowConfirmDialog, children: /* @__PURE__ */ jsxs(DialogContent, { className: "sm:max-w-[425px]", children: [
|
|
64415
|
+
/* @__PURE__ */ jsxs(DialogHeader, { children: [
|
|
64416
|
+
/* @__PURE__ */ jsx(DialogTitle, { className: "text-xl font-semibold", children: "Reset to Default" }),
|
|
64417
|
+
/* @__PURE__ */ jsxs(DialogDescription, { className: "text-base text-muted-foreground", children: [
|
|
64418
|
+
"Are you sure you want to reset this",
|
|
64419
|
+
" ",
|
|
64420
|
+
type === "email" ? "email" : "SMS",
|
|
64421
|
+
" template to its default state? This action cannot be undone."
|
|
64422
|
+
] })
|
|
64423
|
+
] }),
|
|
64424
|
+
/* @__PURE__ */ jsxs(DialogFooter, { className: "flex flex-row justify-end gap-3 mt-6", children: [
|
|
64425
|
+
/* @__PURE__ */ jsx(
|
|
64426
|
+
Button$1,
|
|
64427
|
+
{
|
|
64428
|
+
variant: "outline",
|
|
64429
|
+
onClick: () => setShowConfirmDialog(false),
|
|
64430
|
+
children: "Cancel"
|
|
64431
|
+
}
|
|
64432
|
+
),
|
|
64433
|
+
/* @__PURE__ */ jsx(Button$1, { variant: "destructive", onClick: resetCommunicationGroup, children: "Reset to Default" })
|
|
64434
|
+
] })
|
|
64435
|
+
] }) })
|
|
64436
|
+
] });
|
|
64437
|
+
};
|
|
64319
64438
|
const EditCampaignContent = ({
|
|
64320
64439
|
getExtraMergeFields
|
|
64321
64440
|
}) => {
|
|
@@ -64491,7 +64610,7 @@ const EditCampaignContent = ({
|
|
|
64491
64610
|
className: "bg-white rounded-2xl w-full border border-gray-200 p-6 space-y-4 relative",
|
|
64492
64611
|
ref: emailContainerRef,
|
|
64493
64612
|
children: [
|
|
64494
|
-
/* @__PURE__ */ jsx(
|
|
64613
|
+
/* @__PURE__ */ jsx(TitleAndResetButton, { title: "Email Campaign", type: "email" }),
|
|
64495
64614
|
/* @__PURE__ */ jsx(
|
|
64496
64615
|
EmailPreview,
|
|
64497
64616
|
{
|
|
@@ -64503,7 +64622,7 @@ const EditCampaignContent = ({
|
|
|
64503
64622
|
}
|
|
64504
64623
|
),
|
|
64505
64624
|
selectedChannels.includes("sms") && /* @__PURE__ */ jsxs("div", { className: "bg-white rounded-2xl w-full border border-gray-200 p-6 space-y-4 relative", children: [
|
|
64506
|
-
/* @__PURE__ */ jsx(
|
|
64625
|
+
/* @__PURE__ */ jsx(TitleAndResetButton, { title: "SMS Campaign", type: "sms" }),
|
|
64507
64626
|
/* @__PURE__ */ jsx(
|
|
64508
64627
|
SMSPreview,
|
|
64509
64628
|
{
|
|
@@ -84965,11 +85084,6 @@ const sortAutomationSteps = (args) => {
|
|
|
84965
85084
|
}
|
|
84966
85085
|
return sortedSteps;
|
|
84967
85086
|
};
|
|
84968
|
-
var BuiltInActionIds = /* @__PURE__ */ ((BuiltInActionIds2) => {
|
|
84969
|
-
BuiltInActionIds2["EditAudience"] = "edit-audience";
|
|
84970
|
-
BuiltInActionIds2["EditTime"] = "edit-time";
|
|
84971
|
-
return BuiltInActionIds2;
|
|
84972
|
-
})(BuiltInActionIds || {});
|
|
84973
85087
|
const AutomationFlowLabel = ({ copyText }) => {
|
|
84974
85088
|
return /* @__PURE__ */ jsx("span", { className: "text-xs font-medium text-muted-foreground", children: copyText });
|
|
84975
85089
|
};
|
|
@@ -85512,7 +85626,8 @@ const AutomationFlowMain = () => {
|
|
|
85512
85626
|
},
|
|
85513
85627
|
actionData.actionData.actionMetadata?.currentActionId ?? index2
|
|
85514
85628
|
)),
|
|
85515
|
-
automation2.triggerType === AutomationTriggerType.ONE_TIME &&
|
|
85629
|
+
automation2.triggerType === AutomationTriggerType.ONE_TIME && // We need this otherwise we can get a 'Encountered two children with the same key, ``.'
|
|
85630
|
+
/* @__PURE__ */ jsx("div", { className: "flex flex-col gap-3", children: /* @__PURE__ */ jsx(AutomationEditorTrigger, {}) }, "one-time-trigger")
|
|
85516
85631
|
] }) })
|
|
85517
85632
|
] });
|
|
85518
85633
|
};
|