@embedreach/components 0.2.17 → 0.2.19

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.
@@ -2705,14 +2705,16 @@ const listBusinessAutomations = async (args) => {
2705
2705
  );
2706
2706
  return response.data;
2707
2707
  };
2708
- const duplicateBusinessAutomation = async (automationId) => {
2708
+ const duplicateBusinessAutomation = async (automationId, name, description2) => {
2709
2709
  const response = await baseRequest(
2710
2710
  `${BUSINESS_AUTOMATION_PATH}`,
2711
2711
  {
2712
2712
  method: "POST",
2713
2713
  body: JSON.stringify({
2714
2714
  duplicate: true,
2715
- source_id: automationId
2715
+ source_id: automationId,
2716
+ name,
2717
+ description: description2
2716
2718
  })
2717
2719
  }
2718
2720
  );
@@ -13023,7 +13025,7 @@ const ToastClose = React.forwardRef(({ className: className2, ...props2 }, ref)
13023
13025
  {
13024
13026
  ref,
13025
13027
  className: cn$1(
13026
- "absolute right-1 top-1 rounded-md p-1 text-foreground/50 opacity-0 transition-opacity hover:text-foreground focus:opacity-100 focus:outline-none focus:ring-1 group-hover:opacity-100 group-[.destructive]:opacity-100 group-[.destructive]:text-red-300 group-[.destructive]:hover:text-red-50 group-[.destructive]:focus:ring-red-400 group-[.destructive]:focus:ring-offset-red-600",
13028
+ "absolute right-1 top-1 rounded-md p-1 text-foreground/50 hover:text-foreground focus:outline-none focus:ring-1 group-[.destructive]:text-red-300 group-[.destructive]:hover:text-red-50 group-[.destructive]:focus:ring-red-400 group-[.destructive]:focus:ring-offset-red-600",
13027
13029
  className2
13028
13030
  ),
13029
13031
  "toast-close": "",
@@ -46411,7 +46413,7 @@ const stripoKeys = {
46411
46413
  token: () => [...stripoKeys.all, "token"],
46412
46414
  editorData: () => [...stripoKeys.all, "editorData"],
46413
46415
  templates: () => [...stripoKeys.all, "templates"],
46414
- demoTemplate: () => [...stripoKeys.templates(), "demo"]
46416
+ templateForActionId: (automationId, actionId) => [...stripoKeys.templates(), automationId, actionId]
46415
46417
  };
46416
46418
  const getStripoToken = async () => {
46417
46419
  const response = await baseRequest(`${STRIPO_PATH}/token`);
@@ -46445,7 +46447,7 @@ const useStripoEditorData = () => {
46445
46447
  const useStripoTemplateForActionId = (args) => {
46446
46448
  const { automationId, actionId } = args;
46447
46449
  return useQuery({
46448
- queryKey: ["stripo", "templates", automationId, actionId],
46450
+ queryKey: stripoKeys.templateForActionId(automationId, actionId),
46449
46451
  queryFn: () => getTemplateForActionId({ automationId, actionId }),
46450
46452
  ...CACHE_STANDARD
46451
46453
  });
@@ -63696,7 +63698,7 @@ const EmailPreview = ({
63696
63698
  )
63697
63699
  ] }),
63698
63700
  /* @__PURE__ */ jsxs("div", { children: [
63699
- /* @__PURE__ */ jsx(Label$1, { className: "", children: /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 py-1", children: [
63701
+ /* @__PURE__ */ jsx(Label$1, { children: /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 py-1", children: [
63700
63702
  "From Name",
63701
63703
  /* @__PURE__ */ jsx(
63702
63704
  InfoTooltip,
@@ -63718,7 +63720,7 @@ const EmailPreview = ({
63718
63720
  )
63719
63721
  ] }),
63720
63722
  /* @__PURE__ */ jsxs("div", { children: [
63721
- /* @__PURE__ */ jsx(Label$1, { className: "", children: /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 py-1", children: [
63723
+ /* @__PURE__ */ jsx(Label$1, { children: /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 py-1", children: [
63722
63724
  "Reply To Email",
63723
63725
  /* @__PURE__ */ jsx(
63724
63726
  InfoTooltip,
@@ -64430,6 +64432,9 @@ const TitleAndResetButton = ({ title: title2, type }) => {
64430
64432
  queryClient.invalidateQueries({
64431
64433
  queryKey: communicationGroupQueryKeys.all
64432
64434
  });
64435
+ queryClient.invalidateQueries({
64436
+ queryKey: stripoKeys.templates()
64437
+ });
64433
64438
  toast2({
64434
64439
  title: "Communication reset to default!"
64435
64440
  });
@@ -72862,11 +72867,7 @@ const RecipientsTable = ({ recipients }) => {
72862
72867
  /* @__PURE__ */ jsx("th", { className: "px-3 sm:px-4 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wide", children: "Contact" })
72863
72868
  ] }) }),
72864
72869
  /* @__PURE__ */ jsx("tbody", { className: "divide-y divide-gray-200/50", children: recipients.map((recipient, index2) => /* @__PURE__ */ jsxs("tr", { className: "hover:bg-white/50 transition-colors", children: [
72865
- /* @__PURE__ */ jsxs("td", { className: "px-3 sm:px-4 py-3 text-sm text-gray-900", children: [
72866
- recipient.firstName,
72867
- " ",
72868
- recipient.lastName
72869
- ] }),
72870
+ /* @__PURE__ */ jsx("td", { className: "px-3 sm:px-4 py-3 text-sm text-gray-900", children: recipient.firstName || recipient.lastName ? `${recipient.firstName || ""} ${recipient.lastName || ""}`.trim() : "Not Provided" }),
72870
72871
  /* @__PURE__ */ jsx("td", { className: "px-3 sm:px-4 py-3", children: /* @__PURE__ */ jsxs("div", { className: "flex flex-wrap gap-1.5 sm:gap-2", children: [
72871
72872
  recipient.email && /* @__PURE__ */ jsx("span", { className: "px-2 sm:px-2.5 py-1 text-xs font-medium bg-blue-100/50 text-blue-700 rounded-lg", children: "Email" }),
72872
72873
  recipient.phone && /* @__PURE__ */ jsx("span", { className: "px-2 sm:px-2.5 py-1 text-xs font-medium bg-green-100/50 text-green-700 rounded-lg", children: "Phone" })
@@ -82398,16 +82399,18 @@ function AutomationDuplicateDialog({
82398
82399
  description: automation2?.description ?? ""
82399
82400
  }
82400
82401
  });
82401
- async function onSubmit() {
82402
- if (!automation2) {
82402
+ async function onSubmit(values) {
82403
+ if (!automation2 || !values.name) {
82403
82404
  toast2({
82404
82405
  title: "Error duplicating automation",
82405
- description: "Please try again"
82406
+ description: "Please try again. Please make sure to fill in the name of the automation."
82406
82407
  });
82407
82408
  return;
82408
82409
  }
82409
82410
  const { id: duplicatedId } = await duplicateBusinessAutomation(
82410
- automation2.id
82411
+ automation2.id,
82412
+ values.name,
82413
+ values.description
82411
82414
  );
82412
82415
  if (!duplicatedId) {
82413
82416
  toast2({
@@ -82436,7 +82439,6 @@ function AutomationDuplicateDialog({
82436
82439
  {
82437
82440
  control: form.control,
82438
82441
  name: "name",
82439
- disabled: true,
82440
82442
  render: ({ field }) => /* @__PURE__ */ jsxs(FormItem, { children: [
82441
82443
  /* @__PURE__ */ jsx(FormLabel, { children: "Title" }),
82442
82444
  /* @__PURE__ */ jsx(FormControl, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
@@ -82449,7 +82451,6 @@ function AutomationDuplicateDialog({
82449
82451
  {
82450
82452
  control: form.control,
82451
82453
  name: "description",
82452
- disabled: true,
82453
82454
  render: ({ field }) => /* @__PURE__ */ jsxs(FormItem, { children: [
82454
82455
  /* @__PURE__ */ jsx(FormLabel, { children: "Description" }),
82455
82456
  /* @__PURE__ */ jsx(FormControl, { children: /* @__PURE__ */ jsx(Textarea, { ...field }) }),