@embedreach/components 0.3.2 → 0.3.4

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.
@@ -28865,6 +28865,17 @@ const MessageSquare = createLucideIcon("MessageSquare", [
28865
28865
  * See the LICENSE file in the root directory of this source tree.
28866
28866
  */
28867
28867
  const Minus = createLucideIcon("Minus", [["path", { d: "M5 12h14", key: "1ays0h" }]]);
28868
+ /**
28869
+ * @license lucide-react v0.464.0 - ISC
28870
+ *
28871
+ * This source code is licensed under the ISC license.
28872
+ * See the LICENSE file in the root directory of this source tree.
28873
+ */
28874
+ const Monitor = createLucideIcon("Monitor", [
28875
+ ["rect", { width: "20", height: "14", x: "2", y: "3", rx: "2", key: "48i651" }],
28876
+ ["line", { x1: "8", x2: "16", y1: "21", y2: "21", key: "1svkeh" }],
28877
+ ["line", { x1: "12", x2: "12", y1: "17", y2: "21", key: "vw1qmm" }]
28878
+ ]);
28868
28879
  /**
28869
28880
  * @license lucide-react v0.464.0 - ISC
28870
28881
  *
@@ -29078,6 +29089,16 @@ const ShoppingBag = createLucideIcon("ShoppingBag", [
29078
29089
  ["path", { d: "M3 6h18", key: "d0wm0j" }],
29079
29090
  ["path", { d: "M16 10a4 4 0 0 1-8 0", key: "1ltviw" }]
29080
29091
  ]);
29092
+ /**
29093
+ * @license lucide-react v0.464.0 - ISC
29094
+ *
29095
+ * This source code is licensed under the ISC license.
29096
+ * See the LICENSE file in the root directory of this source tree.
29097
+ */
29098
+ const Smartphone = createLucideIcon("Smartphone", [
29099
+ ["rect", { width: "14", height: "20", x: "5", y: "2", rx: "2", ry: "2", key: "1yt0o3" }],
29100
+ ["path", { d: "M12 18h.01", key: "mhygvu" }]
29101
+ ]);
29081
29102
  /**
29082
29103
  * @license lucide-react v0.464.0 - ISC
29083
29104
  *
@@ -52031,6 +52052,11 @@ const IconDefinitions = {
52031
52052
  SmsIcon: Phone,
52032
52053
  ExpandIcon: Maximize2,
52033
52054
  PreviewButton: Play,
52055
+ /**
52056
+ * Device toggle icons
52057
+ */
52058
+ DesktopIcon: Monitor,
52059
+ MobileIcon: Smartphone,
52034
52060
  /**
52035
52061
  * Statistics icons
52036
52062
  */
@@ -89713,6 +89739,72 @@ const RichTextInputWithMergeFields = ({
89713
89739
  ] })
89714
89740
  ] }) });
89715
89741
  };
89742
+ const ToggleDesktopMobileButton = () => {
89743
+ const [mode, setMode] = useState("desktop");
89744
+ const desktopRef = useRef(null);
89745
+ const mobileRef = useRef(null);
89746
+ useEffect(() => {
89747
+ const handleDesktopClick = () => setMode("desktop");
89748
+ const handleMobileClick = () => setMode("mobile");
89749
+ const desktopBtn = desktopRef.current;
89750
+ const mobileBtn = mobileRef.current;
89751
+ if (desktopBtn) desktopBtn.addEventListener("click", handleDesktopClick);
89752
+ if (mobileBtn) mobileBtn.addEventListener("click", handleMobileClick);
89753
+ return () => {
89754
+ if (desktopBtn)
89755
+ desktopBtn.removeEventListener("click", handleDesktopClick);
89756
+ if (mobileBtn) mobileBtn.removeEventListener("click", handleMobileClick);
89757
+ };
89758
+ }, []);
89759
+ return /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-1 bg-muted rounded-md p-0.5 shadow-inner border w-fit", children: [
89760
+ /* @__PURE__ */ jsxs(
89761
+ Button$1,
89762
+ {
89763
+ ref: desktopRef,
89764
+ type: "button",
89765
+ "aria-pressed": mode === "desktop",
89766
+ "aria-label": "Show desktop preview",
89767
+ className: "desktop-view-button toggle-desktop-button relative flex items-center justify-center px-2 py-0 rounded-md transition-colors duration-200" + (mode === "desktop" ? " bg-background shadow text-primary" : " bg-transparent text-muted-foreground hover:bg-accent"),
89768
+ variant: "ghost",
89769
+ style: { minWidth: 32, minHeight: 32 },
89770
+ children: [
89771
+ mode === "desktop" && /* @__PURE__ */ jsx(
89772
+ motion.span,
89773
+ {
89774
+ layoutId: "toggle-indicator",
89775
+ className: "absolute inset-0 rounded-md border-2 bg-background/80 z-0 border-[color:var(--reach-primary)]",
89776
+ transition: { type: "spring", stiffness: 400, damping: 30 }
89777
+ }
89778
+ ),
89779
+ /* @__PURE__ */ jsx("span", { className: "relative z-10 flex items-center justify-center", children: /* @__PURE__ */ jsx(IconDefinitions.DesktopIcon, { className: "w-4 h-4" }) })
89780
+ ]
89781
+ }
89782
+ ),
89783
+ /* @__PURE__ */ jsxs(
89784
+ Button$1,
89785
+ {
89786
+ ref: mobileRef,
89787
+ type: "button",
89788
+ "aria-pressed": mode === "mobile",
89789
+ "aria-label": "Show mobile preview",
89790
+ className: "mobile-view-button toggle-mobile-button relative flex items-center justify-center px-2 py-0 rounded-md transition-colors duration-200" + (mode === "mobile" ? " bg-background shadow text-primary" : " bg-transparent text-muted-foreground hover:bg-accent"),
89791
+ variant: "ghost",
89792
+ style: { minWidth: 32, minHeight: 32 },
89793
+ children: [
89794
+ mode === "mobile" && /* @__PURE__ */ jsx(
89795
+ motion.span,
89796
+ {
89797
+ layoutId: "toggle-indicator",
89798
+ className: "absolute inset-0 rounded-md border-2 bg-background/80 z-0 border-[color:var(--reach-primary)]",
89799
+ transition: { type: "spring", stiffness: 400, damping: 30 }
89800
+ }
89801
+ ),
89802
+ /* @__PURE__ */ jsx("span", { className: "relative z-10 flex items-center justify-center", children: /* @__PURE__ */ jsx(IconDefinitions.MobileIcon, { className: "w-4 h-4" }) })
89803
+ ]
89804
+ }
89805
+ )
89806
+ ] });
89807
+ };
89716
89808
  function setRef$3(ref, value) {
89717
89809
  if (typeof ref === "function") {
89718
89810
  return ref(value);
@@ -92707,9 +92799,35 @@ const EmailPreviewHtmlRenderer = ({
92707
92799
  }
92708
92800
  ) : /* @__PURE__ */ jsx("div", { className: "flex items-center justify-center h-full", children: /* @__PURE__ */ jsx(MissingDataForPreview, { type: "email" }) }) });
92709
92801
  };
92802
+ const HELP_TOPICS = [
92803
+ {
92804
+ id: "dynamic-content",
92805
+ title: "Dynamic Content",
92806
+ image: "https://cdn.embedreach.com/assets/engage/merge-tags-demo.gif",
92807
+ imageAlt: "Merge Tags Demo",
92808
+ imageDesc: "Demonstration: Adding merge tags to personalize your emails",
92809
+ selectorTitle: "Dynamic Content",
92810
+ selectorSubtitle: "Dynamic content is a way to insert dynamic content into your email like name, email, or other details.",
92811
+ selectorIcon: /* @__PURE__ */ jsx(Merge, {})
92812
+ },
92813
+ {
92814
+ id: "responsive-design",
92815
+ title: "Responsive Design",
92816
+ image: "https://cdn.embedreach.com/assets/engage/layout-mobile-desktop.gif",
92817
+ imageAlt: "Mobile Desktop Switch Demo",
92818
+ imageDesc: "Demonstration: Switching between mobile and desktop preview modes",
92819
+ selectorTitle: "Responsive Design",
92820
+ selectorSubtitle: "Switch between mobile and desktop preview modes to ensure your emails look great on all devices.",
92821
+ selectorIcon: /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-1", children: [
92822
+ /* @__PURE__ */ jsx(Smartphone, { className: "w-4 h-4" }),
92823
+ /* @__PURE__ */ jsx(Monitor, { className: "w-4 h-4" })
92824
+ ] })
92825
+ }
92826
+ ];
92710
92827
  const EmailPreviewHelpDialog = () => {
92711
92828
  const { toggleEmailHelpDialog: toggleEmailHelpDialog2, data: business } = useBusiness();
92712
92829
  const { toast: toast2 } = useToast();
92830
+ const [selectedTopic, setSelectedTopic] = useState("dynamic-content");
92713
92831
  const handleDontShowAgain = () => {
92714
92832
  toggleEmailHelpDialog2(false);
92715
92833
  toast2({
@@ -92717,37 +92835,48 @@ const EmailPreviewHelpDialog = () => {
92717
92835
  });
92718
92836
  };
92719
92837
  const shouldShowDontShowAgainButton = business?.uiDefaults?.emailHelpDialogShow !== false;
92838
+ const topic = HELP_TOPICS.find((t3) => t3.id === selectedTopic) ?? HELP_TOPICS[0];
92720
92839
  return /* @__PURE__ */ jsxs("div", { className: "p-6 overflow-y-auto", children: [
92721
92840
  /* @__PURE__ */ jsxs("div", { className: "mb-8 text-center", children: [
92722
92841
  /* @__PURE__ */ jsx("h2", { className: "text-2xl font-semibold mb-2", children: "Email Editor Help Center" }),
92723
92842
  /* @__PURE__ */ jsx("p", { className: "text-gray-500", children: "Learn how to use our email editor's powerful features" })
92724
92843
  ] }),
92725
- /* @__PURE__ */ jsxs("div", { className: "space-y-4 max-w-xl mx-auto", children: [
92726
- /* @__PURE__ */ jsx("h3", { className: "text-lg font-medium", children: "Using Dynamic Content" }),
92727
- /* @__PURE__ */ jsxs("div", { className: "relative rounded-lg overflow-hidden bg-gray-50", children: [
92728
- /* @__PURE__ */ jsx(
92729
- "img",
92730
- {
92731
- src: "https://cdn.embedreach.com/assets/engage/merge-tags-demo.gif",
92732
- alt: "Merge Tags Demo",
92733
- className: "w-full shadow-lg max-w-md mx-auto"
92734
- }
92735
- ),
92736
- /* @__PURE__ */ jsx("div", { className: "absolute bottom-0 left-0 right-0 bg-gradient-to-t from-black/50 to-transparent p-4", children: /* @__PURE__ */ jsx("p", { className: "text-white text-sm", children: "Demonstration: Adding merge tags to personalize your emails" }) })
92737
- ] }),
92738
- /* @__PURE__ */ jsx("div", { className: "px-2", children: /* @__PURE__ */ jsx(
92739
- BigSelector,
92740
- {
92741
- onClick: () => {
92742
- },
92743
- title: "Dynamic Content",
92744
- subtitle: "Dynamic content is a way to insert dynamic content into your email such as the customer's name, email, or other details.",
92745
- icon: /* @__PURE__ */ jsx(Merge, {}),
92746
- selected: true
92747
- }
92748
- ) }),
92749
- shouldShowDontShowAgainButton && /* @__PURE__ */ jsx("div", { className: "flex justify-center pt-4", children: /* @__PURE__ */ jsx(Button$1, { size: "sm", onClick: handleDontShowAgain, children: "Don't show me again" }) })
92750
- ] })
92844
+ /* @__PURE__ */ jsx("div", { className: "mb-8 flex flex-col items-center min-h-[340px]", children: /* @__PURE__ */ jsx(AnimatePresence, { mode: "wait", children: /* @__PURE__ */ jsxs(
92845
+ motion.div,
92846
+ {
92847
+ initial: { opacity: 0, y: 24 },
92848
+ animate: { opacity: 1, y: 0 },
92849
+ exit: { opacity: 0, y: -24 },
92850
+ transition: { duration: 0.3 },
92851
+ className: "w-full flex flex-col items-center",
92852
+ children: [
92853
+ /* @__PURE__ */ jsx("h3", { className: "text-lg font-medium mb-2", children: topic.title }),
92854
+ /* @__PURE__ */ jsxs("div", { className: "relative rounded-lg overflow-hidden bg-gray-50 w-full max-w-2xl", children: [
92855
+ /* @__PURE__ */ jsx(
92856
+ "img",
92857
+ {
92858
+ src: topic.image,
92859
+ alt: topic.imageAlt,
92860
+ className: "w-full shadow-lg max-w-md mx-auto"
92861
+ }
92862
+ ),
92863
+ /* @__PURE__ */ jsx("div", { className: "absolute bottom-0 left-0 right-0 bg-gradient-to-t from-black/50 to-transparent p-4", children: /* @__PURE__ */ jsx("p", { className: "text-white text-sm", children: topic.imageDesc }) })
92864
+ ] })
92865
+ ]
92866
+ },
92867
+ topic.id
92868
+ ) }) }),
92869
+ /* @__PURE__ */ jsx("div", { className: "flex flex-col gap-4 sm:flex-row sm:gap-6 max-w-xl mx-auto", children: HELP_TOPICS.map((t3) => /* @__PURE__ */ jsx("div", { className: "flex-1", children: /* @__PURE__ */ jsx(
92870
+ BigSelector,
92871
+ {
92872
+ onClick: () => setSelectedTopic(t3.id),
92873
+ title: t3.selectorTitle,
92874
+ subtitle: t3.selectorSubtitle,
92875
+ icon: t3.selectorIcon,
92876
+ selected: selectedTopic === t3.id
92877
+ }
92878
+ ) }, t3.id)) }),
92879
+ shouldShowDontShowAgainButton && /* @__PURE__ */ jsx("div", { className: "flex justify-center pt-4", children: /* @__PURE__ */ jsx(Button$1, { size: "sm", onClick: handleDontShowAgain, children: "Don't show me again" }) })
92751
92880
  ] });
92752
92881
  };
92753
92882
  const MissingSenderForPreview = ({
@@ -93018,7 +93147,9 @@ const initStripo = (options) => {
93018
93147
  warn: console.warn,
93019
93148
  success: console.log
93020
93149
  },
93021
- mergeTags: options.mergeFields
93150
+ mergeTags: options.mergeFields,
93151
+ mobileViewButtonSelector: ".toggle-mobile-button",
93152
+ desktopViewButtonSelector: ".toggle-desktop-button"
93022
93153
  });
93023
93154
  resolve(void 0);
93024
93155
  }
@@ -93227,6 +93358,10 @@ const EmailPreview = ({
93227
93358
  });
93228
93359
  useEffect(() => {
93229
93360
  if (!business) return;
93361
+ if (showHelpDialog !== null) return;
93362
+ if (!showStripoEditor) {
93363
+ return;
93364
+ }
93230
93365
  if (!business?.uiDefaults) {
93231
93366
  setShowHelpDialog(true);
93232
93367
  return;
@@ -93234,7 +93369,12 @@ const EmailPreview = ({
93234
93369
  if (business?.uiDefaults?.emailHelpDialogShow && !showHelpDialog) {
93235
93370
  setShowHelpDialog(true);
93236
93371
  }
93237
- }, [business, business?.uiDefaults?.emailHelpDialogShow, showHelpDialog]);
93372
+ }, [
93373
+ business,
93374
+ business?.uiDefaults?.emailHelpDialogShow,
93375
+ showHelpDialog,
93376
+ showStripoEditor
93377
+ ]);
93238
93378
  const debouncedSubject = useDebounce(subject, 500);
93239
93379
  const debouncedPreviewText = useDebounce(previewText, 500);
93240
93380
  const computedEmailChannelSendersWithChannelAccounts = useMemo(
@@ -93400,6 +93540,7 @@ const EmailPreview = ({
93400
93540
  /* @__PURE__ */ jsx(IconDefinitions.InfoIcon, { className: "w-4 h-4" })
93401
93541
  ] }) })
93402
93542
  ] }),
93543
+ /* @__PURE__ */ jsx("div", { className: "flex items-center gap-2", children: /* @__PURE__ */ jsx(ToggleDesktopMobileButton, {}) }),
93403
93544
  /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
93404
93545
  /* @__PURE__ */ jsx(
93405
93546
  Button$1,
@@ -101889,13 +102030,11 @@ const AutomationEditorEmailPreview = ({
101889
102030
  ] }),
101890
102031
  /* @__PURE__ */ jsxs("div", { className: "w-full h-full", children: [
101891
102032
  /* @__PURE__ */ jsxs("div", { className: "flex justify-between items-center p-1 border-b", children: [
101892
- /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
101893
- /* @__PURE__ */ jsx("h2", { className: "text-lg font-medium", children: "Email Editor" }),
101894
- /* @__PURE__ */ jsx(Button$1, { size: "sm", onClick: () => setShowHelpDialog(true), children: /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
101895
- /* @__PURE__ */ jsx("span", { className: "font-medium text-sm", children: "Help" }),
101896
- /* @__PURE__ */ jsx(IconDefinitions.InfoIcon, { className: "w-4 h-4" })
101897
- ] }) })
101898
- ] }),
102033
+ /* @__PURE__ */ jsx("div", { className: "flex items-center gap-2", children: /* @__PURE__ */ jsx(Button$1, { size: "sm", onClick: () => setShowHelpDialog(true), children: /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
102034
+ /* @__PURE__ */ jsx("span", { className: "font-medium text-sm", children: "Help" }),
102035
+ /* @__PURE__ */ jsx(IconDefinitions.InfoIcon, { className: "w-4 h-4" })
102036
+ ] }) }) }),
102037
+ /* @__PURE__ */ jsx("div", { className: "flex items-center gap-2", children: /* @__PURE__ */ jsx(ToggleDesktopMobileButton, {}) }),
101899
102038
  /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
101900
102039
  /* @__PURE__ */ jsx(
101901
102040
  Button$1,