@embedreach/components 0.3.9 → 0.3.11

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.
@@ -96972,7 +96972,7 @@ function MultiSelectDialog({
96972
96972
  ] })
96973
96973
  ] }) }),
96974
96974
  /* @__PURE__ */ jsx(Separator, {}),
96975
- /* @__PURE__ */ jsx(ScrollArea, { className: "flex-1 max-h-[300px]", children: /* @__PURE__ */ jsx(Command, { className: "rounded-none border-none", children: /* @__PURE__ */ jsxs(CommandGroup, { children: [
96975
+ /* @__PURE__ */ jsx(ScrollArea, { className: "flex-1 max-h-[300px] rounded-md", children: /* @__PURE__ */ jsx(Command, { className: "rounded-none border-none", children: /* @__PURE__ */ jsxs(CommandGroup, { children: [
96976
96976
  extraCommandItems.length > 0 && /* @__PURE__ */ jsxs(Fragment$1, { children: [
96977
96977
  extraCommandItems.map((renderItem, index2) => /* @__PURE__ */ jsx("div", { className: "px-3 py-2", children: renderItem(setOpen) }, `extra-command-${index2}`)),
96978
96978
  /* @__PURE__ */ jsx(Separator, { className: "my-2" })
@@ -97295,22 +97295,19 @@ const SMSEditor = ({
97295
97295
  singleSelect: true
97296
97296
  }
97297
97297
  ),
97298
- /* @__PURE__ */ jsx(InfoTooltip, { title: "Merge Fields" })
97298
+ /* @__PURE__ */ jsx(
97299
+ InfoTooltip,
97300
+ {
97301
+ size: "large",
97302
+ title: "Merge fields are placeholders for dynamic content. For example you can use the recipients name, or email in the contents of your message."
97303
+ }
97304
+ )
97299
97305
  ] }),
97300
97306
  /* @__PURE__ */ jsxs(
97301
97307
  "div",
97302
97308
  {
97303
- className: `flex items-center gap-2 text-sm transition-colors duration-300 ${characterCountFormatted.colorClass}`,
97309
+ className: `flex items-center gap-2 text-xs transition-colors duration-300 ${characterCountFormatted.colorClass}`,
97304
97310
  children: [
97305
- /* @__PURE__ */ jsx(
97306
- SavingIndicator,
97307
- {
97308
- isSaving: !!(isUpdating || hasUnsavedChanges),
97309
- savingText: isUpdating || hasUnsavedChanges ? "Saving..." : "Autosave enabled",
97310
- size: "xs",
97311
- textSize: "xs"
97312
- }
97313
- ),
97314
97311
  characterCountFormatted.text,
97315
97312
  characterCount > SMS_LIMITS.RECOMMENDED_LIMIT && /* @__PURE__ */ jsx(
97316
97313
  InfoTooltip,
@@ -97331,7 +97328,16 @@ const SMSEditor = ({
97331
97328
  ]
97332
97329
  }
97333
97330
  )
97334
- ] })
97331
+ ] }),
97332
+ /* @__PURE__ */ jsx("div", { className: "flex items-center gap-2", children: /* @__PURE__ */ jsx(
97333
+ SavingIndicator,
97334
+ {
97335
+ isSaving: !!(isUpdating || hasUnsavedChanges),
97336
+ savingText: isUpdating || hasUnsavedChanges ? "Saving..." : "Autosave enabled",
97337
+ size: "xs",
97338
+ textSize: "xs"
97339
+ }
97340
+ ) })
97335
97341
  ] });
97336
97342
  };
97337
97343
  const SMSSenderAndCompanyEditor = React__default.memo(
@@ -97352,6 +97358,7 @@ const SMSSenderAndCompanyEditor = React__default.memo(
97352
97358
  const [internalCompanyName, setInternalCompanyName] = useState(null);
97353
97359
  const [popoverOpen, setPopoverOpen] = useState(false);
97354
97360
  const [hasInitialized, setHasInitialized] = useState(false);
97361
+ const debouncedCompanyName = useDebounce(internalCompanyName, 250);
97355
97362
  const { channelSenders } = useChannelSender();
97356
97363
  const { channelAccounts } = useChannelAccount();
97357
97364
  const { data: smsApplication } = useGetLatestSmsRegistrationApplication();
@@ -97384,13 +97391,17 @@ const SMSSenderAndCompanyEditor = React__default.memo(
97384
97391
  (e4) => {
97385
97392
  const newValue = e4.target.value;
97386
97393
  setInternalCompanyName(newValue);
97394
+ },
97395
+ []
97396
+ );
97397
+ useEffect(() => {
97398
+ if (hasInitialized && debouncedCompanyName !== void 0) {
97387
97399
  updateCommunicationGroup2({
97388
97400
  groupId: propsRef.current.communicationGroupId,
97389
- params: { textMessageCompanyName: newValue || null }
97401
+ params: { textMessageCompanyName: debouncedCompanyName || null }
97390
97402
  });
97391
- },
97392
- [updateCommunicationGroup2]
97393
- );
97403
+ }
97404
+ }, [debouncedCompanyName, hasInitialized, updateCommunicationGroup2]);
97394
97405
  const handlePopoverOpenChange = useCallback((open) => {
97395
97406
  setPopoverOpen(open);
97396
97407
  }, []);
@@ -97452,7 +97463,7 @@ const SMSSenderAndCompanyEditor = React__default.memo(
97452
97463
  className: "w-full"
97453
97464
  }
97454
97465
  ),
97455
- /* @__PURE__ */ jsx(SavingIndicator, { isSaving: isUpdating })
97466
+ /* @__PURE__ */ jsx("div", { className: "h-6", children: /* @__PURE__ */ jsx(SavingIndicator, { isSaving: isUpdating }) })
97456
97467
  ] })
97457
97468
  ] });
97458
97469
  }, [
@@ -97561,7 +97572,7 @@ const SMSEditorContent = ({
97561
97572
  if (isInitialMountRef.current) {
97562
97573
  return;
97563
97574
  }
97564
- const rawSMSBody = debouncedMessage || "";
97575
+ const rawSMSBody = editingMessage || "";
97565
97576
  if (rawSMSBody.length > SMS_ABSOLUTE_LIMIT) {
97566
97577
  toast2({
97567
97578
  title: "SMS is too long",
@@ -97598,7 +97609,7 @@ const SMSEditorContent = ({
97598
97609
  });
97599
97610
  }
97600
97611
  }, [
97601
- debouncedMessage,
97612
+ editingMessage,
97602
97613
  communicationGroupId,
97603
97614
  updateCommunicationGroup2,
97604
97615
  toast2,
@@ -97724,20 +97735,14 @@ const SMSEditorContent = ({
97724
97735
  return /* @__PURE__ */ jsx("div", { className: "flex justify-center items-center p-8", children: /* @__PURE__ */ jsx("div", { className: "text-sm text-muted-foreground", children: "Loading editor..." }) });
97725
97736
  }
97726
97737
  return /* @__PURE__ */ jsxs("div", { className: cn$2("w-full @container", className), children: [
97727
- /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between mb-6", children: [
97728
- /* @__PURE__ */ jsxs("div", { children: [
97729
- /* @__PURE__ */ jsx("h3", { className: "text-sm font-medium text-gray-700 mb-2", children: "Live Preview" }),
97730
- /* @__PURE__ */ jsx("div", { className: "text-xs text-gray-500", children: "See how your message will appear to customers" })
97731
- ] }),
97732
- /* @__PURE__ */ jsx(
97733
- MemoizedSMSSenderAndCompanyEditor$1,
97734
- {
97735
- communicationGroupId,
97736
- initialSenderId: initialSenderId || null,
97737
- companyName: initialCompanyNameRef.current || null
97738
- }
97739
- )
97740
- ] }),
97738
+ /* @__PURE__ */ jsx("div", { className: "flex items-center justify-between mb-6", children: /* @__PURE__ */ jsx(
97739
+ MemoizedSMSSenderAndCompanyEditor$1,
97740
+ {
97741
+ communicationGroupId,
97742
+ initialSenderId: initialSenderId || null,
97743
+ companyName: initialCompanyNameRef.current || null
97744
+ }
97745
+ ) }),
97741
97746
  /* @__PURE__ */ jsxs("div", { className: "flex flex-col lg:flex-row gap-6 h-full", children: [
97742
97747
  /* @__PURE__ */ jsxs("div", { className: "flex-1 min-w-0", children: [
97743
97748
  imagePreview && /* @__PURE__ */ jsx("div", { className: "flex justify-center mb-6", children: /* @__PURE__ */ jsx("div", { className: "relative group w-fit", children: /* @__PURE__ */ jsx(
@@ -97780,7 +97785,7 @@ const SMSEditorContent = ({
97780
97785
  }
97781
97786
  )
97782
97787
  ] }),
97783
- /* @__PURE__ */ jsx("div", { className: "hidden @lg:block flex-1 min-w-0", children: /* @__PURE__ */ jsx("div", { className: "sticky top-4", children: /* @__PURE__ */ jsx("div", { className: "bg-gray-50 rounded-xl p-4 border border-gray-200", children: /* @__PURE__ */ jsx(
97788
+ /* @__PURE__ */ jsx("div", { className: "block flex-1 min-w-0", children: /* @__PURE__ */ jsx("div", { className: "sticky top-4", children: /* @__PURE__ */ jsx("div", { className: "bg-gray-50 rounded-xl p-4 border border-gray-200", children: /* @__PURE__ */ jsx(
97784
97789
  SMSPreview,
97785
97790
  {
97786
97791
  body: buildFinalSMSBody({
@@ -97810,7 +97815,7 @@ const EditSMSContent = () => {
97810
97815
  if (isGetMergeFieldsLoading || !getMergeFields2) {
97811
97816
  return /* @__PURE__ */ jsx("div", { className: "flex justify-center items-center flex-1 h-full bg-white rounded-2xl w-full border border-gray-200 p-6 space-y-4 relative", children: /* @__PURE__ */ jsx(BasicLoader, { text: ["Fetching Content..."] }) });
97812
97817
  }
97813
- return /* @__PURE__ */ jsxs("div", { className: "bg-white rounded-2xl w-full border border-gray-200 p-6 space-y-4 relative", children: [
97818
+ return /* @__PURE__ */ jsxs("div", { className: "bg-white rounded-2xl w-full p-6 space-y-4 relative", children: [
97814
97819
  /* @__PURE__ */ jsx(TitleAndResetButton, { title: "SMS Campaign", type: ChannelType.SMS }),
97815
97820
  hasAnySMSsenders === false ? /* @__PURE__ */ jsx("div", { className: "w-full pt-8 mx-auto", children: /* @__PURE__ */ jsx(SMSSetup, {}) }) : /* @__PURE__ */ jsx("div", { className: "space-y-6", children: /* @__PURE__ */ jsx(
97816
97821
  SMSEditorContent,
@@ -99016,7 +99021,8 @@ const useEmailChannelSenders = () => {
99016
99021
  }, [channelSenders?.results, channelAccounts?.results]);
99017
99022
  };
99018
99023
  const EmailDetailsPreview = ({
99019
- mergeFieldsResponse
99024
+ mergeFieldsResponse,
99025
+ disableEditContent
99020
99026
  }) => {
99021
99027
  const automation2 = useAutomation();
99022
99028
  const communicationGroup = useCommunicationGroup();
@@ -99173,7 +99179,7 @@ const EmailDetailsPreview = ({
99173
99179
  )
99174
99180
  ] }),
99175
99181
  /* @__PURE__ */ jsxs(Popover, { open: popoverOpen, onOpenChange: handlePopoverClose, children: [
99176
- /* @__PURE__ */ jsx(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsxs(
99182
+ /* @__PURE__ */ jsx(PopoverTrigger, { asChild: true, children: !disableEditContent && /* @__PURE__ */ jsxs(
99177
99183
  Button$1,
99178
99184
  {
99179
99185
  size: "sm",
@@ -99722,6 +99728,7 @@ const AutomationEditorEmailPreview = ({
99722
99728
  const showPreview = !disablePreview && hasEmailContent;
99723
99729
  const showChannelDisabledWarning = !communicationGroup.emailChannelSenderId || emailChannelSenders.length === 0;
99724
99730
  const EditButton = () => {
99731
+ if (disableEditContent) return null;
99725
99732
  const button = /* @__PURE__ */ jsxs(
99726
99733
  Button$1,
99727
99734
  {
@@ -99844,8 +99851,14 @@ const AutomationEditorEmailPreview = ({
99844
99851
  }
99845
99852
  ),
99846
99853
  showChannelDisabledWarning && /* @__PURE__ */ jsx(ChannelDisabledWarning, { channelType: "email" }),
99847
- hasEmailContent ? /* @__PURE__ */ jsx("div", { className: "relative flex-1 w-full flex flex-col overflow-hidden", children: /* @__PURE__ */ jsx("div", { className: "absolute inset-0 overflow-y-auto flex flex-col", children: /* @__PURE__ */ jsxs("div", { className: "flex flex-col space-y-4 px-4 pb-20", children: [
99848
- /* @__PURE__ */ jsx("div", { className: "w-full flex-shrink-0 max-w-2xl mx-auto rounded-md", children: /* @__PURE__ */ jsx(EmailDetailsPreview, { mergeFieldsResponse: getMergeFields2 }) }),
99854
+ hasEmailContent ? /* @__PURE__ */ jsx("div", { className: "flex-1 w-full flex flex-col overflow-y-auto", children: /* @__PURE__ */ jsx("div", { className: "flex flex-col space-y-4 px-4 pt-4 pb-20", children: /* @__PURE__ */ jsxs("div", { className: "flex flex-col space-y-4 px-4 pb-20", children: [
99855
+ /* @__PURE__ */ jsx("div", { className: "w-full flex-shrink-0 max-w-2xl mx-auto rounded-md", children: /* @__PURE__ */ jsx(
99856
+ EmailDetailsPreview,
99857
+ {
99858
+ mergeFieldsResponse: getMergeFields2,
99859
+ disableEditContent
99860
+ }
99861
+ ) }),
99849
99862
  /* @__PURE__ */ jsxs("div", { className: "rounded-lg bg-background flex-1 min-h-0 flex flex-col items-center max-w-2xl mx-auto w-full", children: [
99850
99863
  /* @__PURE__ */ jsxs("div", { className: "flex items-center space-x-2 w-full justify-end p-3", children: [
99851
99864
  /* @__PURE__ */ jsx(ResetToDefaultButton, { type: ChannelType.EMAIL }),
@@ -99947,7 +99960,7 @@ const MemoizedSMSSenderAndCompanyEditor = React__default.memo(
99947
99960
  );
99948
99961
  }
99949
99962
  );
99950
- const SMSDetailsPreview = () => {
99963
+ const SMSDetailsPreview = ({ disableEditContent }) => {
99951
99964
  const automation2 = useAutomation();
99952
99965
  const communicationGroup = useCommunicationGroup();
99953
99966
  const { channelSenders } = useChannelSender();
@@ -99998,7 +100011,7 @@ const SMSDetailsPreview = () => {
99998
100011
  }
99999
100012
  )
100000
100013
  ] }),
100001
- /* @__PURE__ */ jsx(
100014
+ !disableEditContent && /* @__PURE__ */ jsx(
100002
100015
  MemoizedSMSSenderAndCompanyEditor,
100003
100016
  {
100004
100017
  trigger: /* @__PURE__ */ jsx(MemoizedTriggerButton, {}),
@@ -100094,6 +100107,7 @@ const AutomationEditorSMSPreview = ({
100094
100107
  const showPreview = !disablePreview && hasSendableSmsContent;
100095
100108
  const showChannelDisabledWarning = !communicationGroup?.smsChannelSenderId || smsChannelSenders.length === 0;
100096
100109
  const EditButton = () => {
100110
+ if (disableEditContent) return null;
100097
100111
  const button = /* @__PURE__ */ jsxs(
100098
100112
  Button$1,
100099
100113
  {
@@ -100181,8 +100195,13 @@ const AutomationEditorSMSPreview = ({
100181
100195
  ) })
100182
100196
  ] }) }),
100183
100197
  showChannelDisabledWarning && /* @__PURE__ */ jsx(ChannelDisabledWarning, { channelType: "sms" }),
100184
- hasAnySMSsenders ? /* @__PURE__ */ jsx("div", { className: "relative flex-1 w-full flex flex-col overflow-hidden h-full", children: /* @__PURE__ */ jsx("div", { className: "absolute inset-0 overflow-y-auto flex flex-col", children: /* @__PURE__ */ jsxs("div", { className: "flex flex-col space-y-4 px-4 pt-4 pb-20", children: [
100185
- /* @__PURE__ */ jsx("div", { className: "w-full flex-shrink-0 max-w-2xl mx-auto rounded-md", children: /* @__PURE__ */ jsx(SMSDetailsPreview, {}) }),
100198
+ hasAnySMSsenders ? /* @__PURE__ */ jsx("div", { className: "flex-1 w-full flex flex-col overflow-y-auto", children: /* @__PURE__ */ jsx("div", { className: "flex flex-col space-y-4 px-4 pt-4 pb-20", children: /* @__PURE__ */ jsxs("div", { className: "flex flex-col space-y-4 px-4 pt-4 pb-20", children: [
100199
+ /* @__PURE__ */ jsx("div", { className: "w-full flex-shrink-0 max-w-2xl mx-auto rounded-md", children: /* @__PURE__ */ jsx(
100200
+ SMSDetailsPreview,
100201
+ {
100202
+ disableEditContent
100203
+ }
100204
+ ) }),
100186
100205
  /* @__PURE__ */ jsxs("div", { className: "rounded-lg bg-background flex-1 min-h-0 flex flex-col items-center max-w-2xl mx-auto w-full", children: [
100187
100206
  /* @__PURE__ */ jsxs("div", { className: "flex items-center space-x-2 w-full justify-end p-3", children: [
100188
100207
  /* @__PURE__ */ jsx(ResetToDefaultButton, { type: ChannelType.SMS }),
@@ -106543,7 +106562,7 @@ const SelectSenderScreen = () => {
106543
106562
  return /* @__PURE__ */ jsx("div", { className: "flex justify-center items-center flex-1 h-full bg-white rounded-2xl w-full border border-gray-200 p-6 space-y-4 relative", children: /* @__PURE__ */ jsx(BasicLoader, { text: ["Fetching Content..."] }) });
106544
106563
  }
106545
106564
  const hasEmailChannelSenders = emailChannelSendersWithChannelAccounts.length > 0;
106546
- return /* @__PURE__ */ jsx("div", { className: "flex flex-col gap-4 flex-shrink-0", children: /* @__PURE__ */ jsx("div", { className: "bg-white rounded-2xl w-full border border-gray-200 p-6 space-y-4 relative", children: /* @__PURE__ */ jsx(
106565
+ return /* @__PURE__ */ jsx("div", { className: "flex flex-col gap-4 flex-shrink-0", children: /* @__PURE__ */ jsx("div", { className: "bg-white rounded-2xl w-full p-6 space-y-4 relative", children: /* @__PURE__ */ jsx(
106547
106566
  SelectEmailOrSMS,
106548
106567
  {
106549
106568
  automationType: automation2?.triggerMetadata?.triggerType,
@@ -107245,7 +107264,7 @@ const OneTimeWizardMain = ({ onFinish, getExtraMergeFields, onBeforeSchedule })
107245
107264
  step.step
107246
107265
  )) });
107247
107266
  const renderContent = () => /* @__PURE__ */ jsx("section", { className: "flex-1 mr-6 w-full relative rounded-xl bg-gray-100 ml-6 @[1000px]:ml-0", children: /* @__PURE__ */ jsx("div", { className: " overflow-y-auto top-0 left-0 right-0 bottom-0 flex-1 h-full flex-col flex", children: /* @__PURE__ */ jsx(BlurDiv, { className: "pt-0 h-full", children: STEPS.find((step) => step.step === currentStep)?.content }, currentStep) }) });
107248
- const renderFooter = () => /* @__PURE__ */ jsx("footer", { className: "w-full flex justify-end shadow-md z-10 items-center h-16 px-6", children: /* @__PURE__ */ jsx(
107267
+ const renderFooter = () => /* @__PURE__ */ jsx("footer", { className: "w-full flex justify-end z-10 items-center h-16 px-6", children: /* @__PURE__ */ jsx(
107249
107268
  BackNextButtonGroup,
107250
107269
  {
107251
107270
  handleSkipAndSaveAsDraft,
@@ -107264,7 +107283,7 @@ const OneTimeWizardMain = ({ onFinish, getExtraMergeFields, onBeforeSchedule })
107264
107283
  return /* @__PURE__ */ jsxs("div", { className: "flex-1 flex flex-col @container h-full min-h-0", children: [
107265
107284
  renderHeader(),
107266
107285
  /* @__PURE__ */ jsxs("main", { className: "flex gap-4 flex-1 min-h-0", children: [
107267
- /* @__PURE__ */ jsx("div", { className: "hidden @[1000px]:block", children: renderStepNav() }),
107286
+ /* @__PURE__ */ jsx("div", { className: "block", children: renderStepNav() }),
107268
107287
  renderContent()
107269
107288
  ] }),
107270
107289
  renderFooter()