@embedreach/components 0.3.1 → 0.3.3

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
  *
@@ -41192,12 +41213,12 @@ const ReachProvider = ({
41192
41213
  ] });
41193
41214
  }
41194
41215
  const appContent = /* @__PURE__ */ jsxs(QueryClientProvider, { client: queryClient, children: [
41195
- /* @__PURE__ */ jsx("div", { id: "reach-provider-launchdarkly", children: /* @__PURE__ */ jsx(
41216
+ /* @__PURE__ */ jsx(
41196
41217
  LaunchDarklyProvider,
41197
41218
  {
41198
41219
  tenantExternalId,
41199
41220
  partnerId,
41200
- children: /* @__PURE__ */ jsx("div", { id: "reach-provider-posthog", children: /* @__PURE__ */ jsx(
41221
+ children: /* @__PURE__ */ jsx(
41201
41222
  PostHogProviderWrapper,
41202
41223
  {
41203
41224
  tenantExternalId,
@@ -41205,39 +41226,32 @@ const ReachProvider = ({
41205
41226
  feature,
41206
41227
  clientEntryPoint,
41207
41228
  debug: debug2,
41208
- children: /* @__PURE__ */ jsx("div", { id: "reach-provider-i18n", children: /* @__PURE__ */ jsxs(
41209
- I18nProvider,
41210
- {
41211
- language,
41212
- initialLanguage: language?.default,
41213
- children: [
41214
- /* @__PURE__ */ jsx("div", { id: "reach-provider-observability", children: /* @__PURE__ */ jsx(
41215
- Observability,
41216
- {
41217
- tenantExternalId,
41218
- partnerId,
41219
- configCallbacks: Object.keys(callbacks || {}).join(","),
41220
- clientEntryPoint,
41221
- debug: debug2
41222
- }
41223
- ) }),
41224
- /* @__PURE__ */ jsx("div", { id: "reach-provider-theme", children: /* @__PURE__ */ jsx(Provider$4, { initialTheme: theme2, children: /* @__PURE__ */ jsx("div", { id: "reach-provider-auth", children: /* @__PURE__ */ jsxs(Provider$6, { children: [
41225
- /* @__PURE__ */ jsx("div", { id: "reach-provider-auth-callback", children: /* @__PURE__ */ jsx(
41226
- AuthCallbackHandler,
41227
- {
41228
- reauthCallback: callbacks?.onReauthRequested
41229
- }
41230
- ) }),
41231
- /* @__PURE__ */ jsx("div", { id: "reach-provider-children", children: children2 }),
41232
- /* @__PURE__ */ jsx("div", { id: "reach-provider-toaster", children: /* @__PURE__ */ jsx(Toaster, {}) })
41233
- ] }) }) }) })
41234
- ]
41235
- }
41236
- ) })
41229
+ children: /* @__PURE__ */ jsxs(I18nProvider, { language, initialLanguage: language?.default, children: [
41230
+ /* @__PURE__ */ jsx(
41231
+ Observability,
41232
+ {
41233
+ tenantExternalId,
41234
+ partnerId,
41235
+ configCallbacks: Object.keys(callbacks || {}).join(","),
41236
+ clientEntryPoint,
41237
+ debug: debug2
41238
+ }
41239
+ ),
41240
+ /* @__PURE__ */ jsx(Provider$4, { initialTheme: theme2, children: /* @__PURE__ */ jsxs(Provider$6, { children: [
41241
+ /* @__PURE__ */ jsx(
41242
+ AuthCallbackHandler,
41243
+ {
41244
+ reauthCallback: callbacks?.onReauthRequested
41245
+ }
41246
+ ),
41247
+ children2,
41248
+ /* @__PURE__ */ jsx(Toaster, {})
41249
+ ] }) })
41250
+ ] })
41237
41251
  }
41238
- ) })
41252
+ )
41239
41253
  }
41240
- ) }),
41254
+ ),
41241
41255
  debug2 && /* @__PURE__ */ jsx(ReactQueryDevtools2, {})
41242
41256
  ] });
41243
41257
  return /* @__PURE__ */ jsx(ErrorBoundary, { fallback: /* @__PURE__ */ jsx(ErrorFallback, {}), children: /* @__PURE__ */ jsx("div", { "data-reach-root": true, className: "h-full w-full", children: shouldEnableSandbox ? /* @__PURE__ */ jsxs(Suspense, { fallback: null, children: [
@@ -52038,6 +52052,11 @@ const IconDefinitions = {
52038
52052
  SmsIcon: Phone,
52039
52053
  ExpandIcon: Maximize2,
52040
52054
  PreviewButton: Play,
52055
+ /**
52056
+ * Device toggle icons
52057
+ */
52058
+ DesktopIcon: Monitor,
52059
+ MobileIcon: Smartphone,
52041
52060
  /**
52042
52061
  * Statistics icons
52043
52062
  */
@@ -89720,6 +89739,72 @@ const RichTextInputWithMergeFields = ({
89720
89739
  ] })
89721
89740
  ] }) });
89722
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
+ };
89723
89808
  function setRef$3(ref, value) {
89724
89809
  if (typeof ref === "function") {
89725
89810
  return ref(value);
@@ -92714,9 +92799,35 @@ const EmailPreviewHtmlRenderer = ({
92714
92799
  }
92715
92800
  ) : /* @__PURE__ */ jsx("div", { className: "flex items-center justify-center h-full", children: /* @__PURE__ */ jsx(MissingDataForPreview, { type: "email" }) }) });
92716
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
+ ];
92717
92827
  const EmailPreviewHelpDialog = () => {
92718
92828
  const { toggleEmailHelpDialog: toggleEmailHelpDialog2, data: business } = useBusiness();
92719
92829
  const { toast: toast2 } = useToast();
92830
+ const [selectedTopic, setSelectedTopic] = useState("dynamic-content");
92720
92831
  const handleDontShowAgain = () => {
92721
92832
  toggleEmailHelpDialog2(false);
92722
92833
  toast2({
@@ -92724,37 +92835,48 @@ const EmailPreviewHelpDialog = () => {
92724
92835
  });
92725
92836
  };
92726
92837
  const shouldShowDontShowAgainButton = business?.uiDefaults?.emailHelpDialogShow !== false;
92838
+ const topic = HELP_TOPICS.find((t3) => t3.id === selectedTopic) ?? HELP_TOPICS[0];
92727
92839
  return /* @__PURE__ */ jsxs("div", { className: "p-6 overflow-y-auto", children: [
92728
92840
  /* @__PURE__ */ jsxs("div", { className: "mb-8 text-center", children: [
92729
92841
  /* @__PURE__ */ jsx("h2", { className: "text-2xl font-semibold mb-2", children: "Email Editor Help Center" }),
92730
92842
  /* @__PURE__ */ jsx("p", { className: "text-gray-500", children: "Learn how to use our email editor's powerful features" })
92731
92843
  ] }),
92732
- /* @__PURE__ */ jsxs("div", { className: "space-y-4 max-w-xl mx-auto", children: [
92733
- /* @__PURE__ */ jsx("h3", { className: "text-lg font-medium", children: "Using Dynamic Content" }),
92734
- /* @__PURE__ */ jsxs("div", { className: "relative rounded-lg overflow-hidden bg-gray-50", children: [
92735
- /* @__PURE__ */ jsx(
92736
- "img",
92737
- {
92738
- src: "https://cdn.embedreach.com/assets/engage/merge-tags-demo.gif",
92739
- alt: "Merge Tags Demo",
92740
- className: "w-full shadow-lg max-w-md mx-auto"
92741
- }
92742
- ),
92743
- /* @__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" }) })
92744
- ] }),
92745
- /* @__PURE__ */ jsx("div", { className: "px-2", children: /* @__PURE__ */ jsx(
92746
- BigSelector,
92747
- {
92748
- onClick: () => {
92749
- },
92750
- title: "Dynamic Content",
92751
- subtitle: "Dynamic content is a way to insert dynamic content into your email such as the customer's name, email, or other details.",
92752
- icon: /* @__PURE__ */ jsx(Merge, {}),
92753
- selected: true
92754
- }
92755
- ) }),
92756
- 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" }) })
92757
- ] })
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" }) })
92758
92880
  ] });
92759
92881
  };
92760
92882
  const MissingSenderForPreview = ({
@@ -93025,7 +93147,9 @@ const initStripo = (options) => {
93025
93147
  warn: console.warn,
93026
93148
  success: console.log
93027
93149
  },
93028
- mergeTags: options.mergeFields
93150
+ mergeTags: options.mergeFields,
93151
+ mobileViewButtonSelector: ".toggle-mobile-button",
93152
+ desktopViewButtonSelector: ".toggle-desktop-button"
93029
93153
  });
93030
93154
  resolve(void 0);
93031
93155
  }
@@ -93407,6 +93531,7 @@ const EmailPreview = ({
93407
93531
  /* @__PURE__ */ jsx(IconDefinitions.InfoIcon, { className: "w-4 h-4" })
93408
93532
  ] }) })
93409
93533
  ] }),
93534
+ /* @__PURE__ */ jsx("div", { className: "flex items-center gap-2", children: /* @__PURE__ */ jsx(ToggleDesktopMobileButton, {}) }),
93410
93535
  /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
93411
93536
  /* @__PURE__ */ jsx(
93412
93537
  Button$1,
@@ -101896,13 +102021,11 @@ const AutomationEditorEmailPreview = ({
101896
102021
  ] }),
101897
102022
  /* @__PURE__ */ jsxs("div", { className: "w-full h-full", children: [
101898
102023
  /* @__PURE__ */ jsxs("div", { className: "flex justify-between items-center p-1 border-b", children: [
101899
- /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
101900
- /* @__PURE__ */ jsx("h2", { className: "text-lg font-medium", children: "Email Editor" }),
101901
- /* @__PURE__ */ jsx(Button$1, { size: "sm", onClick: () => setShowHelpDialog(true), children: /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
101902
- /* @__PURE__ */ jsx("span", { className: "font-medium text-sm", children: "Help" }),
101903
- /* @__PURE__ */ jsx(IconDefinitions.InfoIcon, { className: "w-4 h-4" })
101904
- ] }) })
101905
- ] }),
102024
+ /* @__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: [
102025
+ /* @__PURE__ */ jsx("span", { className: "font-medium text-sm", children: "Help" }),
102026
+ /* @__PURE__ */ jsx(IconDefinitions.InfoIcon, { className: "w-4 h-4" })
102027
+ ] }) }) }),
102028
+ /* @__PURE__ */ jsx("div", { className: "flex items-center gap-2", children: /* @__PURE__ */ jsx(ToggleDesktopMobileButton, {}) }),
101906
102029
  /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
101907
102030
  /* @__PURE__ */ jsx(
101908
102031
  Button$1,
@@ -117728,7 +117851,7 @@ const ViewAutomationMain = ({
117728
117851
  updateCommunicationGroup2
117729
117852
  ]);
117730
117853
  if (!automation2 || !communicationGroup) {
117731
- return /* @__PURE__ */ jsx("div", { className: "flex h-screen items-center justify-center", children: /* @__PURE__ */ jsx(
117854
+ return /* @__PURE__ */ jsx("div", { className: "flex h-full items-center justify-center", children: /* @__PURE__ */ jsx(
117732
117855
  BasicLoader,
117733
117856
  {
117734
117857
  text: [