@embedreach/components 0.1.91 → 0.1.93

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.
@@ -2739,7 +2739,6 @@ const useUpdateBusinessAutomation = (automationId) => {
2739
2739
  const updateAutomationMutation = useMutation({
2740
2740
  mutationFn: (params) => updateAutomation(automationId, params),
2741
2741
  onSuccess: () => {
2742
- queryClient.invalidateQueries({ queryKey: ["automations"] });
2743
2742
  queryClient.invalidateQueries({
2744
2743
  queryKey: ["automations", automationId]
2745
2744
  });
@@ -13225,9 +13224,7 @@ const applyThemeStyles = (styles2) => {
13225
13224
  if (key === "radius" || key === "font-body" || key === "font-heading") {
13226
13225
  finalValue = userValue;
13227
13226
  } else if (isValidColor(userValue)) {
13228
- const isTailwindClass = /^(bg|text|border|ring|shadow|from|via|to|divide|placeholder|caret|accent|outline|decoration|fill|stroke)-/.test(
13229
- userValue.trim()
13230
- );
13227
+ const isTailwindClass = /^bg-/.test(userValue.trim());
13231
13228
  if (isTailwindClass) {
13232
13229
  const rootElement = document.querySelector("[data-reach-root]");
13233
13230
  if (rootElement) {
@@ -15952,8 +15949,6 @@ const date$2 = "Date";
15952
15949
  const close$1 = "Close";
15953
15950
  const connected$1 = "Connected";
15954
15951
  const connecting$1 = "Connecting...";
15955
- const reauth_required$1 = "Re-authentication required";
15956
- const reauth_required_description$1 = "Re-authentication required for one of your ad accounts";
15957
15952
  const reauthenticate$1 = "Reauthenticate";
15958
15953
  const account_settings$1 = "Account Settings";
15959
15954
  const manage_account_settings$1 = "Manage your account settings";
@@ -15978,6 +15973,10 @@ const measure$1 = {
15978
15973
  dashboard: {
15979
15974
  title: "Marketing ROI Dashboard",
15980
15975
  subtitle: "Track and analyze how your marketing efforts are driving sales",
15976
+ application_status_banner_title: "We are experiencing some issues",
15977
+ application_status_banner_description: "We are aware of an issue affecting the dashboard. We are working on it and will have it resolved soon.",
15978
+ no_metrics_banner_title: "We are unable to display any metrics for this date range",
15979
+ no_metrics_banner_description: "If you have just connected your ad accounts, your metrics should begin populating within the next 24 hours. Please check back soon.",
15981
15980
  reach_managed_campaign_banner: "Your ads are being managed by Reach. We’ll automatically optimize them to drive the best results."
15982
15981
  }
15983
15982
  };
@@ -16359,8 +16358,6 @@ const enCommon = {
16359
16358
  "continue": "Continue",
16360
16359
  connected: connected$1,
16361
16360
  connecting: connecting$1,
16362
- reauth_required: reauth_required$1,
16363
- reauth_required_description: reauth_required_description$1,
16364
16361
  reauthenticate: reauthenticate$1,
16365
16362
  account_settings: account_settings$1,
16366
16363
  manage_account_settings: manage_account_settings$1,
@@ -16416,8 +16413,6 @@ const date$1 = "Fecha";
16416
16413
  const close = "Cerrar";
16417
16414
  const connected = "Conectado";
16418
16415
  const connecting = "Conectando...";
16419
- const reauth_required = "Re-autenticación requerida";
16420
- const reauth_required_description = "Re-autenticación requerida para una de tus cuentas de anuncios";
16421
16416
  const reauthenticate = "Reautenticar";
16422
16417
  const account_settings = "Configuración de cuenta";
16423
16418
  const manage_account_settings = "Configuración de tu cuenta";
@@ -16442,6 +16437,10 @@ const measure = {
16442
16437
  dashboard: {
16443
16438
  title: "Panel de ingresos de marketing",
16444
16439
  subtitle: "Rastrea y analiza cómo tus esfuerzos de marketing están generando ventas",
16440
+ application_status_banner_title: "Estamos experimentando algunos problemas",
16441
+ application_status_banner_description: "Estamos al tanto de un problema que está afectando al panel. Estamos trabajando en ello y lo resolveremos pronto.",
16442
+ no_metrics_banner_title: "No podemos mostrar ninguna métrica para este rango de fechas",
16443
+ no_metrics_banner_description: "Si has conectado tus cuentas de anuncios recientemente, tus métricas deberían comenzar a poblarse en las próximas 24 horas. Por favor, vuelve pronto.",
16445
16444
  reach_managed_campaign_banner: "Tus anuncios están siendo gestionados por Reach. Automáticamente los optimizaremos para obtener los mejores resultados."
16446
16445
  }
16447
16446
  };
@@ -16823,8 +16822,6 @@ const esCommon = {
16823
16822
  "continue": "Continuar",
16824
16823
  connected,
16825
16824
  connecting,
16826
- reauth_required,
16827
- reauth_required_description,
16828
16825
  reauthenticate,
16829
16826
  account_settings,
16830
16827
  manage_account_settings,
@@ -16955,6 +16952,10 @@ const defaultTranslations = {
16955
16952
  dashboard: {
16956
16953
  title: "Marketing ROI Dashboard",
16957
16954
  subtitle: "Track and analyze how your marketing efforts are driving sales",
16955
+ application_status_banner_title: "We are experiencing some issues",
16956
+ application_status_banner_description: "We are aware of an issue affecting the dashboard. We are working on it and will have it resolved soon.",
16957
+ no_metrics_banner_title: "We are unable to display any metrics for this date range",
16958
+ no_metrics_banner_description: "If you have just connected your ad accounts, your metrics should begin populating within the next 24 hours. Please check back soon.",
16958
16959
  reach_managed_campaign_banner: "Your ads are being managed by Reach. We’ll automatically optimize them to drive the best results."
16959
16960
  }
16960
16961
  },
@@ -45297,6 +45298,11 @@ class BufferedCryptoRandom {
45297
45298
  let defaultGenerator;
45298
45299
  const uuidv7 = () => uuidv7obj().toString();
45299
45300
  const uuidv7obj = () => (defaultGenerator || (defaultGenerator = new V7Generator())).generate();
45301
+ function UnreachableCaseStatement$1(x3, enumObj) {
45302
+ throw new Error(
45303
+ `Unreachable case statement: ${JSON.stringify(x3)}. Valid values are: ${Object.values(enumObj).join(", ")}`
45304
+ );
45305
+ }
45300
45306
  const createCommunicationGroup = async (params) => {
45301
45307
  const response = await baseRequest(
45302
45308
  `${COMMUNICATION_GROUP_PATH}`,
@@ -45760,7 +45766,10 @@ const SetAutomationNameAndDescription = ({
45760
45766
  }
45761
45767
  };
45762
45768
  return /* @__PURE__ */ jsxs("div", { className: "flex flex-col items-center justify-center p-8 max-w-lg mx-auto", children: [
45763
- /* @__PURE__ */ jsx("h2", { className: "text-2xl font-semibold mb-8 text-center", children: "Name Your Automation" }),
45769
+ /* @__PURE__ */ jsxs("h2", { className: "text-2xl font-semibold mb-8 text-center", children: [
45770
+ "Name Your ",
45771
+ t("engage:automation")
45772
+ ] }),
45764
45773
  /* @__PURE__ */ jsxs("div", { className: "w-full space-y-6", children: [
45765
45774
  /* @__PURE__ */ jsx("div", { className: "bg-gray-50 p-6 rounded-xl items-center justify-center text-center", children: getAutomationComponent() }),
45766
45775
  /* @__PURE__ */ jsxs("div", { className: "space-y-6", children: [
@@ -45808,7 +45817,7 @@ const SetAutomationNameAndDescription = ({
45808
45817
  value: automationDescription,
45809
45818
  onChange: (e4) => setAutomationDescription(e4.target.value),
45810
45819
  className: "w-full min-h-[80px] resize-none",
45811
- placeholder: "Add any helpful context for your team..."
45820
+ placeholder: `Add any helpful context for your team. If left blank, we'll generate one for you when you start the ${t("engage:automation")}`
45812
45821
  }
45813
45822
  )
45814
45823
  ] })
@@ -45857,7 +45866,7 @@ const CreateAutomationModal = ({
45857
45866
  day: "numeric"
45858
45867
  });
45859
45868
  const autoName = `${t("engage:automation")} ${formattedDate} ${formattedTime}`;
45860
- const autoDescription = `${t("engage:automation_other")} ${formattedDate} ${formattedTime}`;
45869
+ const autoDescription = "";
45861
45870
  setAutomationState((prevState) => ({
45862
45871
  ...prevState,
45863
45872
  name: autoName,
@@ -45920,40 +45929,50 @@ const CreateAutomationModal = ({
45920
45929
  if (isCreating || startedCreating) {
45921
45930
  return /* @__PURE__ */ jsx("div", { className: styles$3.container, children: /* @__PURE__ */ jsx(BasicLoader, { text: ["Creating Automation", "Finishing up"] }) });
45922
45931
  }
45923
- return /* @__PURE__ */ jsxs("div", { className: "relative overflow-y-auto h-full p-8", children: [
45924
- /* @__PURE__ */ jsxs(AnimatePresence, { children: [
45925
- currentStep === CreateAutomationModalStep.ChooseAutomationType && /* @__PURE__ */ jsx(BlurDiv, { children: /* @__PURE__ */ jsx(
45926
- ChooseAutomationType,
45927
- {
45928
- onNext: (selectedType) => {
45929
- setAutomationState({ ...automationState, type: selectedType });
45930
- setCurrentStep(CreateAutomationModalStep.SetAutomationName);
45931
- },
45932
- iconDefinitions: finalIconDefinitions
45933
- }
45934
- ) }, "choose-automation-type"),
45935
- currentStep === CreateAutomationModalStep.SetAutomationName && automationState.type && /* @__PURE__ */ jsx(BlurDiv, { children: /* @__PURE__ */ jsx(
45936
- SetAutomationNameAndDescription,
45937
- {
45938
- iconDefinitions: finalIconDefinitions,
45939
- selectedType: automationState.type,
45940
- setAutomationName: (name) => {
45941
- setAutomationState({
45942
- ...automationState,
45943
- name
45944
- });
45945
- },
45946
- automationName: automationState.name ?? "",
45947
- setAutomationDescription: (description2) => {
45948
- setAutomationState({
45949
- ...automationState,
45950
- description: description2
45951
- });
45952
- },
45953
- automationDescription: automationState.description ?? ""
45932
+ const renderContent = () => {
45933
+ switch (currentStep) {
45934
+ case CreateAutomationModalStep.ChooseAutomationType:
45935
+ return /* @__PURE__ */ jsx(
45936
+ ChooseAutomationType,
45937
+ {
45938
+ onNext: (selectedType) => {
45939
+ setAutomationState({ ...automationState, type: selectedType });
45940
+ setCurrentStep(CreateAutomationModalStep.SetAutomationName);
45941
+ },
45942
+ iconDefinitions: finalIconDefinitions
45943
+ }
45944
+ );
45945
+ case CreateAutomationModalStep.SetAutomationName:
45946
+ if (!automationState.type) {
45947
+ return null;
45954
45948
  }
45955
- ) }, "set-automation-name")
45956
- ] }),
45949
+ return /* @__PURE__ */ jsx(
45950
+ SetAutomationNameAndDescription,
45951
+ {
45952
+ iconDefinitions: finalIconDefinitions,
45953
+ selectedType: automationState.type,
45954
+ setAutomationName: (name) => {
45955
+ setAutomationState({
45956
+ ...automationState,
45957
+ name
45958
+ });
45959
+ },
45960
+ automationName: automationState.name ?? "",
45961
+ setAutomationDescription: (description2) => {
45962
+ setAutomationState({
45963
+ ...automationState,
45964
+ description: description2
45965
+ });
45966
+ },
45967
+ automationDescription: automationState.description ?? ""
45968
+ }
45969
+ );
45970
+ default:
45971
+ throw UnreachableCaseStatement$1(currentStep, CreateAutomationModalStep);
45972
+ }
45973
+ };
45974
+ return /* @__PURE__ */ jsxs("div", { className: "relative overflow-y-auto h-full p-8", children: [
45975
+ /* @__PURE__ */ jsx(AnimatePresence, { mode: "wait", children: /* @__PURE__ */ jsx(BlurDiv, { children: renderContent() }, currentStep) }),
45957
45976
  /* @__PURE__ */ jsx("div", { className: "pt-2", children: /* @__PURE__ */ jsx(
45958
45977
  ActionButtons,
45959
45978
  {
@@ -46147,7 +46166,7 @@ function isDate$2(val) {
46147
46166
  return __toString.call(val) === "[object Date]";
46148
46167
  }
46149
46168
  /**
46150
- * react-router v7.1.0
46169
+ * react-router v7.5.2
46151
46170
  *
46152
46171
  * Copyright (c) Remix Software Inc.
46153
46172
  *
@@ -46558,7 +46577,7 @@ function decodePath(value) {
46558
46577
  } catch (error2) {
46559
46578
  warning(
46560
46579
  false,
46561
- `The URL path "${value}" could not be decoded because it is is a malformed URL segment. This is probably due to a bad percent encoding (${error2}).`
46580
+ `The URL path "${value}" could not be decoded because it is a malformed URL segment. This is probably due to a bad percent encoding (${error2}).`
46562
46581
  );
46563
46582
  return value;
46564
46583
  }
@@ -46825,7 +46844,7 @@ function useRoutesImpl(routes, locationArg, dataRouterState, future) {
46825
46844
  // router loaded. We can help them understand how to avoid that.
46826
46845
  `useRoutes() may be used only in the context of a <Router> component.`
46827
46846
  );
46828
- let { navigator: navigator2 } = React.useContext(NavigationContext$1);
46847
+ let { navigator: navigator2, static: isStatic } = React.useContext(NavigationContext$1);
46829
46848
  let { matches: parentMatches } = React.useContext(RouteContext);
46830
46849
  let routeMatch = parentMatches[parentMatches.length - 1];
46831
46850
  let parentParams = routeMatch ? routeMatch.params : {};
@@ -46854,7 +46873,7 @@ Please change the parent <Route path="${parentPath}"> to <Route path="${parentPa
46854
46873
  let segments = pathname.replace(/^\//, "").split("/");
46855
46874
  remainingPathname = "/" + segments.slice(parentSegments.length).join("/");
46856
46875
  }
46857
- let matches = matchRoutes(routes, { pathname: remainingPathname });
46876
+ let matches = !isStatic && dataRouterState && dataRouterState.matches && dataRouterState.matches.length > 0 ? dataRouterState.matches : matchRoutes(routes, { pathname: remainingPathname });
46858
46877
  {
46859
46878
  warning(
46860
46879
  parentRoute || matches != null,
@@ -47483,12 +47502,21 @@ function getNewMatchesForLinks(page, nextMatches, currentMatches, manifest, loca
47483
47502
  }
47484
47503
  return [];
47485
47504
  }
47486
- function getModuleLinkHrefs(matches, manifestPatch) {
47505
+ function getModuleLinkHrefs(matches, manifest, { includeHydrateFallback } = {}) {
47487
47506
  return dedupeHrefs(
47488
47507
  matches.map((match2) => {
47489
- let route = manifestPatch.routes[match2.route.id];
47508
+ let route = manifest.routes[match2.route.id];
47490
47509
  if (!route) return [];
47491
47510
  let hrefs = [route.module];
47511
+ if (route.clientActionModule) {
47512
+ hrefs = hrefs.concat(route.clientActionModule);
47513
+ }
47514
+ if (route.clientLoaderModule) {
47515
+ hrefs = hrefs.concat(route.clientLoaderModule);
47516
+ }
47517
+ if (includeHydrateFallback && route.hydrateFallbackModule) {
47518
+ hrefs = hrefs.concat(route.hydrateFallbackModule);
47519
+ }
47492
47520
  if (route.imports) {
47493
47521
  hrefs = hrefs.concat(route.imports);
47494
47522
  }
@@ -47519,7 +47547,8 @@ function dedupeLinkDescriptors(descriptors, preloads) {
47519
47547
  return deduped;
47520
47548
  }, []);
47521
47549
  }
47522
- function singleFetchUrl(reqUrl) {
47550
+ var NO_BODY_STATUS_CODES = /* @__PURE__ */ new Set([100, 101, 204, 205]);
47551
+ function singleFetchUrl(reqUrl, basename) {
47523
47552
  let url = typeof reqUrl === "string" ? new URL(
47524
47553
  reqUrl,
47525
47554
  // This can be called during the SSR flow via PrefetchPageLinksImpl so
@@ -47528,6 +47557,8 @@ function singleFetchUrl(reqUrl) {
47528
47557
  ) : reqUrl;
47529
47558
  if (url.pathname === "/") {
47530
47559
  url.pathname = "_root.data";
47560
+ } else if (basename && stripBasename(url.pathname, basename) === "/") {
47561
+ url.pathname = `${basename.replace(/\/$/, "")}/_root.data`;
47531
47562
  } else {
47532
47563
  url.pathname = `${url.pathname.replace(/\/$/, "")}.data`;
47533
47564
  }
@@ -47664,6 +47695,7 @@ function PrefetchPageLinksImpl({
47664
47695
  }) {
47665
47696
  let location2 = useLocation();
47666
47697
  let { manifest, routeModules } = useFrameworkContext();
47698
+ let { basename } = useDataRouterContext2();
47667
47699
  let { loaderData, matches } = useDataRouterStateContext();
47668
47700
  let newMatchesForData = React.useMemo(
47669
47701
  () => getNewMatchesForLinks(
@@ -47709,7 +47741,7 @@ function PrefetchPageLinksImpl({
47709
47741
  if (routesParams.size === 0) {
47710
47742
  return [];
47711
47743
  }
47712
- let url = singleFetchUrl(page);
47744
+ let url = singleFetchUrl(page, basename);
47713
47745
  if (foundOptOutRoute && routesParams.size > 0) {
47714
47746
  url.searchParams.set(
47715
47747
  "_routes",
@@ -47718,6 +47750,7 @@ function PrefetchPageLinksImpl({
47718
47750
  }
47719
47751
  return [url.pathname + url.search];
47720
47752
  }, [
47753
+ basename,
47721
47754
  loaderData,
47722
47755
  location2,
47723
47756
  manifest,
@@ -47731,7 +47764,7 @@ function PrefetchPageLinksImpl({
47731
47764
  [newMatchesForAssets, manifest]
47732
47765
  );
47733
47766
  let keyedPrefetchLinks = useKeyedPrefetchLinks(newMatchesForAssets);
47734
- return /* @__PURE__ */ React.createElement(React.Fragment, null, dataHrefs.map((href) => /* @__PURE__ */ React.createElement("link", { key: href, rel: "prefetch", as: "fetch", href, ...linkProps })), moduleHrefs.map((href) => /* @__PURE__ */ React.createElement("link", { key: href, rel: "modulepreload", href, ...linkProps })), keyedPrefetchLinks.map(({ key, link: link2 }) => (
47767
+ return /* @__PURE__ */ React.createElement(React.Fragment, null, dataHrefs.map((href2) => /* @__PURE__ */ React.createElement("link", { key: href2, rel: "prefetch", as: "fetch", href: href2, ...linkProps })), moduleHrefs.map((href2) => /* @__PURE__ */ React.createElement("link", { key: href2, rel: "modulepreload", href: href2, ...linkProps })), keyedPrefetchLinks.map(({ key, link: link2 }) => (
47735
47768
  // these don't spread `linkProps` because they are full link descriptors
47736
47769
  // already with their own props
47737
47770
  /* @__PURE__ */ React.createElement("link", { key, ...link2 })
@@ -47751,7 +47784,7 @@ function mergeRefs(...refs) {
47751
47784
  var isBrowser = typeof window !== "undefined" && typeof window.document !== "undefined" && typeof window.document.createElement !== "undefined";
47752
47785
  try {
47753
47786
  if (isBrowser) {
47754
- window.__reactRouterVersion = "7.1.0";
47787
+ window.__reactRouterVersion = "7.5.2";
47755
47788
  }
47756
47789
  } catch (e4) {
47757
47790
  }
@@ -47795,7 +47828,7 @@ var Link = React.forwardRef(
47795
47828
  }
47796
47829
  }
47797
47830
  }
47798
- let href = useHref(to, { relative });
47831
+ let href2 = useHref(to, { relative });
47799
47832
  let [shouldPrefetch, prefetchRef, prefetchHandlers] = usePrefetchBehavior(
47800
47833
  prefetch,
47801
47834
  rest
@@ -47821,7 +47854,7 @@ var Link = React.forwardRef(
47821
47854
  {
47822
47855
  ...rest,
47823
47856
  ...prefetchHandlers,
47824
- href: absoluteHref || href,
47857
+ href: absoluteHref || href2,
47825
47858
  onClick: isExternal || reloadDocument ? onClick : handleClick,
47826
47859
  ref: mergeRefs(forwardedRef, prefetchRef),
47827
47860
  target,
@@ -47829,7 +47862,7 @@ var Link = React.forwardRef(
47829
47862
  }
47830
47863
  )
47831
47864
  );
47832
- return shouldPrefetch && !isAbsolute ? /* @__PURE__ */ React.createElement(React.Fragment, null, link2, /* @__PURE__ */ React.createElement(PrefetchPageLinks, { page: href })) : link2;
47865
+ return shouldPrefetch && !isAbsolute ? /* @__PURE__ */ React.createElement(React.Fragment, null, link2, /* @__PURE__ */ React.createElement(PrefetchPageLinks, { page: href2 })) : link2;
47833
47866
  }
47834
47867
  );
47835
47868
  Link.displayName = "Link";
@@ -48120,6 +48153,10 @@ function useViewTransitionState(to, opts = {}) {
48120
48153
  return matchPath(path2.pathname, nextPath) != null || matchPath(path2.pathname, currentPath) != null;
48121
48154
  }
48122
48155
  new TextEncoder();
48156
+ /* @__PURE__ */ new Set([
48157
+ ...NO_BODY_STATUS_CODES,
48158
+ 304
48159
+ ]);
48123
48160
  const AnimatedTabs = ({
48124
48161
  tabs,
48125
48162
  activeTab,
@@ -52550,12 +52587,10 @@ const BrandLoader = ({
52550
52587
  ] })
52551
52588
  ] }) : null });
52552
52589
  };
52553
- const AutoParseConfirmWebsite = ({ setAutoParse, onBrandSettingsGenerated }) => {
52590
+ const AutoParseConfirmWebsite = ({ setAutoParse, onBrandSettingsGenerated, onForceRefresh }) => {
52554
52591
  const [websiteUrl, setWebsiteUrl] = useState("");
52555
52592
  const [isEditing, setIsEditing] = useState(false);
52556
- const [brandSettings, setBrandSettings] = useState(
52557
- null
52558
- );
52593
+ const [brandSettings, setBrandSettings] = useState(null);
52559
52594
  const [isAnalyzing, setIsAnalyzing] = useState(false);
52560
52595
  const [showBrandResults, setShowBrandResults] = useState(false);
52561
52596
  const [isInitialFetch, setIsInitialFetch] = useState(true);
@@ -52618,8 +52653,7 @@ const AutoParseConfirmWebsite = ({ setAutoParse, onBrandSettingsGenerated }) =>
52618
52653
  const handleUpdateBrandSettings = () => {
52619
52654
  if (brandSettings) {
52620
52655
  updateBrandSettings({
52621
- // TODO: Add logo_base64 back in once we are able to compress the image
52622
- // logo_base64: brandSettings.logo_base64,
52656
+ logoBase64: brandSettings.logo_base64,
52623
52657
  primaryColor: brandSettings.primaryColor,
52624
52658
  secondaryColors: brandSettings.secondaryColors,
52625
52659
  brandTagline: brandSettings.brandTagline,
@@ -52627,6 +52661,9 @@ const AutoParseConfirmWebsite = ({ setAutoParse, onBrandSettingsGenerated }) =>
52627
52661
  brandPersonality: brandSettings.brandPersonality,
52628
52662
  colorPalette: brandSettings.colorPalette
52629
52663
  });
52664
+ if (onForceRefresh) {
52665
+ onForceRefresh();
52666
+ }
52630
52667
  toast({
52631
52668
  title: "Brand settings saved successfully 🚀",
52632
52669
  description: "Your brand identity has been updated."
@@ -52864,6 +52901,7 @@ const BrandSettingsModal = () => {
52864
52901
  const [autoParse, setAutoParse] = useState(false);
52865
52902
  const [logoUrl, setLogoUrl] = useState(void 0);
52866
52903
  const [hexInput, setHexInput] = useState("");
52904
+ const [imageTimestamp, setImageTimestamp] = useState(Date.now());
52867
52905
  const fileInputRef = useRef(null);
52868
52906
  const { toast: toast2 } = useToast();
52869
52907
  useEffect(() => {
@@ -52874,6 +52912,7 @@ const BrandSettingsModal = () => {
52874
52912
  }
52875
52913
  if (meResponse?.branding?.logoUrl) {
52876
52914
  setLogoUrl(meResponse.branding.logoUrl);
52915
+ setImageTimestamp(Date.now());
52877
52916
  }
52878
52917
  }, [meResponse]);
52879
52918
  const handleColorChange = (color2) => {
@@ -52895,7 +52934,7 @@ const BrandSettingsModal = () => {
52895
52934
  const base64String = reader.result;
52896
52935
  setLogoUrl(base64String);
52897
52936
  updateBrandSettings({
52898
- logoUrl: base64String
52937
+ logoBase64: base64String
52899
52938
  });
52900
52939
  };
52901
52940
  reader.readAsDataURL(file);
@@ -52924,7 +52963,13 @@ const BrandSettingsModal = () => {
52924
52963
  title: "Brand settings saved 🚀"
52925
52964
  });
52926
52965
  };
52927
- return /* @__PURE__ */ jsx("div", { className: "w-full bg-white rounded-lg shadow-sm min-h-[500px]", children: autoParse ? /* @__PURE__ */ jsx(AutoParseConfirmWebsite, { setAutoParse }) : /* @__PURE__ */ jsxs(Fragment, { children: [
52966
+ return /* @__PURE__ */ jsx("div", { className: "w-full bg-white rounded-lg shadow-sm min-h-[500px]", children: autoParse ? /* @__PURE__ */ jsx(
52967
+ AutoParseConfirmWebsite,
52968
+ {
52969
+ setAutoParse,
52970
+ onForceRefresh: () => setImageTimestamp(Date.now())
52971
+ }
52972
+ ) : /* @__PURE__ */ jsxs(Fragment, { children: [
52928
52973
  /* @__PURE__ */ jsxs("div", { className: "relative", children: [
52929
52974
  /* @__PURE__ */ jsx(
52930
52975
  "div",
@@ -52950,10 +52995,11 @@ const BrandSettingsModal = () => {
52950
52995
  /* @__PURE__ */ jsx("div", { className: "w-20 h-20 rounded-md border border-gray-200 overflow-hidden bg-gray-50 flex items-center justify-center", children: logoUrl ? /* @__PURE__ */ jsx(
52951
52996
  "img",
52952
52997
  {
52953
- src: logoUrl,
52998
+ src: `${logoUrl}?${imageTimestamp}`,
52954
52999
  alt: "Brand logo",
52955
53000
  className: "w-full h-full object-cover"
52956
- }
53001
+ },
53002
+ imageTimestamp
52957
53003
  ) : /* @__PURE__ */ jsx(Image, { className: "h-6 w-6 text-gray-300" }) }),
52958
53004
  /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-1", children: [
52959
53005
  /* @__PURE__ */ jsx(
@@ -64647,8 +64693,8 @@ const useCommunicationUpdateTracking = () => {
64647
64693
  };
64648
64694
  const useRecipientStats = (automation2) => {
64649
64695
  const { data: estimatedMatches } = useGetCountOfBusinessAutomationRecipients({
64650
- include_segments: automation2?.includeSegmentIds ?? [],
64651
- exclude_segments: automation2?.excludeSegmentIds ?? []
64696
+ includeSegments: automation2?.includeSegmentIds ?? [],
64697
+ excludeSegments: automation2?.excludeSegmentIds ?? []
64652
64698
  });
64653
64699
  const estimatedMatchesStats = useMemo(() => {
64654
64700
  if (!estimatedMatches?.recipients) return { emails: 0, phones: 0 };
@@ -64874,12 +64920,16 @@ const EmailPreview$1 = ({
64874
64920
  ] });
64875
64921
  };
64876
64922
  const SMSPreview$1 = ({ fromPhone, body }) => {
64877
- return /* @__PURE__ */ jsxs("div", { className: "max-w-sm mx-auto min-h-[400px] flex flex-col justify-center flex-1", children: [
64878
- /* @__PURE__ */ jsx("div", { className: "bg-gray-50 p-5 rounded-lg border border-gray-100 mb-6", children: /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-3", children: [
64879
- /* @__PURE__ */ jsx("span", { className: "font-medium text-gray-700", children: "From:" }),
64880
- /* @__PURE__ */ jsx("span", { className: "text-gray-800", children: fromPhone })
64881
- ] }) }),
64882
- /* @__PURE__ */ jsx("div", { className: "border-4 border-gray-800 rounded-3xl p-1 bg-gray-800 shadow-xl mx-auto max-w-xs transform scale-[0.8] origin-top", children: /* @__PURE__ */ jsx("div", { className: "bg-gray-100 rounded-2xl p-4 h-[500px] w-[280px] aspect-[9/16] overflow-y-auto", children: /* @__PURE__ */ jsx("div", { className: "flex justify-end mb-4", children: /* @__PURE__ */ jsx("div", { className: "bg-green-500 text-white rounded-2xl rounded-tr-sm py-3 px-4 max-w-[80%] shadow-sm whitespace-pre-wrap text-[1.5rem]", children: body }) }) }) })
64923
+ return /* @__PURE__ */ jsxs("div", { className: "sms-preview-outer @container", children: [
64924
+ /* @__PURE__ */ jsxs("div", { className: "sms-preview-header", children: [
64925
+ /* @__PURE__ */ jsx("span", { className: "sms-preview-header-label", children: "From:" }),
64926
+ /* @__PURE__ */ jsx("span", { className: "sms-preview-header-phone", children: fromPhone })
64927
+ ] }),
64928
+ /* @__PURE__ */ jsxs("div", { className: "sms-phone-mockup", children: [
64929
+ /* @__PURE__ */ jsx("div", { className: "sms-phone-notch" }),
64930
+ /* @__PURE__ */ jsx("div", { className: "sms-phone-inner", children: /* @__PURE__ */ jsx("div", { className: "sms-message-row", children: /* @__PURE__ */ jsx("div", { className: "sms-message-bubble", children: body }) }) }),
64931
+ /* @__PURE__ */ jsx("div", { className: "sms-phone-home-indicator" })
64932
+ ] })
64883
64933
  ] });
64884
64934
  };
64885
64935
  const PreviewPanel = ({ emailPreview, smsPreview, iconDefinitions }) => {
@@ -64899,7 +64949,7 @@ const PreviewPanel = ({ emailPreview, smsPreview, iconDefinitions }) => {
64899
64949
  initial: { opacity: 0, y: -20 },
64900
64950
  animate: { opacity: 1, y: 0 },
64901
64951
  transition: { duration: 0.5, delay: 0.1 },
64902
- className: "w-full flex flex-col h-full flex-1 min-h-0",
64952
+ className: "w-full flex flex-col h-full flex-1 min-h-0 relative",
64903
64953
  children: /* @__PURE__ */ jsxs("div", { className: "bg-gray-200 rounded-xl shadow-lg border border-gray-100 overflow-hidden flex-1 min-h-0 flex flex-col", children: [
64904
64954
  /* @__PURE__ */ jsxs("div", { className: "flex border-b border-border bg-background", children: [
64905
64955
  emailPreview && /* @__PURE__ */ jsxs(
@@ -65016,7 +65066,7 @@ ${smsPreview.body}` : smsPreview.body
65016
65066
  ] })
65017
65067
  }
65018
65068
  ),
65019
- /* @__PURE__ */ jsx(Dialog, { open: isExpanded, onOpenChange: setIsExpanded, children: /* @__PURE__ */ jsx(DialogContent, { className: "w-[80vw] h-[80vh] max-w-none max-h-none", children: /* @__PURE__ */ jsxs("div", { className: "h-full flex flex-col", children: [
65069
+ /* @__PURE__ */ jsx(Dialog, { open: isExpanded, onOpenChange: setIsExpanded, children: /* @__PURE__ */ jsx(DialogContent, { className: "w-[80vw] h-[80vh] max-w-none max-h-none", children: /* @__PURE__ */ jsxs("div", { className: "h-full flex flex-col overflow-hidden rounded-xl", children: [
65020
65070
  selectedTab === "email" && emailPreview && /* @__PURE__ */ jsx(
65021
65071
  EmailPreview$1,
65022
65072
  {
@@ -65186,12 +65236,12 @@ const AutomationRecipients = ({
65186
65236
  {
65187
65237
  className: "hover:bg-gray-50/50 transition-colors",
65188
65238
  children: [
65189
- /* @__PURE__ */ jsx(TableCell, { style: { width: COLUMN_WIDTHS.name }, children: recipient.first_name || recipient.last_name ? `${recipient.first_name || ""} ${recipient.last_name || ""}`.trim() : /* @__PURE__ */ jsx("span", { className: "text-gray-400", children: "Not provided" }) }),
65239
+ /* @__PURE__ */ jsx(TableCell, { style: { width: COLUMN_WIDTHS.name }, children: recipient.firstName || recipient.lastName ? `${recipient.firstName || ""} ${recipient.lastName || ""}`.trim() : /* @__PURE__ */ jsx("span", { className: "text-gray-400", children: "Not provided" }) }),
65190
65240
  /* @__PURE__ */ jsx(TableCell, { style: { width: COLUMN_WIDTHS.email }, children: recipient.email || /* @__PURE__ */ jsx("span", { className: "text-gray-400", children: "Not provided" }) }),
65191
65241
  /* @__PURE__ */ jsx(TableCell, { style: { width: COLUMN_WIDTHS.phone }, children: recipient.phone || /* @__PURE__ */ jsx("span", { className: "text-gray-400", children: "Not provided" }) })
65192
65242
  ]
65193
65243
  },
65194
- recipient.reach_id
65244
+ recipient.reachId
65195
65245
  )) })
65196
65246
  ] })
65197
65247
  ] });
@@ -66866,54 +66916,97 @@ var AutomationSteps = /* @__PURE__ */ ((AutomationSteps2) => {
66866
66916
  })(AutomationSteps || {});
66867
66917
  const validateAutomationStep = async (args) => {
66868
66918
  const { currentStep, automation: automation2, communicationGroup } = args;
66869
- if (currentStep === 0) {
66870
- return {
66871
- canMove: true,
66872
- errorMessage: null
66873
- };
66874
- }
66875
- if (currentStep === 1) {
66876
- return {
66877
- canMove: automation2.includeSegmentIds.length > 0,
66878
- errorMessage: "Please ensure you have selected at least one segment"
66879
- };
66880
- }
66881
- if (currentStep === 2) {
66882
- const actionDataCommunication = automation2.actionData?.find(
66883
- (action) => action.actionType === "send_communication"
66884
- );
66885
- if (!actionDataCommunication) {
66919
+ switch (currentStep) {
66920
+ case 0:
66886
66921
  return {
66887
- canMove: false,
66888
- errorMessage: "Please ensure you have selected either a email communication or text communication"
66922
+ canMove: true,
66923
+ errorMessage: null
66889
66924
  };
66890
- }
66891
- if (!communicationGroup || !communicationGroup.smsChannelSenderId && !communicationGroup.emailChannelSenderId) {
66925
+ case 1:
66892
66926
  return {
66893
- canMove: false,
66894
- errorMessage: "Please ensure you have selected either a email communication or text communication"
66927
+ canMove: automation2.includeSegmentIds.length > 0,
66928
+ errorMessage: "Please ensure you have selected at least one segment"
66895
66929
  };
66896
- }
66897
- if (communicationGroup.emailChannelSenderId) {
66898
- if (!communicationGroup.emailHtmlBody || !communicationGroup.emailSubject) {
66930
+ case 2: {
66931
+ const actionDataCommunication = automation2.actionData?.find(
66932
+ (action) => action.actionType === "send_communication"
66933
+ );
66934
+ if (!actionDataCommunication) {
66899
66935
  return {
66900
66936
  canMove: false,
66901
- errorMessage: "Please ensure you have a email body and subject"
66937
+ errorMessage: "Please ensure you have selected either a email communication or text communication"
66902
66938
  };
66903
66939
  }
66904
- }
66905
- if (communicationGroup.smsChannelSenderId) {
66906
- if (!communicationGroup.smsMessageBody) {
66940
+ if (!communicationGroup || !communicationGroup.smsChannelSenderId && !communicationGroup.emailChannelSenderId) {
66907
66941
  return {
66908
66942
  canMove: false,
66909
- errorMessage: "Please ensure you have a sms message body"
66943
+ errorMessage: "Please ensure you have selected either a email communication or text communication"
66910
66944
  };
66911
66945
  }
66946
+ if (communicationGroup.emailChannelSenderId) {
66947
+ if (!communicationGroup.emailHtmlBody || !communicationGroup.emailSubject) {
66948
+ return {
66949
+ canMove: false,
66950
+ errorMessage: "Please ensure you have a email body and subject"
66951
+ };
66952
+ }
66953
+ }
66954
+ if (communicationGroup.smsChannelSenderId) {
66955
+ if (!communicationGroup.smsMessageBody) {
66956
+ return {
66957
+ canMove: false,
66958
+ errorMessage: "Please ensure you have a sms message body"
66959
+ };
66960
+ }
66961
+ }
66962
+ return {
66963
+ canMove: true,
66964
+ errorMessage: null
66965
+ };
66912
66966
  }
66913
- }
66914
- if (currentStep === 3) {
66915
- const isOneTime = isOneTimeTriggerMetadata(automation2.triggerMetadata);
66916
- if (isOneTime) {
66967
+ case 3: {
66968
+ if (!automation2.triggerMetadata) {
66969
+ return {
66970
+ canMove: false,
66971
+ errorMessage: "Please make sure to select a time to send before starting!"
66972
+ };
66973
+ }
66974
+ if (automation2.triggerMetadata.triggerType !== AutomationTriggerType.ONE_TIME) {
66975
+ return {
66976
+ canMove: Boolean(
66977
+ automation2.actionData?.some(
66978
+ (action) => action.actionType === "send_communication" && action.actionMetadata.communicationGroupId
66979
+ )
66980
+ ),
66981
+ errorMessage: null
66982
+ };
66983
+ }
66984
+ if (!automation2.triggerMetadata?.scheduledAt) {
66985
+ return {
66986
+ canMove: false,
66987
+ errorMessage: `Please ensure you have set a valid future date for your ${t("engage:one_time")}`
66988
+ };
66989
+ }
66990
+ const hasValidSchedule = Boolean(
66991
+ automation2.triggerMetadata?.scheduledAt && new Date(automation2.triggerMetadata.scheduledAt) > /* @__PURE__ */ new Date()
66992
+ );
66993
+ if (!hasValidSchedule) {
66994
+ return {
66995
+ canMove: false,
66996
+ errorMessage: `Please ensure you have set a valid future date for your ${t("engage:one_time")}`
66997
+ };
66998
+ }
66999
+ const hasValidCommunicationGroup = Boolean(
67000
+ automation2.actionData?.some(
67001
+ (action) => action.actionType === "send_communication" && action.actionMetadata.communicationGroupId
67002
+ )
67003
+ );
67004
+ if (!hasValidCommunicationGroup) {
67005
+ return {
67006
+ canMove: false,
67007
+ errorMessage: "Please ensure you have set a valid email or sms communication"
67008
+ };
67009
+ }
66917
67010
  const oneTimeMetadata = automation2.triggerMetadata;
66918
67011
  return {
66919
67012
  canMove: Boolean(
@@ -66924,33 +67017,9 @@ const validateAutomationStep = async (args) => {
66924
67017
  errorMessage: `Please ensure you have set a valid future date for your ${t("engage:one_time")} automation`
66925
67018
  };
66926
67019
  }
66927
- return {
66928
- canMove: Boolean(
66929
- automation2.actionData?.some(
66930
- (action) => action.actionType === "send_communication" && action.actionMetadata.communicationGroupId
66931
- )
66932
- ),
66933
- errorMessage: null
66934
- };
67020
+ default:
67021
+ UnreachableCaseStatement(currentStep, AutomationSteps);
66935
67022
  }
66936
- return {
66937
- canMove: true,
66938
- errorMessage: null
66939
- };
66940
- };
66941
- const mergeFieldTemplateCreator = (args) => {
66942
- const { mergeFieldName } = args;
66943
- return `{{${mergeFieldName}}}`;
66944
- };
66945
- const useDebounce = (value, delay2) => {
66946
- const [debouncedValue, setDebouncedValue] = useState(value);
66947
- useEffect(() => {
66948
- const timer = setTimeout(() => {
66949
- setDebouncedValue(value);
66950
- }, delay2);
66951
- return () => clearTimeout(timer);
66952
- }, [value, delay2]);
66953
- return debouncedValue;
66954
67023
  };
66955
67024
  const getChannelAccounts = async () => {
66956
67025
  const response = await baseRequest(
@@ -66980,6 +67049,20 @@ var ChannelAccountTypeEnum = /* @__PURE__ */ ((ChannelAccountTypeEnum2) => {
66980
67049
  ChannelAccountTypeEnum2["TWILLIO"] = "twillio";
66981
67050
  return ChannelAccountTypeEnum2;
66982
67051
  })(ChannelAccountTypeEnum || {});
67052
+ const mergeFieldTemplateCreator = (args) => {
67053
+ const { mergeFieldName } = args;
67054
+ return `{{${mergeFieldName}}}`;
67055
+ };
67056
+ const useDebounce = (value, delay2) => {
67057
+ const [debouncedValue, setDebouncedValue] = useState(value);
67058
+ useEffect(() => {
67059
+ const timer = setTimeout(() => {
67060
+ setDebouncedValue(value);
67061
+ }, delay2);
67062
+ return () => clearTimeout(timer);
67063
+ }, [value, delay2]);
67064
+ return debouncedValue;
67065
+ };
66983
67066
  const EmailPreviewHelpDialog = () => {
66984
67067
  return /* @__PURE__ */ jsxs("div", { className: "p-6 overflow-y-auto", children: [
66985
67068
  /* @__PURE__ */ jsxs("div", { className: "mb-8 text-center", children: [
@@ -67460,9 +67543,14 @@ const EmailPreview = ({ mergeFieldsResponse }) => {
67460
67543
  if (debouncedReplyToEmail) {
67461
67544
  const emailRegex = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
67462
67545
  const isValidEmail = emailRegex.test(debouncedReplyToEmail);
67463
- setReplyToEmailError(
67464
- isValidEmail ? null : "Please enter a valid email address"
67465
- );
67546
+ const hasEmoji = /\p{Emoji}/u.test(debouncedReplyToEmail);
67547
+ if (hasEmoji) {
67548
+ setReplyToEmailError("Emojis are not allowed in email addresses");
67549
+ } else if (!isValidEmail) {
67550
+ setReplyToEmailError("Please enter a valid email address");
67551
+ } else {
67552
+ setReplyToEmailError(null);
67553
+ }
67466
67554
  } else {
67467
67555
  setReplyToEmailError(null);
67468
67556
  }
@@ -67474,7 +67562,6 @@ const EmailPreview = ({ mergeFieldsResponse }) => {
67474
67562
  (sender) => sender.id === args.fromEmail
67475
67563
  );
67476
67564
  if (channelSender) {
67477
- console.log("Updating reply-to email:", args.debouncedReplyToEmail);
67478
67565
  updateChannelSender2({
67479
67566
  id: args.fromEmail,
67480
67567
  toUpdate: {
@@ -67528,60 +67615,70 @@ const EmailPreview = ({ mergeFieldsResponse }) => {
67528
67615
  ] }),
67529
67616
  /* @__PURE__ */ jsx(EmailPreviewHelpDialog, {})
67530
67617
  ] }) }),
67531
- /* @__PURE__ */ jsx(Dialog, { open: showStripoEditor, onOpenChange: setShowStripoEditor, children: /* @__PURE__ */ jsxs(DialogContent, { className: "min-w-[100vw] min-h-[100vh]", hideCloseButton: true, children: [
67532
- /* @__PURE__ */ jsxs(VisuallyHidden$2, { children: [
67533
- /* @__PURE__ */ jsx(DialogTitle, { children: "Email Editor" }),
67534
- /* @__PURE__ */ jsx(DialogDescription, { children: "Learn more about the email editor and how to use it to create your email." })
67535
- ] }),
67536
- /* @__PURE__ */ jsxs("div", { className: "w-full h-full", children: [
67537
- /* @__PURE__ */ jsxs("div", { className: "flex justify-between items-center p-1 border-b", children: [
67538
- /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
67539
- /* @__PURE__ */ jsx("h2", { className: "text-lg font-medium", children: "Email Editor" }),
67540
- /* @__PURE__ */ jsx(
67541
- InfoTooltip,
67542
- {
67543
- title: "Click to learn more about email template ",
67544
- onClick: () => setShowHelpDialog(true)
67545
- }
67546
- )
67618
+ /* @__PURE__ */ jsx(Dialog, { open: showStripoEditor, onOpenChange: setShowStripoEditor, children: /* @__PURE__ */ jsxs(
67619
+ DialogContent,
67620
+ {
67621
+ className: "min-w-[100vw] min-h-[100vh]",
67622
+ hideCloseButton: true,
67623
+ onEscapeKeyDown: (e4) => {
67624
+ e4.preventDefault();
67625
+ },
67626
+ children: [
67627
+ /* @__PURE__ */ jsxs(VisuallyHidden$2, { children: [
67628
+ /* @__PURE__ */ jsx(DialogTitle, { children: "Email Editor" }),
67629
+ /* @__PURE__ */ jsx(DialogDescription, { children: "Learn more about the email editor and how to use it to create your email." })
67547
67630
  ] }),
67548
- /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
67549
- /* @__PURE__ */ jsx(
67550
- Button$1,
67551
- {
67552
- onClick: () => {
67553
- setCancelClicked(true);
67554
- },
67555
- className: "text-sm px-3 py-1 rounded",
67556
- children: "Cancel"
67557
- }
67558
- ),
67559
- /* @__PURE__ */ jsx(
67560
- Button$1,
67631
+ /* @__PURE__ */ jsxs("div", { className: "w-full h-full", children: [
67632
+ /* @__PURE__ */ jsxs("div", { className: "flex justify-between items-center p-1 border-b", children: [
67633
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
67634
+ /* @__PURE__ */ jsx("h2", { className: "text-lg font-medium", children: "Email Editor" }),
67635
+ /* @__PURE__ */ jsx(
67636
+ InfoTooltip,
67637
+ {
67638
+ title: "Click to learn more about email template ",
67639
+ onClick: () => setShowHelpDialog(true)
67640
+ }
67641
+ )
67642
+ ] }),
67643
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
67644
+ /* @__PURE__ */ jsx(
67645
+ Button$1,
67646
+ {
67647
+ onClick: () => {
67648
+ setCancelClicked(true);
67649
+ },
67650
+ className: "text-sm px-3 py-1 rounded",
67651
+ children: "Cancel"
67652
+ }
67653
+ ),
67654
+ /* @__PURE__ */ jsx(
67655
+ Button$1,
67656
+ {
67657
+ onClick: () => setSaveClicked(true),
67658
+ className: "text-sm px-3 py-1 rounded",
67659
+ children: "Save"
67660
+ }
67661
+ )
67662
+ ] })
67663
+ ] }),
67664
+ /* @__PURE__ */ jsx("div", { className: " w-full", children: automation2 && /* @__PURE__ */ jsx(
67665
+ StripoWrapper,
67561
67666
  {
67562
- onClick: () => setSaveClicked(true),
67563
- className: "text-sm px-3 py-1 rounded",
67564
- children: "Save"
67667
+ cancelClicked,
67668
+ setCancelClicked,
67669
+ showStripoEditor,
67670
+ automation: automation2,
67671
+ setShowStripoEditor,
67672
+ saveClicked,
67673
+ setSaveClicked,
67674
+ stripoDialogDimensions,
67675
+ mergeFieldsResponse
67565
67676
  }
67566
- )
67677
+ ) })
67567
67678
  ] })
67568
- ] }),
67569
- /* @__PURE__ */ jsx("div", { className: " w-full", children: automation2 && /* @__PURE__ */ jsx(
67570
- StripoWrapper,
67571
- {
67572
- cancelClicked,
67573
- setCancelClicked,
67574
- showStripoEditor,
67575
- automation: automation2,
67576
- setShowStripoEditor,
67577
- saveClicked,
67578
- setSaveClicked,
67579
- stripoDialogDimensions,
67580
- mergeFieldsResponse
67581
- }
67582
- ) })
67583
- ] })
67584
- ] }) }),
67679
+ ]
67680
+ }
67681
+ ) }),
67585
67682
  /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-2 gap-6", children: [
67586
67683
  /* @__PURE__ */ jsxs("div", { className: "space-y-4", children: [
67587
67684
  /* @__PURE__ */ jsxs("div", { children: [
@@ -67872,7 +67969,9 @@ var Indicator = CheckboxIndicator;
67872
67969
  const SelectEmailOrSMS = ({
67873
67970
  selectedChannels,
67874
67971
  setSelectedChannels,
67875
- iconDefinitions
67972
+ iconDefinitions,
67973
+ hasEmailChannelSenders,
67974
+ hasSmsChannelSenders
67876
67975
  }) => {
67877
67976
  const { toast: toast2 } = useToast();
67878
67977
  const toggleEmail = () => {
@@ -67906,18 +68005,22 @@ const SelectEmailOrSMS = ({
67906
68005
  setSelectedChannels([...selectedChannels, "sms"]);
67907
68006
  };
67908
68007
  const channelOptions = [
67909
- {
67910
- label: "Email",
67911
- value: "email",
67912
- icon: iconDefinitions.EmailIcon,
67913
- checked: selectedChannels.includes("email")
67914
- },
67915
- {
67916
- label: "SMS",
67917
- value: "sms",
67918
- icon: iconDefinitions.SmsIcon,
67919
- checked: selectedChannels.includes("sms")
67920
- }
68008
+ ...hasEmailChannelSenders ? [
68009
+ {
68010
+ label: "Email",
68011
+ value: "email",
68012
+ icon: iconDefinitions.EmailIcon,
68013
+ checked: selectedChannels.includes("email")
68014
+ }
68015
+ ] : [],
68016
+ ...hasSmsChannelSenders ? [
68017
+ {
68018
+ label: "SMS",
68019
+ value: "sms",
68020
+ icon: iconDefinitions.SmsIcon,
68021
+ checked: selectedChannels.includes("sms")
68022
+ }
68023
+ ] : []
67921
68024
  ];
67922
68025
  return /* @__PURE__ */ jsxs("div", { className: "space-y-4", children: [
67923
68026
  /* @__PURE__ */ jsxs("div", { children: [
@@ -67946,7 +68049,7 @@ const SelectEmailOrSMS = ({
67946
68049
  )) })
67947
68050
  ] });
67948
68051
  };
67949
- const SMSPreview = ({ iconDefinitions, mergeFieldsResponse }) => {
68052
+ const SMSPreview = ({ iconDefinitions, mergeFieldsResponse, smsChannelSenders }) => {
67950
68053
  const automation2 = useAutomation();
67951
68054
  const _getCommunicationGroupFromAutomation = useCallback(() => {
67952
68055
  const actionGroup = automation2?.actionData?.find(
@@ -68046,9 +68149,6 @@ const SMSPreview = ({ iconDefinitions, mergeFieldsResponse }) => {
68046
68149
  if (!channelAccounts || !channelSenders || isMeLoading) {
68047
68150
  return /* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsx(BasicLoader, { text: ["Loading..."] }) });
68048
68151
  }
68049
- const smsChannelSenders = channelSenders.results.filter(
68050
- (sender) => sender.channelSenderMetadata.from || sender.channelSenderMetadata.messageServiceSid
68051
- );
68052
68152
  return /* @__PURE__ */ jsxs("div", { children: [
68053
68153
  /* @__PURE__ */ jsx(Dialog, { open: showSmsEditor, onOpenChange: setShowSmsEditor, children: /* @__PURE__ */ jsxs(DialogContent, { children: [
68054
68154
  /* @__PURE__ */ jsxs(VisuallyHidden$2, { children: [
@@ -68185,6 +68285,8 @@ const EditCampaignContent = ({
68185
68285
  const emailContainerRef = useRef(null);
68186
68286
  const { toast: toast2 } = useToast();
68187
68287
  const communicationGroup = useCommunicationGroup();
68288
+ const { channelSenders } = useChannelSender();
68289
+ const { channelAccounts } = useChannelAccount();
68188
68290
  const { updateCommunicationGroup: updateCommunicationGroup2 } = useUpdateCommunicationGroup();
68189
68291
  const automation2 = useAutomation();
68190
68292
  const { getMergeFields: getMergeFields2, isGetting: isGetMergeFieldsLoading } = useGetMergeFields(communicationGroup?.id ?? void 0);
@@ -68367,16 +68469,44 @@ const EditCampaignContent = ({
68367
68469
  mergeFieldsResponse,
68368
68470
  setSelectedChannelsBasedOnCommunicationGroup
68369
68471
  ]);
68370
- if (!selectedChannels || isGetMergeFieldsLoading || !mergeFieldsResponse) {
68472
+ const emailChannelSendersWithChannelAccounts = useMemo(
68473
+ () => channelSenders?.results?.filter((sender) => sender.channelSenderMetadata.userPart)?.flatMap((sender) => {
68474
+ const channelAccount = channelAccounts?.results?.find(
68475
+ (account) => account.id === sender.channelAccountId
68476
+ );
68477
+ if (!channelAccount) return [];
68478
+ if (channelAccount.channelAccountMetadata.type === ChannelAccountTypeEnum.REACH_MANAGED) {
68479
+ return [
68480
+ {
68481
+ channelSenderId: sender.id,
68482
+ fullDomain: `${sender.channelSenderMetadata.userPart}@${sender.channelSenderMetadata.baseDomain}`
68483
+ }
68484
+ ];
68485
+ }
68486
+ return [];
68487
+ }) || [],
68488
+ [channelSenders?.results, channelAccounts?.results]
68489
+ );
68490
+ const smsChannelSenders = useMemo(
68491
+ () => channelSenders?.results.filter(
68492
+ (sender) => sender.channelSenderMetadata.from || sender.channelSenderMetadata.messageServiceSid
68493
+ ),
68494
+ [channelSenders?.results]
68495
+ );
68496
+ if (!selectedChannels || isGetMergeFieldsLoading || !mergeFieldsResponse || !emailChannelSendersWithChannelAccounts || !smsChannelSenders) {
68371
68497
  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..."] }) });
68372
68498
  }
68499
+ const hasEmailChannelSenders = emailChannelSendersWithChannelAccounts.length > 0;
68500
+ const hasSmsChannelSenders = smsChannelSenders.length > 0;
68373
68501
  return /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-4 flex-shrink-0", children: [
68374
68502
  /* @__PURE__ */ jsx("div", { className: "bg-white rounded-2xl w-full border border-gray-200 p-6 space-y-4 relative", children: /* @__PURE__ */ jsx(
68375
68503
  SelectEmailOrSMS,
68376
68504
  {
68377
68505
  selectedChannels,
68378
68506
  setSelectedChannels,
68379
- iconDefinitions
68507
+ iconDefinitions,
68508
+ hasEmailChannelSenders,
68509
+ hasSmsChannelSenders
68380
68510
  }
68381
68511
  ) }),
68382
68512
  selectedChannels.includes("email") && /* @__PURE__ */ jsxs(
@@ -68390,7 +68520,8 @@ const EditCampaignContent = ({
68390
68520
  EmailPreview,
68391
68521
  {
68392
68522
  iconDefinitions,
68393
- mergeFieldsResponse
68523
+ mergeFieldsResponse,
68524
+ emailChannelSendersWithChannelAccounts
68394
68525
  }
68395
68526
  )
68396
68527
  ]
@@ -68402,7 +68533,8 @@ const EditCampaignContent = ({
68402
68533
  SMSPreview,
68403
68534
  {
68404
68535
  iconDefinitions,
68405
- mergeFieldsResponse
68536
+ mergeFieldsResponse,
68537
+ smsChannelSenders
68406
68538
  }
68407
68539
  )
68408
68540
  ] })
@@ -68477,8 +68609,8 @@ const EstimatedMatchesView = ({
68477
68609
  isLoading: isCountLoading,
68478
68610
  refetchCount
68479
68611
  } = useGetCountOfBusinessAutomationRecipients({
68480
- include_segments: includeSegments,
68481
- exclude_segments: excludeSegments
68612
+ includeSegments,
68613
+ excludeSegments
68482
68614
  });
68483
68615
  useEffect(() => {
68484
68616
  refetchCount();
@@ -68802,8 +68934,9 @@ const OneTimeBroadcastMetadata = ({ automation: automation2 }) => {
68802
68934
  ] })
68803
68935
  ] });
68804
68936
  };
68805
- const SelectTime = ({ iconDefinitions, automation: automation2, updateAutomation: updateAutomation2 }) => {
68937
+ const SelectTime = ({ iconDefinitions, automation: automation2 }) => {
68806
68938
  const [deliveryOption, setDeliveryOption] = useState(null);
68939
+ const { updateAutomation: businessUpdateAutomation } = useUpdateBusinessAutomation(automation2?.id || "");
68807
68940
  return /* @__PURE__ */ jsx("div", { className: "@container", children: /* @__PURE__ */ jsx(
68808
68941
  motion.div,
68809
68942
  {
@@ -68823,7 +68956,7 @@ const SelectTime = ({ iconDefinitions, automation: automation2, updateAutomation
68823
68956
  icon: /* @__PURE__ */ jsx(iconDefinitions.SendButton, {}),
68824
68957
  onClick: () => {
68825
68958
  setDeliveryOption("sendNow");
68826
- updateAutomation2({
68959
+ businessUpdateAutomation({
68827
68960
  trigger: {
68828
68961
  triggerType: AutomationTriggerType.ONE_TIME,
68829
68962
  scheduledAt: new Date(
@@ -68909,15 +69042,12 @@ const SelectTime = ({ iconDefinitions, automation: automation2, updateAutomation
68909
69042
  ) });
68910
69043
  };
68911
69044
  const PreviewAndSchedule = ({
68912
- iconDefinitions,
68913
- updateAutomation: externalUpdateAutomation
69045
+ iconDefinitions
68914
69046
  }) => {
68915
69047
  const automation2 = useAutomation();
68916
69048
  const communicationGroup = useCommunicationGroup();
68917
- const { updateAutomation: businessUpdateAutomation } = useUpdateBusinessAutomation(automation2?.id || "");
68918
69049
  const { channelSenders } = useChannelSender();
68919
69050
  const { channelAccounts } = useChannelAccount();
68920
- const updateAutomation2 = externalUpdateAutomation || ((params) => businessUpdateAutomation(params));
68921
69051
  const [emailPreview, setEmailPreview] = useState(null);
68922
69052
  const [smsPreview, setSmsPreview] = useState(null);
68923
69053
  const [channelSenderData, setChannelSenderData] = useState(null);
@@ -68986,6 +69116,13 @@ const PreviewAndSchedule = ({
68986
69116
  return /* @__PURE__ */ jsx("div", { className: "flex justify-center items-center h-full", children: /* @__PURE__ */ jsx("div", { children: "No preview data Please complete previous steps" }) });
68987
69117
  }
68988
69118
  return /* @__PURE__ */ jsxs("div", { className: "w-full", children: [
69119
+ automation2.triggerType === AutomationTriggerType.ONE_TIME && /* @__PURE__ */ jsx(Card, { className: "p-4 shadow-sm border-none mt-4", children: /* @__PURE__ */ jsx(
69120
+ SelectTime,
69121
+ {
69122
+ automation: automation2,
69123
+ iconDefinitions
69124
+ }
69125
+ ) }),
68989
69126
  /* @__PURE__ */ jsxs("div", { className: "flex gap-4 w-full", children: [
68990
69127
  /* @__PURE__ */ jsx(
68991
69128
  PreviewPanel,
@@ -69004,15 +69141,7 @@ const PreviewAndSchedule = ({
69004
69141
  excludeSegments: automation2.excludeSegmentIds || []
69005
69142
  }
69006
69143
  )
69007
- ] }),
69008
- automation2.triggerType === AutomationTriggerType.ONE_TIME && /* @__PURE__ */ jsx(Card, { className: "p-4 shadow-sm border-none mt-4", children: /* @__PURE__ */ jsx(
69009
- SelectTime,
69010
- {
69011
- automation: automation2,
69012
- iconDefinitions,
69013
- updateAutomation: updateAutomation2
69014
- }
69015
- ) })
69144
+ ] })
69016
69145
  ] });
69017
69146
  };
69018
69147
  const AllOrSelectSegmentPicker = ({ iconDefinitions, onSelectionChange, defaultValue = "all" }) => {
@@ -69576,26 +69705,7 @@ const getAutomationSteps = ({
69576
69705
  nextText: automation2.triggerMetadata?.triggerType === AutomationTriggerType.ONE_TIME ? "Schedule" : "Start",
69577
69706
  hideBack: false,
69578
69707
  backDisabled: false,
69579
- nextDisabled: () => {
69580
- if (!automation2.triggerMetadata) {
69581
- return true;
69582
- }
69583
- if (automation2.triggerMetadata?.triggerType !== AutomationTriggerType.ONE_TIME) {
69584
- return false;
69585
- }
69586
- if (!automation2.triggerMetadata?.scheduledAt) {
69587
- return true;
69588
- }
69589
- const hasValidSchedule = Boolean(
69590
- automation2.triggerMetadata?.scheduledAt && new Date(automation2.triggerMetadata.scheduledAt) > /* @__PURE__ */ new Date()
69591
- );
69592
- const hasValidCommunicationGroup = Boolean(
69593
- automation2.actionData?.some(
69594
- (action) => action.actionType === "send_communication" && action.actionMetadata.communicationGroupId
69595
- )
69596
- );
69597
- return !(hasValidSchedule && hasValidCommunicationGroup);
69598
- },
69708
+ nextDisabled: () => false,
69599
69709
  thirdOptionText: "Save as Draft",
69600
69710
  thirdOptionOnClick: handleSaveAsDraft
69601
69711
  }
@@ -69699,11 +69809,13 @@ const EditAutomation = ({
69699
69809
  const { updateAutomation: updateAutomation2 } = useUpdateBusinessAutomation(
69700
69810
  automation2?.id || ""
69701
69811
  );
69812
+ const initialStepSet = useRef(false);
69702
69813
  useEffect(() => {
69703
- if (automation2) {
69814
+ if (automation2 && !initialStepSet.current) {
69704
69815
  setCurrentStep(
69705
69816
  automation2.triggerType === AutomationTriggerType.TRIGGER_BASED ? AutomationSteps.SelectTrigger : AutomationSteps.SelectAudience
69706
69817
  );
69818
+ initialStepSet.current = true;
69707
69819
  }
69708
69820
  }, [automation2]);
69709
69821
  if (!automation2 || !currentStep || !communicationGroup) {