@embedreach/components 0.1.75 → 0.1.77

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.
@@ -4802,24 +4802,24 @@ var escapeKey = (key) => key.replace(/\./g, "\\.");
4802
4802
  var stringifyPath = (path2) => path2.map(String).map(escapeKey).join(".");
4803
4803
  var parsePath$1 = (string) => {
4804
4804
  const result = [];
4805
- let segment = "";
4805
+ let segment2 = "";
4806
4806
  for (let i3 = 0; i3 < string.length; i3++) {
4807
4807
  let char = string.charAt(i3);
4808
4808
  const isEscapedDot = char === "\\" && string.charAt(i3 + 1) === ".";
4809
4809
  if (isEscapedDot) {
4810
- segment += ".";
4810
+ segment2 += ".";
4811
4811
  i3++;
4812
4812
  continue;
4813
4813
  }
4814
4814
  const isEndOfSegment = char === ".";
4815
4815
  if (isEndOfSegment) {
4816
- result.push(segment);
4817
- segment = "";
4816
+ result.push(segment2);
4817
+ segment2 = "";
4818
4818
  continue;
4819
4819
  }
4820
- segment += char;
4820
+ segment2 += char;
4821
4821
  }
4822
- const lastSegment = segment;
4822
+ const lastSegment = segment2;
4823
4823
  result.push(lastSegment);
4824
4824
  return result;
4825
4825
  };
@@ -5904,8 +5904,8 @@ function e(e4) {
5904
5904
  }
5905
5905
  return t3.prototype = new Error(), t3.prototype.name = e4, t3.prototype.constructor = t3, t3;
5906
5906
  }
5907
- const t = e("LaunchDarklyUnexpectedResponseError"), n = e("LaunchDarklyInvalidEnvironmentIdError"), r$1 = e("LaunchDarklyInvalidUserError"), o = e("LaunchDarklyInvalidEventKeyError"), i = e("LaunchDarklyInvalidArgumentError"), a = e("LaunchDarklyFlagFetchError");
5908
- for (var s3 = { LDUnexpectedResponseError: t, LDInvalidEnvironmentIdError: n, LDInvalidUserError: r$1, LDInvalidEventKeyError: o, LDInvalidArgumentError: i, LDInvalidDataError: e("LaunchDarklyInvalidDataError"), LDFlagFetchError: a, LDTimeoutError: e("LaunchDarklyTimeoutError"), isHttpErrorRecoverable: function(e4) {
5907
+ const t$1 = e("LaunchDarklyUnexpectedResponseError"), n = e("LaunchDarklyInvalidEnvironmentIdError"), r$1 = e("LaunchDarklyInvalidUserError"), o = e("LaunchDarklyInvalidEventKeyError"), i = e("LaunchDarklyInvalidArgumentError"), a = e("LaunchDarklyFlagFetchError");
5908
+ for (var s3 = { LDUnexpectedResponseError: t$1, LDInvalidEnvironmentIdError: n, LDInvalidUserError: r$1, LDInvalidEventKeyError: o, LDInvalidArgumentError: i, LDInvalidDataError: e("LaunchDarklyInvalidDataError"), LDFlagFetchError: a, LDTimeoutError: e("LaunchDarklyTimeoutError"), isHttpErrorRecoverable: function(e4) {
5909
5909
  return !(e4 >= 400 && e4 < 500) || (400 === e4 || 408 === e4 || 429 === e4);
5910
5910
  } }, c2 = function(e4) {
5911
5911
  var t3 = m$2(e4), n2 = t3[0], r2 = t3[1];
@@ -9914,6 +9914,18 @@ const Send = createLucideIcon("Send", [
9914
9914
  ],
9915
9915
  ["path", { d: "m21.854 2.147-10.94 10.939", key: "12cjpa" }]
9916
9916
  ]);
9917
+ /**
9918
+ * @license lucide-react v0.464.0 - ISC
9919
+ *
9920
+ * This source code is licensed under the ISC license.
9921
+ * See the LICENSE file in the root directory of this source tree.
9922
+ */
9923
+ const Settings2 = createLucideIcon("Settings2", [
9924
+ ["path", { d: "M20 7h-9", key: "3s1dr2" }],
9925
+ ["path", { d: "M14 17H5", key: "gfn3mx" }],
9926
+ ["circle", { cx: "17", cy: "17", r: "3", key: "18b49y" }],
9927
+ ["circle", { cx: "7", cy: "7", r: "3", key: "dfmy0x" }]
9928
+ ]);
9917
9929
  /**
9918
9930
  * @license lucide-react v0.464.0 - ISC
9919
9931
  *
@@ -9930,6 +9942,25 @@ const ShieldBan = createLucideIcon("ShieldBan", [
9930
9942
  ],
9931
9943
  ["path", { d: "m4.243 5.21 14.39 12.472", key: "1c9a7c" }]
9932
9944
  ]);
9945
+ /**
9946
+ * @license lucide-react v0.464.0 - ISC
9947
+ *
9948
+ * This source code is licensed under the ISC license.
9949
+ * See the LICENSE file in the root directory of this source tree.
9950
+ */
9951
+ const Sparkles = createLucideIcon("Sparkles", [
9952
+ [
9953
+ "path",
9954
+ {
9955
+ d: "M9.937 15.5A2 2 0 0 0 8.5 14.063l-6.135-1.582a.5.5 0 0 1 0-.962L8.5 9.936A2 2 0 0 0 9.937 8.5l1.582-6.135a.5.5 0 0 1 .963 0L14.063 8.5A2 2 0 0 0 15.5 9.937l6.135 1.581a.5.5 0 0 1 0 .964L15.5 14.063a2 2 0 0 0-1.437 1.437l-1.582 6.135a.5.5 0 0 1-.963 0z",
9956
+ key: "4pj2yx"
9957
+ }
9958
+ ],
9959
+ ["path", { d: "M20 3v4", key: "1olli1" }],
9960
+ ["path", { d: "M22 5h-4", key: "1gvqau" }],
9961
+ ["path", { d: "M4 17v2", key: "vumght" }],
9962
+ ["path", { d: "M5 18H3", key: "zchphs" }]
9963
+ ]);
9933
9964
  /**
9934
9965
  * @license lucide-react v0.464.0 - ISC
9935
9966
  *
@@ -12787,45 +12818,64 @@ const toShadcnFormat = (color2) => {
12787
12818
  }
12788
12819
  };
12789
12820
  const DEFAULT_THEME_STYLES = {
12790
- // Base colors
12821
+ // Base colors - Pure white background with rich dark text
12791
12822
  background: "0 0% 100%",
12792
- foreground: "240 10% 3.9%",
12793
- // Card elements
12823
+ // Pure white
12824
+ foreground: "225 15% 16%",
12825
+ // Rich dark gray with minimal color cast
12826
+ // Card elements - Clean white
12794
12827
  card: "0 0% 100%",
12795
- "card-foreground": "240 10% 3.9%",
12796
- // Popover elements
12828
+ "card-foreground": "225 15% 16%",
12829
+ // Popover elements - Consistent with cards
12797
12830
  popover: "0 0% 100%",
12798
- "popover-foreground": "240 10% 3.9%",
12799
- // Primary brand colors
12800
- primary: "240 5.9% 10%",
12801
- "primary-foreground": "0 0% 98%",
12802
- // Secondary elements
12803
- secondary: "240 4.8% 95.9%",
12804
- "secondary-foreground": "240 5.9% 10%",
12805
- // Muted elements
12806
- muted: "240 4.8% 95.9%",
12807
- "muted-foreground": "240 3.8% 46.1%",
12808
- // Accent elements
12809
- accent: "240 4.8% 95.9%",
12810
- "accent-foreground": "240 5.9% 10%",
12811
- // Destructive elements
12831
+ "popover-foreground": "225 15% 16%",
12832
+ // Primary brand colors - Deep slate with subtle warmth
12833
+ primary: "210 30% 25%",
12834
+ // Deep slate blue-gray, sophisticated and neutral
12835
+ "primary-foreground": "0 0% 100%",
12836
+ // Pure white for contrast
12837
+ // Secondary elements - Subtle contrast
12838
+ secondary: "210 15% 94%",
12839
+ // Very light gray with slight coolness
12840
+ "secondary-foreground": "210 30% 25%",
12841
+ // Matching primary
12842
+ // Muted elements - Neutral, refined
12843
+ muted: "210 10% 96%",
12844
+ // Very light neutral
12845
+ "muted-foreground": "220 10% 45%",
12846
+ // Mid-tone for muted text
12847
+ // Accent elements - Subtle accent
12848
+ accent: "210 15% 94%",
12849
+ // Matches secondary for consistency
12850
+ "accent-foreground": "210 30% 25%",
12851
+ // Matching primary
12852
+ // Destructive elements - Keep your existing red
12812
12853
  destructive: "0 84.2% 60.2%",
12813
- "destructive-foreground": "0 0% 98%",
12814
- // Borders and inputs
12815
- border: "240 5.9% 90%",
12816
- input: "240 5.9% 90%",
12817
- ring: "240 10% 3.9%",
12818
- // Chart colors
12819
- "chart-1": "12 76% 61%",
12820
- "chart-2": "173 58% 39%",
12821
- "chart-3": "197 37% 24%",
12822
- "chart-4": "43 74% 66%",
12823
- "chart-5": "27 87% 67%",
12824
- // Border radius
12825
- radius: "0.5rem",
12826
- // Fonts
12827
- "font-body": 'system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif',
12828
- "font-heading": 'system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif'
12854
+ // Keeping your original red
12855
+ "destructive-foreground": "0 0% 100%",
12856
+ // White for contrast
12857
+ // Borders and inputs - Subtle
12858
+ border: "220 13% 90%",
12859
+ // Soft gray
12860
+ input: "220 13% 90%",
12861
+ ring: "210 30% 25%",
12862
+ // Matches primary for focus states
12863
+ // Chart colors - Harmonious palette that works with your red
12864
+ "chart-1": "210 50% 50%",
12865
+ // Slate blue
12866
+ "chart-2": "260 50% 55%",
12867
+ // Purple
12868
+ "chart-3": "150 50% 45%",
12869
+ // Green
12870
+ "chart-4": "325 50% 55%",
12871
+ // Magenta
12872
+ "chart-5": "45 80% 55%",
12873
+ // Gold
12874
+ // Border radius - Slightly more rounded
12875
+ radius: "0.625rem",
12876
+ // Fonts - Modern and readable
12877
+ "font-body": 'Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif',
12878
+ "font-heading": '"Plus Jakarta Sans", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif'
12829
12879
  };
12830
12880
  const applyThemeStyles = (styles2) => {
12831
12881
  const existingStyles = document.getElementById("reach-theme-styles");
@@ -12930,67 +12980,6 @@ const ThemeInitializer = ({ initialTheme, children: children2 }) => {
12930
12980
  const Provider$1 = ({ initialTheme, children: children2 }) => {
12931
12981
  return /* @__PURE__ */ jsx(BaseProvider, { children: /* @__PURE__ */ jsx(ThemeInitializer, { initialTheme, children: children2 }) });
12932
12982
  };
12933
- const matchHtmlEntity = /&(?:amp|#38|lt|#60|gt|#62|apos|#39|quot|#34|nbsp|#160|copy|#169|reg|#174|hellip|#8230|#x2F|#47);/g;
12934
- const htmlEntities = {
12935
- "&amp;": "&",
12936
- "&#38;": "&",
12937
- "&lt;": "<",
12938
- "&#60;": "<",
12939
- "&gt;": ">",
12940
- "&#62;": ">",
12941
- "&apos;": "'",
12942
- "&#39;": "'",
12943
- "&quot;": '"',
12944
- "&#34;": '"',
12945
- "&nbsp;": " ",
12946
- "&#160;": " ",
12947
- "&copy;": "©",
12948
- "&#169;": "©",
12949
- "&reg;": "®",
12950
- "&#174;": "®",
12951
- "&hellip;": "…",
12952
- "&#8230;": "…",
12953
- "&#x2F;": "/",
12954
- "&#47;": "/"
12955
- };
12956
- const unescapeHtmlEntity = (m4) => htmlEntities[m4];
12957
- const unescape$1 = (text) => text.replace(matchHtmlEntity, unescapeHtmlEntity);
12958
- let defaultOptions$2 = {
12959
- bindI18n: "languageChanged",
12960
- bindI18nStore: "",
12961
- transEmptyNodeValue: "",
12962
- transSupportBasicHtmlNodes: true,
12963
- transWrapTextNodes: "",
12964
- transKeepBasicHtmlNodesFor: ["br", "strong", "i", "p"],
12965
- useSuspense: true,
12966
- unescape: unescape$1
12967
- };
12968
- const setDefaults = (options = {}) => {
12969
- defaultOptions$2 = {
12970
- ...defaultOptions$2,
12971
- ...options
12972
- };
12973
- };
12974
- const initReactI18next = {
12975
- type: "3rdParty",
12976
- init(instance2) {
12977
- setDefaults(instance2.options.react);
12978
- }
12979
- };
12980
- const I18nContext = createContext$1();
12981
- function I18nextProvider({
12982
- i18n,
12983
- defaultNS,
12984
- children: children2
12985
- }) {
12986
- const value = useMemo(() => ({
12987
- i18n,
12988
- defaultNS
12989
- }), [i18n, defaultNS]);
12990
- return createElement$1(I18nContext.Provider, {
12991
- value
12992
- }, children2);
12993
- }
12994
12983
  const isString = (obj) => typeof obj === "string";
12995
12984
  const defer = () => {
12996
12985
  let res;
@@ -15186,7 +15175,7 @@ instance.reloadResources;
15186
15175
  instance.use;
15187
15176
  instance.changeLanguage;
15188
15177
  instance.getFixedT;
15189
- instance.t;
15178
+ const t = instance.t;
15190
15179
  instance.exists;
15191
15180
  instance.setDefaultNamespace;
15192
15181
  instance.hasLoadedNamespace;
@@ -15554,6 +15543,67 @@ class Browser {
15554
15543
  }
15555
15544
  }
15556
15545
  Browser.type = "languageDetector";
15546
+ const matchHtmlEntity = /&(?:amp|#38|lt|#60|gt|#62|apos|#39|quot|#34|nbsp|#160|copy|#169|reg|#174|hellip|#8230|#x2F|#47);/g;
15547
+ const htmlEntities = {
15548
+ "&amp;": "&",
15549
+ "&#38;": "&",
15550
+ "&lt;": "<",
15551
+ "&#60;": "<",
15552
+ "&gt;": ">",
15553
+ "&#62;": ">",
15554
+ "&apos;": "'",
15555
+ "&#39;": "'",
15556
+ "&quot;": '"',
15557
+ "&#34;": '"',
15558
+ "&nbsp;": " ",
15559
+ "&#160;": " ",
15560
+ "&copy;": "©",
15561
+ "&#169;": "©",
15562
+ "&reg;": "®",
15563
+ "&#174;": "®",
15564
+ "&hellip;": "…",
15565
+ "&#8230;": "…",
15566
+ "&#x2F;": "/",
15567
+ "&#47;": "/"
15568
+ };
15569
+ const unescapeHtmlEntity = (m4) => htmlEntities[m4];
15570
+ const unescape$1 = (text) => text.replace(matchHtmlEntity, unescapeHtmlEntity);
15571
+ let defaultOptions$2 = {
15572
+ bindI18n: "languageChanged",
15573
+ bindI18nStore: "",
15574
+ transEmptyNodeValue: "",
15575
+ transSupportBasicHtmlNodes: true,
15576
+ transWrapTextNodes: "",
15577
+ transKeepBasicHtmlNodesFor: ["br", "strong", "i", "p"],
15578
+ useSuspense: true,
15579
+ unescape: unescape$1
15580
+ };
15581
+ const setDefaults = (options = {}) => {
15582
+ defaultOptions$2 = {
15583
+ ...defaultOptions$2,
15584
+ ...options
15585
+ };
15586
+ };
15587
+ const initReactI18next = {
15588
+ type: "3rdParty",
15589
+ init(instance2) {
15590
+ setDefaults(instance2.options.react);
15591
+ }
15592
+ };
15593
+ const I18nContext = createContext$1();
15594
+ function I18nextProvider({
15595
+ i18n,
15596
+ defaultNS,
15597
+ children: children2
15598
+ }) {
15599
+ const value = useMemo(() => ({
15600
+ i18n,
15601
+ defaultNS
15602
+ }), [i18n, defaultNS]);
15603
+ return createElement$1(I18nContext.Provider, {
15604
+ value
15605
+ }, children2);
15606
+ }
15557
15607
  const ad_spend$1 = "Ad Spend";
15558
15608
  const date$2 = "Date";
15559
15609
  const close$1 = "Close";
@@ -16000,6 +16050,20 @@ const enCommon = {
16000
16050
  magic_link: magic_link$1,
16001
16051
  empty_state: empty_state$1
16002
16052
  };
16053
+ const user$1 = "User";
16054
+ const user_other$1 = "Users";
16055
+ const automation$1 = "Automation";
16056
+ const automation_other$1 = "Automations";
16057
+ const segment$1 = "Segment";
16058
+ const segment_other$1 = "Segments";
16059
+ const enEngage = {
16060
+ user: user$1,
16061
+ user_other: user_other$1,
16062
+ automation: automation$1,
16063
+ automation_other: automation_other$1,
16064
+ segment: segment$1,
16065
+ segment_other: segment_other$1
16066
+ };
16003
16067
  const ad_spend = "Gasto en anuncios";
16004
16068
  const date$1 = "Fecha";
16005
16069
  const close = "Cerrar";
@@ -16446,12 +16510,28 @@ const esCommon = {
16446
16510
  magic_link,
16447
16511
  empty_state
16448
16512
  };
16513
+ const user = "Usuario";
16514
+ const user_other = "Usuarios";
16515
+ const automation = "Automatización";
16516
+ const automation_other = "Automatizaciones";
16517
+ const segment = "Segmento";
16518
+ const segment_other = "Segmentos";
16519
+ const esEngage = {
16520
+ user,
16521
+ user_other,
16522
+ automation,
16523
+ automation_other,
16524
+ segment,
16525
+ segment_other
16526
+ };
16449
16527
  const resources = {
16450
16528
  en: {
16451
- common: enCommon
16529
+ common: enCommon,
16530
+ engage: enEngage
16452
16531
  },
16453
16532
  es: {
16454
- common: esCommon
16533
+ common: esCommon,
16534
+ engage: esEngage
16455
16535
  }
16456
16536
  };
16457
16537
  instance.use(Browser).use(initReactI18next).init({
@@ -16492,6 +16572,424 @@ instance.use(Browser).use(initReactI18next).init({
16492
16572
  convertDetectedLanguage: (lng) => lng.split("-")[0]
16493
16573
  }
16494
16574
  });
16575
+ const defaultTranslations = {
16576
+ engage: {
16577
+ user: "User",
16578
+ user_other: "Users",
16579
+ automation: "Automation",
16580
+ automation_other: "Automations",
16581
+ segment: "Segment",
16582
+ segment_other: "Segments"
16583
+ },
16584
+ common: {
16585
+ ad_spend: "Ad Spend",
16586
+ date: "Date",
16587
+ close: "Close",
16588
+ continue: "Continue",
16589
+ connected: "Connected",
16590
+ connecting: "Connecting...",
16591
+ reauth_required: "Re-authentication required",
16592
+ reauth_required_description: "Re-authentication required for one of your ad accounts",
16593
+ reauthenticate: "Reauthenticate",
16594
+ account_settings: "Account Settings",
16595
+ manage_account_settings: "Manage your account settings",
16596
+ copy: "Copy",
16597
+ copied: "Copied",
16598
+ error: "An error occurred",
16599
+ filter: "Filter",
16600
+ finishingUp: "Finishing up...",
16601
+ loading: "Loading...",
16602
+ need_help: "Need help? let us know",
16603
+ next: "Next",
16604
+ next_steps: "Next steps:",
16605
+ number: "{{number}}",
16606
+ previous: "Previous",
16607
+ revenue: "Revenue",
16608
+ revenue_from_ads: "Revenue From Ads",
16609
+ roas: "ROAS",
16610
+ return_on_ad_spend: "Return on Ad Spend",
16611
+ select_dates: "Select dates",
16612
+ total_ads_spend: "Total Ads Spend",
16613
+ measure: {
16614
+ dashboard: {
16615
+ title: "Marketing ROI Dashboard",
16616
+ subtitle: "Track and analyze how your marketing efforts are driving sales",
16617
+ reach_managed_campaign_banner: "Your ads are being managed by Reach. We’ll automatically optimize them to drive the best results."
16618
+ }
16619
+ },
16620
+ authentication: {
16621
+ required: "Authentication required",
16622
+ failed: "Authentication failed",
16623
+ connect_account_title: "Connect Your {{provider}} Account",
16624
+ connect_account_description: "To create and manage ad campaigns, please connect your {{provider}} account",
16625
+ connect_account_button: "Continue with {{provider}}",
16626
+ connect_account_TOS: "By connecting, you agree to our Terms of Service and Privacy Policy"
16627
+ },
16628
+ theme: {
16629
+ loading: "Loading theme...",
16630
+ error: "Error loading theme: {{message}}"
16631
+ },
16632
+ dates: {
16633
+ last_week: "Last week",
16634
+ last_month: "Last month",
16635
+ last_quarter: "Last quarter",
16636
+ last_year: "Last year"
16637
+ },
16638
+ campaigns: {
16639
+ setup: {
16640
+ card_header: "Run paid digital ads to get new leads & customers",
16641
+ title: "Create your first AI-driven Ad campaign in 4 simple clicks",
16642
+ description: "Welcome to the future of advertising! Our AI-powered campaign builder helps you effortlessly design and manage ads that reach your target audience with precision. Get started now to unlock the potential of automated, data-driven advertising.",
16643
+ button: "Set up paid ads",
16644
+ next_steps_description: "Already running ads? Track Your Marketing Results with a few clicks.",
16645
+ link_to_analytics: "Connect your existing accounts to get instant insights into your marketing performance."
16646
+ },
16647
+ how_it_works: {
16648
+ dialog_title: "How It Works",
16649
+ title: "Setup your ad campaign",
16650
+ step1: {
16651
+ title: "Set up budget & review your ads",
16652
+ description: "Define how much you want to spend, review the ad designs, and configure who you want to reach."
16653
+ },
16654
+ step2: {
16655
+ title: "We’ll publish & optimize your ads on Google",
16656
+ description: "We’ll do the hard work of publishing & continuously optimizing your ads on Google making sure you’re getting the best possible return on investment."
16657
+ },
16658
+ step3: {
16659
+ title: "See Customers & Results",
16660
+ description: "When a customer buys from you, we’ll notify you and show you the total revenue driven to your business from each dollar invested in ads. "
16661
+ }
16662
+ },
16663
+ ads_builder: {
16664
+ dialog_trigger: "New campaign",
16665
+ title: "Ads Wizard",
16666
+ description: "Create your new ad campaign",
16667
+ review_ad_themes: "Review Ad Themes",
16668
+ example_ad_preview: "Example Ad Preview",
16669
+ example_ad_preview_description: "Here's an example of how prospective customers might see your ads. We will automagically tweak the copy based on your products offered, and improve targeting based on what results in the most dollars to your business."
16670
+ }
16671
+ },
16672
+ analytics: {
16673
+ setup_analytics: "Setup analytics",
16674
+ setup_analytics_description: "Let's get you started with analytics. Connect your data sources to start tracking your customers.",
16675
+ connect_data: {
16676
+ title: "Connect Your Data",
16677
+ description: "We bring all of your ads data together to give you a clear view of which customers are coming in from where."
16678
+ },
16679
+ install_pixel: {
16680
+ copied_to_clipboard: "Copied to clipboard",
16681
+ copied_to_clipboard_description: "The tracking pixel code has been copied to your clipboard.",
16682
+ title: "Install our Tracking Pixel",
16683
+ description: "In order to get a complete picture of how users are interacting with your website, it’s important for the Reach analytics code to be on every page of your website and within as many third-party tools that you use as possible.",
16684
+ card_title: "Install the Snippet inside the <HEAD> of every page",
16685
+ third_party_pages_your_tracking_pixel: "Your Tracking Pixel:",
16686
+ card_description: "Copy this following text and insert it inside of the <HEAD> tags on all pages.",
16687
+ error_generating_pixel_code: "Error generating pixel code - please contact your administrator",
16688
+ third_party_pages_question: "Do you use any websites or landing pages for marketing your business?",
16689
+ third_party_pages_yes: "Yes, I have marketing websites",
16690
+ third_party_pages_no: "No, I don't use any websites",
16691
+ third_party_pages_why_asking: "Why We're Asking For This",
16692
+ third_party_pages_why_asking_description: "Adding our tracking pixel to your website allows us to:",
16693
+ third_party_pages_why_asking_list_1: "Understand how visitors interact with your pages",
16694
+ third_party_pages_why_asking_list_2: "Measure which ads are driving visitors to your site",
16695
+ third_party_pages_why_asking_list_3: "Track conversions from your campaigns",
16696
+ third_party_pages_enter_marketing_website: "Enter your marketing website:",
16697
+ third_party_pages_we_will_use_this_to_help_you_install_the_tracking_pixel: "We'll use this to help you install the tracking pixel",
16698
+ third_party_pages_select_your_website_platform: "Select your website platform:"
16699
+ },
16700
+ third_party_installation_guides: {
16701
+ title: "Installation Guides",
16702
+ description: "These guides will help you add the Reach analytics snippet to your website. The process works with any website builder or platform and most third-party tools.",
16703
+ installation_guide: "{{name}} Installation Guide",
16704
+ official_guide: "Official Guide",
16705
+ shopify: {
16706
+ step_1: "From your Shopify admin, go to Online Store > Themes",
16707
+ step_2: "Find the theme you want to edit, click the … button to open the actions menu, and then click Edit code",
16708
+ step_3: 'Open "theme.liquid"',
16709
+ step_4: "Find the </head> tag",
16710
+ step_5: "Paste the code snippet from the section above just before it"
16711
+ },
16712
+ google_tag_manager: {
16713
+ step_1: "Go to https://tagmanager.google.com",
16714
+ step_2: "Sign in to your Google Account",
16715
+ step_3: "Click the Accounts tab, then select Create Account",
16716
+ step_4: "Enter an account name and select your country location",
16717
+ step_5: "In Container Setup, enter a container name (e.g., your website URL)",
16718
+ step_6: 'Select "Web" as the container type',
16719
+ step_7: "Click Create and agree to the Terms of Service",
16720
+ step_8: "Once created, you'll receive two code snippets to install:",
16721
+ step_9: "• Place the first snippet in the <head> of your page",
16722
+ step_10: "• Place the second snippet immediately after the opening <body> tag",
16723
+ step_11: "In the Tags tab, click the + button to create a new tag",
16724
+ step_12: 'Select "Google Analytics: Universal Analytics" as the tag type',
16725
+ special_note: "Make sure you have the Google Tag Manager container code already installed on your site before adding this tag."
16726
+ },
16727
+ hubspot: {
16728
+ step_1: "Go to Settings → Content → Pages",
16729
+ step_2: 'In the upper left, select a domain to edit its settings. Or select "Default settings for all domains"',
16730
+ step_3: 'Paste the code from the section above to the "Site Header HTML" field',
16731
+ step_4: 'Click "Save"'
16732
+ },
16733
+ wordpress: {
16734
+ step_1: "We recommend using the popular WPCode Plugin",
16735
+ step_2: 'In the plugin, select "+ Add Snippet"',
16736
+ step_3: 'When presented with a menu of options, navigate to "Add Your Custom Code (New Snippet)" and select "Use snippet"',
16737
+ step_4: "Paste the code snippet from the section above",
16738
+ step_5: 'For Insert Method, choose "Auto Insert"',
16739
+ step_6: 'For Location, select "Site Wide Header"',
16740
+ step_7: "Be sure to save your snippet"
16741
+ },
16742
+ squarespace: {
16743
+ step_1: "Go to Settings → Advanced → Code Injection",
16744
+ step_2: 'Paste the code from the section above into the "Header" field',
16745
+ step_3: 'Click "Save"'
16746
+ },
16747
+ wix: {
16748
+ step_1: "Go to Settings → Custom Code",
16749
+ step_2: 'Click "+ Add Custom Code"',
16750
+ step_3: "Paste the code from the section above",
16751
+ step_4: 'Click "Apply"',
16752
+ step_5: 'Set "Add Code to Pages" to "All Pages"'
16753
+ },
16754
+ webflow: {
16755
+ step_1: "Open your project settings",
16756
+ step_2: 'Navigate to "Custom Code"',
16757
+ step_3: 'Paste the code from the section above into the "Head Code" section',
16758
+ step_4: 'Click "Save Changes"'
16759
+ },
16760
+ third_party_systems: {
16761
+ step_1: "Check if your third-party tools (lead forms, scheduling tools, etc.) allow custom code injection",
16762
+ step_2: 'Look for options labeled "Custom Code", "Embed Code", or "Advanced Settings"',
16763
+ step_3: "Paste the same tracking code into these sections where available",
16764
+ step_4: "Common locations include:",
16765
+ step_5: "• Head section of your website (for tracking scripts and styles)",
16766
+ step_6: "• Footer section of your website (for tracking scripts and styles)",
16767
+ special_note: "This helps ensure consistent tracking across all your customer touchpoints, even when using external tools."
16768
+ },
16769
+ custom: {
16770
+ step_1: "Locate your website's HTML template or main layout file",
16771
+ step_2: "Find the </head> tag in your HTML",
16772
+ step_3: "Paste the code snippet just before the </head> tag",
16773
+ step_4: "Save the file and deploy your changes"
16774
+ }
16775
+ },
16776
+ success: {
16777
+ title: "Success!",
16778
+ description: "You have successfully connected your data sources and installed our tracking pixel.",
16779
+ what_next: "What happens next?",
16780
+ step_1: "Your ad data will start syncing automatically",
16781
+ step_2: "The pixel will begin tracking conversions on your site",
16782
+ step_3: "You'll see your first analytics reports within 24 hours"
16783
+ }
16784
+ },
16785
+ dashboard: {
16786
+ banners: {
16787
+ metrics_crunching: {
16788
+ title: "Crunching your data",
16789
+ description: "You have successfully connected your ad accounts. We're now crunching your data. Check back soon for relevant metrics."
16790
+ },
16791
+ revoked_accounts: {
16792
+ title: "Your ad accounts have been revoked",
16793
+ description: "Please reconnect your ad accounts to continue using the dashboard."
16794
+ }
16795
+ },
16796
+ roas_chart: {
16797
+ title: "Ad Spend vs Revenue Over Time",
16798
+ campaign_not_available: "Chart is not available for individual campaigns yet"
16799
+ },
16800
+ customer_acquisition: {
16801
+ title: "Client Acquisition",
16802
+ description: "See how many new clients you acquired from each channel",
16803
+ client: "Client",
16804
+ source: "Source",
16805
+ total_spent: "Total Spent",
16806
+ total_revenue: "Total Revenue",
16807
+ status: "Status",
16808
+ no_data: "No data available",
16809
+ source_breakdown: "Source",
16810
+ payment_status: "Payment Status",
16811
+ paid: "Paid",
16812
+ unpaid: "Unpaid",
16813
+ invoice_details: "Invoice Details",
16814
+ amount: "Amount",
16815
+ service: "Service",
16816
+ invoice_date: "Invoice Date"
16817
+ },
16818
+ channel_performance: {
16819
+ title: "Channel Performance",
16820
+ description: "See how each channel performs",
16821
+ channel: "Channel",
16822
+ spend: "Spend",
16823
+ revenue: "Revenue",
16824
+ roas: "ROAS",
16825
+ new_customers: "New Customers"
16826
+ },
16827
+ traffic_conversion: {
16828
+ title: "Traffic Conversion Funnel"
16829
+ },
16830
+ tabs: {
16831
+ overview: "Overview",
16832
+ channel_performance: "Channel Performance",
16833
+ campaign_performance: "Campaign Performance",
16834
+ customer_acquisition: "Customer Acquisition",
16835
+ traffic_conversion: "Traffic Conversion"
16836
+ },
16837
+ metrics: {
16838
+ ads_spend: "Ads Spend",
16839
+ ads_spend_description: "The amount spent on ads in a given period. Sum of all sub-ads accounts (e.g. insta, google). Excluding agency fees",
16840
+ direct_measured_revenue: "Direct Measured Revenue",
16841
+ direct_measured_revenue_description: "The amount of revenue directly measured from ads",
16842
+ measured_revenue: "Measured Revenue",
16843
+ measured_revenue_description: "The amount of revenue measured from ads",
16844
+ direct_measured_conversions: "Direct Measured Conversions",
16845
+ direct_measured_conversions_description: "The amount of conversions directly measured from ads",
16846
+ measured_conversions: "Measured Conversions",
16847
+ measured_conversions_description: "The amount of conversions measured from ads",
16848
+ roas: "ROAS",
16849
+ roas_description: "This is the ratio of the revenue to the ads spend",
16850
+ impressions: "Impressions",
16851
+ impressions_description: "Number of times your ads were shown to potential customers",
16852
+ clicks: "Clicks/Actions",
16853
+ clicks_description: "Total interactions with your ads, including clicks and other actions",
16854
+ website_visitors: "Website Visitors",
16855
+ website_visitors_description: "Unique visitors to your website from advertising campaigns",
16856
+ new_leads: "New Leads",
16857
+ new_leads_description: "New potential customers who provided contact information",
16858
+ customer_ltv: "Customer LTV",
16859
+ customer_ltv_description: "Average lifetime value of customers acquired through ads",
16860
+ new_customers: "New Customers",
16861
+ new_customers_description: "New customers who made a purchase or took an action",
16862
+ new_leads_conversion_rate: "New Leads Conversion Rate",
16863
+ new_leads_conversion_rate_description: "The ratio of new leads to the total number of leads",
16864
+ new_customers_conversion_rate: "New Customers Conversion Rate",
16865
+ new_customers_conversion_rate_description: "The ratio of new customers to the total number of customers",
16866
+ cost_per_click: "Cost Per Click",
16867
+ cost_per_click_description: "The amount spent per click on your ads",
16868
+ click_conversion_rate: "Click Conversion Rate",
16869
+ click_conversion_rate_description: "The ratio of clicks to the total number of clicks",
16870
+ click_through_rate: "Click Through Rate",
16871
+ click_through_rate_description: "The ratio of clicks to the total number of impressions",
16872
+ conversion_rate: "Conversion Rate",
16873
+ conversion_rate_description: "The ratio of conversions to the total number of clicks",
16874
+ total_conversion: "Total Conversion",
16875
+ total_conversion_description: "The total number of conversions from your ads",
16876
+ cac: "CAC",
16877
+ cac_description: "The amount spent per customer acquisition",
16878
+ revenue_per_click: "Revenue Per Click",
16879
+ revenue_per_click_description: "The amount of revenue generated per click on your ads",
16880
+ revenue_per_new_customer: "Revenue Per New Customer",
16881
+ revenue_per_new_customer_description: "The amount of revenue generated per new customer",
16882
+ reengaged_customers: "Reengaged Customers",
16883
+ reengaged_customers_description: "The number of customers who have been reengaged with your ads",
16884
+ expected_revenue: "Expected Revenue",
16885
+ expected_revenue_description: "The amount of revenue you expect to generate from your ads",
16886
+ estimated_revenue: "Estimated Revenue",
16887
+ estimated_revenue_description: "The amount of revenue you expect to generate from your ads"
16888
+ },
16889
+ title: "Marketing Revenue Dashboard",
16890
+ settings_sheet: {
16891
+ setup: "Setup",
16892
+ connected_accounts: "Connected Accounts",
16893
+ setup_analytics: "Setup analytics",
16894
+ setup_analytics_description: "Configure your analytics tracking",
16895
+ setup_campaigns: "Setup campaigns",
16896
+ setup_campaigns_description: "Set up your first campaign",
16897
+ legal: "Legal",
16898
+ terms_of_service: "Terms of Service",
16899
+ privacy_policy: "Privacy Policy"
16900
+ }
16901
+ },
16902
+ setup: {
16903
+ how_it_works: {
16904
+ title: "How It Works",
16905
+ dialog_title: "Setup Marketing Insights",
16906
+ connect_ads_title: "Connect your Ads Accounts",
16907
+ connect_ads_description: "Link your advertising accounts from platforms like Google and Meta to consolidate all your campaign data in one place. This enables comprehensive tracking and analysis of your marketing spend.",
16908
+ install_pixel_title: "Install Our Tracking Pixel",
16909
+ install_pixel_description: "Add our lightweight tracking code to your website to accurately measure customer interactions and conversions. This simple integration helps identify which ads are driving real results for your business.",
16910
+ see_customers_results_title: "See Customers & Results",
16911
+ see_customers_results_description: "Get clear insights into your marketing performance with detailed analytics on customer acquisition, conversion rates, and return on ad spend. Make data-driven decisions to optimize your campaigns and grow your business.",
16912
+ still_have_more_questions: "Still have more questions?",
16913
+ get_started: "Get Started"
16914
+ },
16915
+ initial_setup: {
16916
+ wizard_title: "Connect your ad accounts and see exactly how your campaigns drive revenue",
16917
+ title: "Unlock Clear Insights into Your Marketing Performance",
16918
+ description: "Stop guessing and start knowing. Our performance dashboard gives you a complete view of your marketing efforts, including ad spend, conversions, and return on ad spend (ROAS).",
16919
+ description_2: "With a simple setup process, you’ll have actionable insights at your fingertips to help you make smarter decisions and grow your business.",
16920
+ setup_performance_analytics: "Setup Performance Analytics",
16921
+ next_steps_description: "If you're not running ads yet, you can launch your first AI-powered ad campaign in minutes.",
16922
+ next_steps_link: "We will prompt you to connect your ad accounts and set up your first campaign."
16923
+ }
16924
+ },
16925
+ oauth: {
16926
+ selectAccount: {
16927
+ title: "Select {{platform}} Account",
16928
+ description: "Choose the {{platform}} account you want to connect.",
16929
+ loading: "Loading accounts...",
16930
+ loadingPlatform: "Loading {{platform}} accounts...",
16931
+ loadingDescription: "Please wait while we fetch your available accounts...",
16932
+ noAccounts: "No {{platform}} accounts were found for your account.",
16933
+ noAccountsDescription: "Please make sure you have access to a {{platform}} account and try again.",
16934
+ selectAccountPlaceholder: "Select an account",
16935
+ searchPlaceholder: "Search accounts...",
16936
+ fetchAccounts: "Fetching accounts...",
16937
+ noAccountSelected: "No account selected",
16938
+ enableTrackingParams: "Enable Tracking Parameters",
16939
+ enableTrackingParamsDescription: "Append the reach campaign id parameter to your ad platform tracking settings. We will not overwrite any existing tracking parameters. Required for accurate tracking.",
16940
+ google: {
16941
+ selectAccountDescription: "Select the Google Ads account you want to connect to view your data. These will be linked to our MCC for optimal tracking.",
16942
+ mccAccounts: "MCC Accounts",
16943
+ directAccounts: "Direct Accounts"
16944
+ },
16945
+ meta: {
16946
+ selectAccountDescription: "Choose the Meta Ads account you want to connect to view your data."
16947
+ }
16948
+ },
16949
+ success: {
16950
+ connection: {
16951
+ title: "Connected successfully",
16952
+ description: "Your {{provider}} account has been connected."
16953
+ },
16954
+ revoke: {
16955
+ title: "Account revoked",
16956
+ description: "Your {{provider}} account has been revoked."
16957
+ }
16958
+ },
16959
+ error: {
16960
+ title: "Connection failed",
16961
+ description: "Failed to connect account"
16962
+ },
16963
+ revoke: {
16964
+ title: "Revoke access",
16965
+ description: "Are you sure? Revoking access will remove the connection you have and you will be unable to view your ad metrics.",
16966
+ cancel: "Cancel",
16967
+ revoke: "Revoke",
16968
+ error: {
16969
+ title: "Error",
16970
+ description: "Failed to revoke access"
16971
+ }
16972
+ }
16973
+ },
16974
+ magic_link: {
16975
+ get_started: "Get Started",
16976
+ description: "Reach will be embedded within your platform dashboard but until then, you can get started with a magic link. Log in to your account and start creating AI-powered campaigns or measuring your ad spend and performance.",
16977
+ create_campaigns: "Create AI-generated ad campaigns in minutes",
16978
+ unlock_insights: "Unlock insights into your ad spend and performance",
16979
+ save_time: "Save time with automated campaign optimization",
16980
+ request_new_magic_link: "Request New Magic Link",
16981
+ go_to_dashboard: "Go to Dashboard",
16982
+ continuation_disclaimer: "By continuing, you agree to our <terms_of_service>Terms of Service</terms_of_service> and <privacy_policy>Privacy Policy</privacy_policy>."
16983
+ },
16984
+ empty_state: {
16985
+ analytics: {
16986
+ title: "You haven't connected any ad accounts yet",
16987
+ description: "You can connect your ad accounts in minutes and start driving more customers to your business.",
16988
+ button_text: "Setup analytics"
16989
+ }
16990
+ }
16991
+ }
16992
+ };
16495
16993
  const I18nProvider = ({
16496
16994
  children: children2,
16497
16995
  initialLanguage
@@ -16517,6 +17015,30 @@ const ReachProvider = ({
16517
17015
  }
16518
17016
  return createQueryClient();
16519
17017
  });
17018
+ useEffect(() => {
17019
+ if (language?.overrides) {
17020
+ const createLanguageBundle = (namespace, lang) => {
17021
+ const overrides = language?.overrides?.[namespace]?.[lang];
17022
+ if (!overrides) return defaultTranslations.common;
17023
+ return {
17024
+ ...defaultTranslations.common,
17025
+ ...Object.entries(overrides).reduce(
17026
+ (acc, [key, value]) => ({
17027
+ ...acc,
17028
+ [key]: value
17029
+ }),
17030
+ {}
17031
+ )
17032
+ };
17033
+ };
17034
+ Object.keys(language.overrides).forEach((namespace) => {
17035
+ const enBundle = createLanguageBundle(namespace, "en");
17036
+ const esBundle = createLanguageBundle(namespace, "es");
17037
+ instance.addResourceBundle("en", namespace, enBundle, true, true);
17038
+ instance.addResourceBundle("es", namespace, esBundle, true, true);
17039
+ });
17040
+ }
17041
+ }, [language?.overrides]);
16520
17042
  return /* @__PURE__ */ jsx("div", { "data-reach-root": true, className: "h-full w-full", children: /* @__PURE__ */ jsxs(QueryClientProvider, { client: queryClient, children: [
16521
17043
  /* @__PURE__ */ jsx(
16522
17044
  D$1,
@@ -16538,7 +17060,7 @@ const ReachProvider = ({
16538
17060
  useCamelCaseFlagKeys: false,
16539
17061
  sendEventsOnFlagRead: true
16540
17062
  },
16541
- children: /* @__PURE__ */ jsx(I18nProvider, { initialLanguage: language, children: /* @__PURE__ */ jsx(Provider$1, { initialTheme: theme2, children: /* @__PURE__ */ jsxs(Provider$2, { children: [
17063
+ children: /* @__PURE__ */ jsx(I18nProvider, { initialLanguage: language?.default, children: /* @__PURE__ */ jsx(Provider$1, { initialTheme: theme2, children: /* @__PURE__ */ jsxs(Provider$2, { children: [
16542
17064
  children2,
16543
17065
  /* @__PURE__ */ jsx(Toaster, {})
16544
17066
  ] }) }) })
@@ -26403,12 +26925,12 @@ const BigSelector = ({ onClick, title: title2, subtitle, icon, selected, disable
26403
26925
  "button",
26404
26926
  {
26405
26927
  onClick,
26406
- className: `flex flex-col items-center justify-center rounded-lg border-[3px] p-4 transition-all duration-300 ease-in-out ${disabled ? "opacity-50 cursor-not-allowed" : selected ? "scale-[1.02] hover:scale-[1.04] [border-color:hsl(var(--reach-primary))] [background-color:hsl(var(--reach-primary)/0.05)]" : "border-gray-200 hover:[border-color:hsl(var(--reach-primary))] hover:bg-gray-50"}`,
26928
+ className: `flex flex-col items-center justify-center rounded-lg border-[3px] p-6 transition-all duration-300 ease-in-out ${disabled ? "opacity-50 cursor-not-allowed" : selected ? "scale-[1.02] hover:scale-[1.04] [border-color:hsl(var(--reach-primary))] [background-color:hsl(var(--reach-primary)/0.05)]" : "border-gray-200 hover:[border-color:hsl(var(--reach-primary))] hover:bg-gray-50"}`,
26407
26929
  children: [
26408
26930
  icon,
26409
- /* @__PURE__ */ jsxs("div", { className: "text-center", children: [
26931
+ /* @__PURE__ */ jsxs("div", { className: "text-center mt-3", children: [
26410
26932
  /* @__PURE__ */ jsx("div", { className: "text-sm font-medium text-gray-900", children: title2 }),
26411
- /* @__PURE__ */ jsx("div", { className: "text-xs text-gray-500", children: subtitle })
26933
+ /* @__PURE__ */ jsx("div", { className: "text-xs text-gray-500 mt-1", children: subtitle })
26412
26934
  ] })
26413
26935
  ]
26414
26936
  }
@@ -26709,7 +27231,7 @@ const CreateAutomationModal = ({
26709
27231
  return /* @__PURE__ */ jsx("div", { className: styles$3.container, children: /* @__PURE__ */ jsx(SpinLoader, { text: ["Creating Automation", "Finishing up"] }) });
26710
27232
  }
26711
27233
  return /* @__PURE__ */ jsxs("div", { className: "relative overflow-y-auto h-full p-8", children: [
26712
- /* @__PURE__ */ jsxs(AnimatePresence, { mode: "wait", children: [
27234
+ /* @__PURE__ */ jsxs(AnimatePresence, { children: [
26713
27235
  currentStep === CreateAutomationModalStep.ChooseAutomationType && /* @__PURE__ */ jsx(BlurDiv, { children: /* @__PURE__ */ jsx(
26714
27236
  ChooseAutomationType,
26715
27237
  {
@@ -27218,7 +27740,7 @@ function computeScore(path2, index2) {
27218
27740
  initialScore += indexRouteValue;
27219
27741
  }
27220
27742
  return segments.filter((s3) => !isSplat(s3)).reduce(
27221
- (score, segment) => score + (paramRe.test(segment) ? dynamicSegmentValue : segment === "" ? emptySegmentValue : staticSegmentValue),
27743
+ (score, segment2) => score + (paramRe.test(segment2) ? dynamicSegmentValue : segment2 === "" ? emptySegmentValue : staticSegmentValue),
27222
27744
  initialScore
27223
27745
  );
27224
27746
  }
@@ -27379,11 +27901,11 @@ function resolvePath(to, fromPathname = "/") {
27379
27901
  function resolvePathname(relativePath, fromPathname) {
27380
27902
  let segments = fromPathname.replace(/\/+$/, "").split("/");
27381
27903
  let relativeSegments = relativePath.split("/");
27382
- relativeSegments.forEach((segment) => {
27383
- if (segment === "..") {
27904
+ relativeSegments.forEach((segment2) => {
27905
+ if (segment2 === "..") {
27384
27906
  if (segments.length > 1) segments.pop();
27385
- } else if (segment !== ".") {
27386
- segments.push(segment);
27907
+ } else if (segment2 !== ".") {
27908
+ segments.push(segment2);
27387
27909
  }
27388
27910
  });
27389
27911
  return segments.length > 1 ? segments.join("/") : "/";
@@ -33907,8 +34429,8 @@ const AutomationTable = memo$1(
33907
34429
  title: "No Automations Found",
33908
34430
  description: "Create your first automation to get started."
33909
34431
  },
33910
- onRowClick: (automation) => {
33911
- onViewAutomation(automation.id);
34432
+ onRowClick: (automation2) => {
34433
+ onViewAutomation(automation2.id);
33912
34434
  },
33913
34435
  className: "rounded-lg bg-background"
33914
34436
  }
@@ -34099,6 +34621,16 @@ const updateSegment = async (params, segmentId) => {
34099
34621
  );
34100
34622
  return response.data;
34101
34623
  };
34624
+ const textToSegment = async (userInput) => {
34625
+ const response = await baseRequest(
34626
+ `${BUSINESS_SEGMENT_PATH}/text-to-segment`,
34627
+ {
34628
+ method: "POST",
34629
+ body: JSON.stringify({ text: userInput })
34630
+ }
34631
+ );
34632
+ return response.data;
34633
+ };
34102
34634
  var JSONSchemaType = /* @__PURE__ */ ((JSONSchemaType2) => {
34103
34635
  JSONSchemaType2["String"] = "string";
34104
34636
  JSONSchemaType2["Number"] = "number";
@@ -34121,6 +34653,8 @@ var ConditionOperatorEnumType = /* @__PURE__ */ ((ConditionOperatorEnumType2) =>
34121
34653
  ConditionOperatorEnumType2["GREATER_THAN"] = "greater_than";
34122
34654
  ConditionOperatorEnumType2["LESS_THAN"] = "less_than";
34123
34655
  ConditionOperatorEnumType2["EXISTS"] = "exists";
34656
+ ConditionOperatorEnumType2["EQUALS_MONTH_DAY"] = "equals_month_day";
34657
+ ConditionOperatorEnumType2["EQUALS_MONTH_DAY_YEAR"] = "equals_month_day_year";
34124
34658
  return ConditionOperatorEnumType2;
34125
34659
  })(ConditionOperatorEnumType || {});
34126
34660
  const useSegment = () => {
@@ -34241,7 +34775,9 @@ const operatorToHumanReadable = {
34241
34775
  [ConditionOperatorEnumType.NOT_EQUALS]: "Not Equals",
34242
34776
  [ConditionOperatorEnumType.GREATER_THAN]: "Greater Than",
34243
34777
  [ConditionOperatorEnumType.LESS_THAN]: "Less Than",
34244
- [ConditionOperatorEnumType.EXISTS]: "Exists"
34778
+ [ConditionOperatorEnumType.EXISTS]: "Exists",
34779
+ [ConditionOperatorEnumType.EQUALS_MONTH_DAY]: "Month and Day Matches",
34780
+ [ConditionOperatorEnumType.EQUALS_MONTH_DAY_YEAR]: "Month, Day, and Year Matches"
34245
34781
  };
34246
34782
  const buildInFieldToHumanReadable = {
34247
34783
  email: "Email",
@@ -35302,7 +35838,7 @@ const ComboboxSelect = ({
35302
35838
  Button$1,
35303
35839
  {
35304
35840
  "aria-expanded": open,
35305
- className: "w-[200px] justify-between",
35841
+ className: "w-[200px] overflow-hidden justify-between",
35306
35842
  variant: "outline",
35307
35843
  children: [
35308
35844
  value ? options.find((option) => option.value === value)?.label : placeholder,
@@ -41720,18 +42256,20 @@ var DateUnit = /* @__PURE__ */ ((DateUnit2) => {
41720
42256
  ConditionOperatorEnumType.EXISTS
41721
42257
  ],
41722
42258
  [JSONSchemaType.Date]: [
41723
- ConditionOperatorEnumType.EQUALS,
41724
- ConditionOperatorEnumType.NOT_EQUALS,
41725
42259
  ConditionOperatorEnumType.GREATER_THAN,
41726
42260
  ConditionOperatorEnumType.LESS_THAN,
41727
- ConditionOperatorEnumType.EXISTS
42261
+ ConditionOperatorEnumType.EXISTS,
42262
+ ConditionOperatorEnumType.EQUALS_MONTH_DAY,
42263
+ ConditionOperatorEnumType.EQUALS_MONTH_DAY_YEAR
41728
42264
  ],
41729
42265
  [JSONSchemaType.DateTime]: [
41730
42266
  ConditionOperatorEnumType.EQUALS,
41731
42267
  ConditionOperatorEnumType.NOT_EQUALS,
41732
42268
  ConditionOperatorEnumType.GREATER_THAN,
41733
42269
  ConditionOperatorEnumType.LESS_THAN,
41734
- ConditionOperatorEnumType.EXISTS
42270
+ ConditionOperatorEnumType.EXISTS,
42271
+ ConditionOperatorEnumType.EQUALS_MONTH_DAY,
42272
+ ConditionOperatorEnumType.EQUALS_MONTH_DAY_YEAR
41735
42273
  ],
41736
42274
  [JSONSchemaType.Integer]: [
41737
42275
  ConditionOperatorEnumType.EQUALS,
@@ -41811,7 +42349,7 @@ const ValueInput = ({
41811
42349
  }
41812
42350
  );
41813
42351
  React.useEffect(() => {
41814
- if (operator !== ConditionOperatorEnumType.EQUALS && isRelativeMode) {
42352
+ if (operator !== ConditionOperatorEnumType.EQUALS_MONTH_DAY && operator !== ConditionOperatorEnumType.EQUALS_MONTH_DAY_YEAR && isRelativeMode) {
41815
42353
  setIsRelativeMode(false);
41816
42354
  onChange(date2 ? [date2] : []);
41817
42355
  }
@@ -41871,7 +42409,7 @@ const ValueInput = ({
41871
42409
  );
41872
42410
  }
41873
42411
  if (fieldType === JSONSchemaType.Date || fieldType === JSONSchemaType.DateTime) {
41874
- const showRelativeDateOption = operator === ConditionOperatorEnumType.EQUALS;
42412
+ const showRelativeDateOption = operator === ConditionOperatorEnumType.EQUALS_MONTH_DAY || operator === ConditionOperatorEnumType.EQUALS_MONTH_DAY_YEAR;
41875
42413
  const handleRelativeDateChange = (newRelativeDate) => {
41876
42414
  if (validateRelativeDate(newRelativeDate)) {
41877
42415
  setRelativeDate(newRelativeDate);
@@ -42175,14 +42713,156 @@ const ConditionRow = ({
42175
42713
  ] })
42176
42714
  ] });
42177
42715
  };
42716
+ const PromptBuilderStyle = ({ onSelectStyle }) => {
42717
+ const [selectedStyle, setSelectedStyle] = useState(
42718
+ null
42719
+ );
42720
+ return /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-1 md:grid-cols-2 gap-4 p-4 max-w-4xl mx-auto", children: [
42721
+ /* @__PURE__ */ jsx(
42722
+ BigSelector,
42723
+ {
42724
+ onClick: () => {
42725
+ setSelectedStyle("ai");
42726
+ onSelectStyle("ai");
42727
+ },
42728
+ title: "Build with AI",
42729
+ subtitle: "Describe your audience in plain language and let AI create the conditions",
42730
+ icon: /* @__PURE__ */ jsx("div", { className: "h-12 w-12 rounded-full bg-primary/10 flex items-center justify-center", children: /* @__PURE__ */ jsx("div", { className: "w-6 h-6 text-[hsl(var(--reach-primary))]", children: /* @__PURE__ */ jsx(Sparkles, { className: "w-full h-full" }) }) }),
42731
+ selected: selectedStyle === "ai"
42732
+ }
42733
+ ),
42734
+ /* @__PURE__ */ jsx(
42735
+ BigSelector,
42736
+ {
42737
+ onClick: () => {
42738
+ setSelectedStyle("manual");
42739
+ onSelectStyle("manual");
42740
+ },
42741
+ title: "Build Manually",
42742
+ subtitle: `Create your ${t("engage:segment")} by configuring conditions directly`,
42743
+ icon: /* @__PURE__ */ jsx("div", { className: "h-12 w-12 rounded-full bg-primary/10 flex items-center justify-center", children: /* @__PURE__ */ jsx("div", { className: "w-6 h-6 text-[hsl(var(--reach-primary))]", children: /* @__PURE__ */ jsx(Settings2, { className: "w-full h-full" }) }) }),
42744
+ selected: selectedStyle === "manual"
42745
+ }
42746
+ )
42747
+ ] });
42748
+ };
42749
+ const SegmentBuilderHeader = ({
42750
+ segmentId,
42751
+ setOpen,
42752
+ setTextToSegment,
42753
+ promptBuilderStyle,
42754
+ textToSegment: textToSegment2
42755
+ }) => {
42756
+ return /* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsx(DialogHeader, { className: "", children: /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between", children: [
42757
+ /* @__PURE__ */ jsx(DialogTitle, { className: "text-3xl font-normal", children: segmentId ? `Edit ${t("engage:segment")}` : `Create ${t("engage:segment")}` }),
42758
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
42759
+ promptBuilderStyle === false && textToSegment2 === false && /* @__PURE__ */ jsx(TooltipProvider, { children: /* @__PURE__ */ jsxs(Tooltip, { children: [
42760
+ /* @__PURE__ */ jsx(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx(
42761
+ Button$1,
42762
+ {
42763
+ variant: "outline",
42764
+ size: "sm",
42765
+ onClick: () => setTextToSegment(true),
42766
+ children: /* @__PURE__ */ jsx(Sparkles, { className: "h-4 w-3" })
42767
+ }
42768
+ ) }),
42769
+ /* @__PURE__ */ jsx(TooltipContent, { children: /* @__PURE__ */ jsxs("p", { children: [
42770
+ "Use AI to create ",
42771
+ t("engage:segment"),
42772
+ " by describing them in natural language"
42773
+ ] }) })
42774
+ ] }) }),
42775
+ /* @__PURE__ */ jsx(
42776
+ Button$1,
42777
+ {
42778
+ variant: "ghost",
42779
+ size: "icon",
42780
+ onClick: () => {
42781
+ if (textToSegment2 === true) {
42782
+ setTextToSegment(false);
42783
+ } else {
42784
+ setOpen(false);
42785
+ }
42786
+ },
42787
+ className: "h-8 w-8",
42788
+ children: /* @__PURE__ */ jsx(X$1, { className: "h-4 w-4" })
42789
+ }
42790
+ )
42791
+ ] })
42792
+ ] }) }) });
42793
+ };
42794
+ const BasicLoader = () => {
42795
+ return /* @__PURE__ */ jsx("div", { className: "flex items-center justify-center @container", children: /* @__PURE__ */ jsxs("div", { className: "relative h-8 w-8", children: [
42796
+ /* @__PURE__ */ jsx("div", { className: "absolute inset-0 rounded-full border-2 border-primary/20" }),
42797
+ /* @__PURE__ */ jsx("div", { className: "absolute inset-0 animate-spin rounded-full border-2 border-primary border-t-transparent" })
42798
+ ] }) });
42799
+ };
42800
+ const TextToSegment = ({ setTextToSegment, setSegment }) => {
42801
+ const [userInput, setUserInput] = React__default.useState("");
42802
+ const [isLoading, setIsLoading] = React__default.useState(false);
42803
+ const { toast: toast2 } = useToast();
42804
+ const getSegment2 = async () => {
42805
+ if (!userInput) {
42806
+ toast2({
42807
+ title: "Please enter a description",
42808
+ description: "Please enter a description of your target audience",
42809
+ variant: "destructive"
42810
+ });
42811
+ return;
42812
+ }
42813
+ setIsLoading(true);
42814
+ const response = await textToSegment(userInput);
42815
+ if (response.success && response.conditions) {
42816
+ toast2({
42817
+ title: `${t("engage:segment")} conditions built successfully 🚀`,
42818
+ description: `Your ${t("engage:segment")} conditions have been built successfully`
42819
+ });
42820
+ setSegment(response.conditions);
42821
+ } else {
42822
+ toast2({
42823
+ title: `${t("engage:segment")} build failed`,
42824
+ description: "Please try again",
42825
+ variant: "destructive"
42826
+ });
42827
+ }
42828
+ setTextToSegment(false);
42829
+ setIsLoading(false);
42830
+ };
42831
+ return /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-6 p-4", children: [
42832
+ /* @__PURE__ */ jsxs("div", { className: "space-y-2", children: [
42833
+ /* @__PURE__ */ jsx("h3", { className: "text-lg font-semibold text-foreground", children: "Describe your audience" }),
42834
+ /* @__PURE__ */ jsx("p", { className: "text-sm text-muted-foreground", children: "Describe the audience you want to target in plain language, and our AI will create the conditions for you." })
42835
+ ] }),
42836
+ /* @__PURE__ */ jsxs("div", { className: "space-y-4", children: [
42837
+ /* @__PURE__ */ jsxs(AnimatePresence, { children: [
42838
+ isLoading && /* @__PURE__ */ jsx(BlurDiv, { children: /* @__PURE__ */ jsx(BasicLoader, {}) }),
42839
+ !isLoading && /* @__PURE__ */ jsx(BlurDiv, { children: /* @__PURE__ */ jsx(
42840
+ Textarea,
42841
+ {
42842
+ placeholder: "Describe your target audience...",
42843
+ className: "min-h-[120px] resize-none",
42844
+ value: userInput,
42845
+ onChange: (e4) => setUserInput(e4.target.value)
42846
+ }
42847
+ ) })
42848
+ ] }),
42849
+ /* @__PURE__ */ jsx("div", { className: "flex justify-end gap-2", children: /* @__PURE__ */ jsxs(Button$1, { onClick: getSegment2, children: [
42850
+ /* @__PURE__ */ jsx(Sparkles, { className: "h-4 w-4" }),
42851
+ "Generate ",
42852
+ t("engage:segment")
42853
+ ] }) })
42854
+ ] })
42855
+ ] });
42856
+ };
42178
42857
  function SegmentBuilder({
42179
42858
  segmentId,
42180
42859
  setOpen,
42181
42860
  onSegmentUpdated
42182
42861
  }) {
42183
42862
  const { toast: toast2 } = useToast();
42863
+ const newSegment = segmentId === void 0;
42184
42864
  const [isLoading, setIsLoading] = React.useState(false);
42185
- const [segment, setSegment] = React.useState({
42865
+ const [segment2, setSegment] = React.useState({
42186
42866
  version: "1.0",
42187
42867
  id: "",
42188
42868
  name: "",
@@ -42193,6 +42873,10 @@ function SegmentBuilder({
42193
42873
  const { segment: existingSegment, isLoading: isLoadingSegment } = useGetSegment(segmentId || "");
42194
42874
  const { updateSegment: updateSegment2 } = useUpdateSegment(segmentId);
42195
42875
  const { createSegment: createSegment2, isCreating, segmentsConditions } = useSegment();
42876
+ const [textToSegment2, setTextToSegment] = React.useState(false);
42877
+ const [promptBuilderStyle, setPromptBuilderStyle] = React.useState(
42878
+ newSegment ? true : false
42879
+ );
42196
42880
  React.useEffect(() => {
42197
42881
  if (!segmentsConditions) {
42198
42882
  return;
@@ -42227,18 +42911,18 @@ function SegmentBuilder({
42227
42911
  }
42228
42912
  }, [existingSegment, segmentsConditions]);
42229
42913
  const updateCondition = (index2, condition) => {
42230
- const newConditions = [...segment.conditions];
42914
+ const newConditions = [...segment2.conditions];
42231
42915
  newConditions[index2] = condition;
42232
- setSegment({ ...segment, conditions: newConditions });
42916
+ setSegment({ ...segment2, conditions: newConditions });
42233
42917
  };
42234
42918
  const duplicateCondition = (index2) => {
42235
- const newConditions = [...segment.conditions];
42236
- newConditions.splice(index2 + 1, 0, { ...segment.conditions[index2] });
42237
- setSegment({ ...segment, conditions: newConditions });
42919
+ const newConditions = [...segment2.conditions];
42920
+ newConditions.splice(index2 + 1, 0, { ...segment2.conditions[index2] });
42921
+ setSegment({ ...segment2, conditions: newConditions });
42238
42922
  };
42239
42923
  const deleteCondition = (index2) => {
42240
- const newConditions = segment.conditions.filter((_2, i3) => i3 !== index2);
42241
- setSegment({ ...segment, conditions: newConditions });
42924
+ const newConditions = segment2.conditions.filter((_2, i3) => i3 !== index2);
42925
+ setSegment({ ...segment2, conditions: newConditions });
42242
42926
  };
42243
42927
  const hasRelativeDate = (condition) => {
42244
42928
  return condition.value.some(
@@ -42265,10 +42949,10 @@ function SegmentBuilder({
42265
42949
  error: "EXISTS operator can only be used with an empty array"
42266
42950
  };
42267
42951
  }
42268
- if (hasRelativeDate(condition) && condition.operator !== ConditionOperatorEnumType.EQUALS) {
42952
+ if (hasRelativeDate(condition) && condition.operator !== ConditionOperatorEnumType.EQUALS_MONTH_DAY && condition.operator !== ConditionOperatorEnumType.EQUALS_MONTH_DAY_YEAR) {
42269
42953
  return {
42270
42954
  valid: false,
42271
- error: "Relative dates can only be used with the EQUALS operator"
42955
+ error: "Relative dates can only be used with the month and day or month, day, and year operator"
42272
42956
  };
42273
42957
  }
42274
42958
  }
@@ -42278,7 +42962,7 @@ function SegmentBuilder({
42278
42962
  };
42279
42963
  };
42280
42964
  const handleSave = async () => {
42281
- if (!segment.name || !segment.description) {
42965
+ if (!segment2.name || !segment2.description) {
42282
42966
  toast2({
42283
42967
  title: "Name and description are required",
42284
42968
  description: "Please ensure all fields are filled out",
@@ -42286,7 +42970,7 @@ function SegmentBuilder({
42286
42970
  });
42287
42971
  return;
42288
42972
  }
42289
- const { valid, error: error2 } = validationConditions(segment.conditions);
42973
+ const { valid, error: error2 } = validationConditions(segment2.conditions);
42290
42974
  if (!valid) {
42291
42975
  toast2({
42292
42976
  title: "Conditions are invalid",
@@ -42300,9 +42984,9 @@ function SegmentBuilder({
42300
42984
  if (segmentId && existingSegment) {
42301
42985
  updateSegment2(
42302
42986
  {
42303
- name: segment.name,
42304
- description: segment.description,
42305
- conditions: segment.conditions
42987
+ name: segment2.name,
42988
+ description: segment2.description,
42989
+ conditions: segment2.conditions
42306
42990
  },
42307
42991
  {
42308
42992
  onSuccess: () => {
@@ -42310,7 +42994,7 @@ function SegmentBuilder({
42310
42994
  title: "Segment updated successfully"
42311
42995
  });
42312
42996
  setOpen(false);
42313
- onSegmentUpdated?.(segment.id);
42997
+ onSegmentUpdated?.(segment2.id);
42314
42998
  },
42315
42999
  onError: () => {
42316
43000
  toast2({
@@ -42325,9 +43009,9 @@ function SegmentBuilder({
42325
43009
  } else {
42326
43010
  createSegment2(
42327
43011
  {
42328
- name: segment.name,
42329
- description: segment.description,
42330
- conditions: segment.conditions
43012
+ name: segment2.name,
43013
+ description: segment2.description,
43014
+ conditions: segment2.conditions
42331
43015
  },
42332
43016
  {
42333
43017
  onSuccess: () => {
@@ -42335,7 +43019,7 @@ function SegmentBuilder({
42335
43019
  title: "Segment created successfully"
42336
43020
  });
42337
43021
  setOpen(false);
42338
- onSegmentUpdated?.(segment.id);
43022
+ onSegmentUpdated?.(segment2.id);
42339
43023
  },
42340
43024
  onError: () => {
42341
43025
  toast2({
@@ -42364,9 +43048,9 @@ function SegmentBuilder({
42364
43048
  }
42365
43049
  const addCondition = () => {
42366
43050
  setSegment({
42367
- ...segment,
43051
+ ...segment2,
42368
43052
  conditions: [
42369
- ...segment.conditions,
43053
+ ...segment2.conditions,
42370
43054
  {
42371
43055
  field: segmentsConditions.conditions[0].field,
42372
43056
  operator: segmentsConditions.conditions[0].operators[0],
@@ -42375,131 +43059,163 @@ function SegmentBuilder({
42375
43059
  ]
42376
43060
  });
42377
43061
  };
42378
- return /* @__PURE__ */ jsxs("div", { className: "flex flex-1 flex-col overflow-hidden", children: [
42379
- /* @__PURE__ */ jsx("div", { className: "flex flex-1 flex-col overflow-hidden px-8 py-2", children: /* @__PURE__ */ jsxs("div", { className: "flex flex-1 flex-col gap-4 overflow-visible", children: [
42380
- /* @__PURE__ */ jsxs("div", { className: "mb-6 grid grid-cols-2 gap-2", children: [
42381
- /* @__PURE__ */ jsxs("div", { className: "grid gap-2", children: [
42382
- /* @__PURE__ */ jsx(Label$2, { className: "text-muted-foreground text-xs", children: "Name" }),
42383
- /* @__PURE__ */ jsx(
42384
- Input,
42385
- {
42386
- placeholder: "Segment name",
42387
- value: segment.name,
42388
- onChange: (e4) => setSegment({ ...segment, name: e4.target.value })
42389
- }
42390
- )
42391
- ] }),
42392
- /* @__PURE__ */ jsxs("div", { className: "grid gap-2", children: [
42393
- /* @__PURE__ */ jsx(Label$2, { className: "text-muted-foreground text-xs", children: "Description" }),
42394
- /* @__PURE__ */ jsx(
42395
- Input,
42396
- {
42397
- placeholder: "Segment description",
42398
- value: segment.description,
42399
- onChange: (e4) => setSegment({ ...segment, description: e4.target.value })
42400
- }
42401
- )
42402
- ] })
42403
- ] }),
42404
- segment.conditions.length > 0 && /* @__PURE__ */ jsx("div", { className: "flex-1 overflow-y-auto pb-8", children: /* @__PURE__ */ jsx("div", { className: "grid", children: /* @__PURE__ */ jsx(AnimatePresence, { mode: "popLayout", children: segment.conditions.map((condition, index2) => /* @__PURE__ */ jsxs(
42405
- motion.div,
43062
+ return /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsxs(AnimatePresence, { children: [
43063
+ /* @__PURE__ */ jsx(
43064
+ SegmentBuilderHeader,
43065
+ {
43066
+ segmentId,
43067
+ setOpen,
43068
+ setTextToSegment,
43069
+ promptBuilderStyle,
43070
+ textToSegment: textToSegment2
43071
+ },
43072
+ "segment-builder-header"
43073
+ ),
43074
+ promptBuilderStyle ? /* @__PURE__ */ jsx(BlurDiv, { children: /* @__PURE__ */ jsx(
43075
+ PromptBuilderStyle,
43076
+ {
43077
+ onSelectStyle: (style2) => {
43078
+ if (style2 === "ai") {
43079
+ setTextToSegment(true);
43080
+ }
43081
+ setPromptBuilderStyle(false);
43082
+ }
43083
+ }
43084
+ ) }, "prompt-builder-style") : /* @__PURE__ */ jsx(BlurDiv, { children: /* @__PURE__ */ jsxs("div", { className: "flex flex-1 flex-col overflow-hidden", children: [
43085
+ /* @__PURE__ */ jsx("div", { className: "flex flex-1 flex-col overflow-hidden px-8 py-2", children: /* @__PURE__ */ jsx("div", { className: "flex flex-1 flex-col gap-4 overflow-visible", children: /* @__PURE__ */ jsx(AnimatePresence, { children: textToSegment2 ? /* @__PURE__ */ jsx(BlurDiv, { children: /* @__PURE__ */ jsx(
43086
+ TextToSegment,
42406
43087
  {
42407
- initial: { opacity: 0, x: -20 },
42408
- animate: { opacity: 1, x: 0 },
42409
- exit: { opacity: 0, x: 20 },
42410
- transition: {
42411
- type: "spring",
42412
- stiffness: 300,
42413
- damping: 30,
42414
- mass: 0.5
42415
- },
42416
- children: [
42417
- index2 > 0 && /* @__PURE__ */ jsxs(
42418
- motion.div,
43088
+ setTextToSegment,
43089
+ setSegment: (conditions) => setSegment({ ...segment2, conditions })
43090
+ }
43091
+ ) }) : /* @__PURE__ */ jsxs(BlurDiv, { children: [
43092
+ /* @__PURE__ */ jsxs("div", { className: "mb-6 grid grid-cols-2 gap-2", children: [
43093
+ /* @__PURE__ */ jsxs("div", { className: "grid gap-2", children: [
43094
+ /* @__PURE__ */ jsx(Label$2, { className: "text-muted-foreground text-xs", children: "Name" }),
43095
+ /* @__PURE__ */ jsx(
43096
+ Input,
42419
43097
  {
42420
- className: "relative flex items-center gap-3 py-1",
42421
- initial: { opacity: 0 },
42422
- animate: { opacity: 1 },
42423
- transition: { delay: 0.1 },
42424
- children: [
42425
- /* @__PURE__ */ jsx(
42426
- motion.div,
42427
- {
42428
- className: "h-px flex-1 bg-border",
42429
- initial: { scaleX: 0 },
42430
- animate: { scaleX: 1 },
42431
- transition: {
42432
- type: "spring",
42433
- stiffness: 300,
42434
- damping: 30,
42435
- mass: 0.5
42436
- }
42437
- }
42438
- ),
42439
- /* @__PURE__ */ jsx(
42440
- motion.span,
42441
- {
42442
- className: "text-muted-foreground text-xs",
42443
- initial: { opacity: 0 },
42444
- animate: { opacity: 1 },
42445
- transition: { delay: 0.2 },
42446
- children: "AND"
42447
- }
42448
- ),
42449
- /* @__PURE__ */ jsx(
42450
- motion.div,
42451
- {
42452
- className: "h-px flex-1 bg-border",
42453
- initial: { scaleX: 0 },
42454
- animate: { scaleX: 1 },
42455
- transition: {
42456
- type: "spring",
42457
- stiffness: 300,
42458
- damping: 30,
42459
- mass: 0.5
42460
- }
42461
- }
42462
- )
42463
- ]
43098
+ placeholder: `${t("engage:segment")} name`,
43099
+ value: segment2.name,
43100
+ onChange: (e4) => setSegment({ ...segment2, name: e4.target.value })
42464
43101
  }
42465
- ),
43102
+ )
43103
+ ] }),
43104
+ /* @__PURE__ */ jsxs("div", { className: "grid gap-2", children: [
43105
+ /* @__PURE__ */ jsx(Label$2, { className: "text-muted-foreground text-xs", children: "Description" }),
42466
43106
  /* @__PURE__ */ jsx(
42467
- ConditionRow,
43107
+ Input,
42468
43108
  {
42469
- condition,
42470
- onUpdate: (condition2) => updateCondition(index2, condition2),
42471
- segmentsConditions,
42472
- onDuplicate: () => duplicateCondition(index2),
42473
- onDelete: () => deleteCondition(index2)
43109
+ placeholder: `${t("engage:segment")} description`,
43110
+ value: segment2.description,
43111
+ onChange: (e4) => setSegment({
43112
+ ...segment2,
43113
+ description: e4.target.value
43114
+ })
42474
43115
  }
42475
43116
  )
42476
- ]
42477
- },
42478
- index2
42479
- )) }) }) })
42480
- ] }) }),
42481
- /* @__PURE__ */ jsx("div", { className: "border-t px-8 py-4", children: /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between", children: [
42482
- /* @__PURE__ */ jsxs(Button$1, { variant: "secondary", onClick: addCondition, children: [
42483
- /* @__PURE__ */ jsx(Plus, { className: "h-4 w-4" }),
42484
- "Add Condition"
42485
- ] }),
42486
- /* @__PURE__ */ jsxs("div", { className: "flex gap-2", children: [
42487
- /* @__PURE__ */ jsx(Button$1, { variant: "secondary", onClick: () => setOpen(false), children: "Cancel" }),
42488
- /* @__PURE__ */ jsx(
42489
- Button$1,
43117
+ ] })
43118
+ ] }),
43119
+ segment2.conditions.length > 0 && /* @__PURE__ */ jsx("div", { className: "flex-1 overflow-y-auto pb-8", children: /* @__PURE__ */ jsx("div", { className: "grid", children: /* @__PURE__ */ jsx(AnimatePresence, { mode: "popLayout", children: segment2.conditions.map((condition, index2) => /* @__PURE__ */ jsxs(
43120
+ motion.div,
42490
43121
  {
42491
- variant: "secondary",
42492
- onClick: handleSave,
42493
- disabled: isLoading || isCreating,
42494
- children: isLoading || isCreating ? /* @__PURE__ */ jsxs(Fragment, { children: [
42495
- /* @__PURE__ */ jsx(LoaderCircle, { className: "mr-2 h-4 w-4 animate-spin" }),
42496
- segmentId ? "Updating..." : "Creating..."
42497
- ] }) : segmentId ? "Update" : "Create"
42498
- }
42499
- )
42500
- ] })
42501
- ] }) })
42502
- ] });
43122
+ initial: { opacity: 0, x: -20 },
43123
+ animate: { opacity: 1, x: 0 },
43124
+ exit: { opacity: 0, x: 20 },
43125
+ transition: {
43126
+ type: "spring",
43127
+ stiffness: 300,
43128
+ damping: 30,
43129
+ mass: 0.5
43130
+ },
43131
+ children: [
43132
+ index2 > 0 && /* @__PURE__ */ jsxs(
43133
+ motion.div,
43134
+ {
43135
+ className: "relative flex items-center gap-3 py-1",
43136
+ initial: { opacity: 0 },
43137
+ animate: { opacity: 1 },
43138
+ transition: { delay: 0.1 },
43139
+ children: [
43140
+ /* @__PURE__ */ jsx(
43141
+ motion.div,
43142
+ {
43143
+ className: "h-px flex-1 bg-border",
43144
+ initial: { scaleX: 0 },
43145
+ animate: { scaleX: 1 },
43146
+ transition: {
43147
+ type: "spring",
43148
+ stiffness: 300,
43149
+ damping: 30,
43150
+ mass: 0.5
43151
+ }
43152
+ }
43153
+ ),
43154
+ /* @__PURE__ */ jsx(
43155
+ motion.span,
43156
+ {
43157
+ className: "text-muted-foreground text-xs",
43158
+ initial: { opacity: 0 },
43159
+ animate: { opacity: 1 },
43160
+ transition: { delay: 0.2 },
43161
+ children: "AND"
43162
+ }
43163
+ ),
43164
+ /* @__PURE__ */ jsx(
43165
+ motion.div,
43166
+ {
43167
+ className: "h-px flex-1 bg-border",
43168
+ initial: { scaleX: 0 },
43169
+ animate: { scaleX: 1 },
43170
+ transition: {
43171
+ type: "spring",
43172
+ stiffness: 300,
43173
+ damping: 30,
43174
+ mass: 0.5
43175
+ }
43176
+ }
43177
+ )
43178
+ ]
43179
+ }
43180
+ ),
43181
+ /* @__PURE__ */ jsx(
43182
+ ConditionRow,
43183
+ {
43184
+ condition,
43185
+ onUpdate: (condition2) => updateCondition(index2, condition2),
43186
+ segmentsConditions,
43187
+ onDuplicate: () => duplicateCondition(index2),
43188
+ onDelete: () => deleteCondition(index2)
43189
+ }
43190
+ )
43191
+ ]
43192
+ },
43193
+ index2
43194
+ )) }) }) })
43195
+ ] }) }) }) }),
43196
+ /* @__PURE__ */ jsx("div", { className: "border-t px-8 py-4", children: /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between", children: [
43197
+ /* @__PURE__ */ jsxs(Button$1, { variant: "secondary", onClick: addCondition, children: [
43198
+ /* @__PURE__ */ jsx(Plus, { className: "h-4 w-4" }),
43199
+ "Add Condition"
43200
+ ] }),
43201
+ /* @__PURE__ */ jsxs("div", { className: "flex gap-2", children: [
43202
+ /* @__PURE__ */ jsx(Button$1, { variant: "secondary", onClick: () => setOpen(false), children: "Cancel" }),
43203
+ /* @__PURE__ */ jsx(
43204
+ Button$1,
43205
+ {
43206
+ variant: "secondary",
43207
+ onClick: handleSave,
43208
+ disabled: isLoading || isCreating,
43209
+ children: isLoading || isCreating ? /* @__PURE__ */ jsxs(Fragment, { children: [
43210
+ /* @__PURE__ */ jsx(LoaderCircle, { className: "mr-2 h-4 w-4 animate-spin" }),
43211
+ segmentId ? "Updating..." : "Creating..."
43212
+ ] }) : segmentId ? "Update" : "Create"
43213
+ }
43214
+ )
43215
+ ] })
43216
+ ] }) })
43217
+ ] }) }, "manual-builder-style")
43218
+ ] }) });
42503
43219
  }
42504
43220
  function SegmentBuilderDialog({
42505
43221
  open,
@@ -42517,20 +43233,17 @@ function SegmentBuilderDialog({
42517
43233
  className: "flex max-h-[86vh] flex-col gap-0 overflow-visible max-w-5xl w-full",
42518
43234
  hideCloseButton: true,
42519
43235
  children: [
42520
- /* @__PURE__ */ jsx(DialogHeader, { className: "", children: /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between", children: [
42521
- /* @__PURE__ */ jsx(DialogTitle, { className: "text-3xl font-normal", children: segmentId ? "Edit Segment" : "Create Segment" }),
42522
- /* @__PURE__ */ jsx(VisuallyHidden$1, { children: /* @__PURE__ */ jsx(DialogDescription, { children: segmentId ? "Edit Segment" : "Create Segment" }) }),
42523
- /* @__PURE__ */ jsx(
42524
- Button$1,
42525
- {
42526
- variant: "ghost",
42527
- size: "icon",
42528
- onClick: () => setOpen(false),
42529
- className: "h-8 w-8",
42530
- children: /* @__PURE__ */ jsx(X$1, { className: "h-4 w-4" })
42531
- }
42532
- )
42533
- ] }) }),
43236
+ /* @__PURE__ */ jsxs(VisuallyHidden$1, { children: [
43237
+ /* @__PURE__ */ jsxs(DialogTitle, { children: [
43238
+ t("engage:segment"),
43239
+ " Builder"
43240
+ ] }),
43241
+ /* @__PURE__ */ jsxs(DialogDescription, { children: [
43242
+ "Build a ",
43243
+ t("engage:segment"),
43244
+ " to target your audience"
43245
+ ] })
43246
+ ] }),
42534
43247
  /* @__PURE__ */ jsx(
42535
43248
  SegmentBuilder,
42536
43249
  {
@@ -42592,7 +43305,8 @@ const AllSegmentList = () => {
42592
43305
  onClick: () => setCreateNewSegmentDialogOpen(true),
42593
43306
  children: [
42594
43307
  /* @__PURE__ */ jsx(Plus, {}),
42595
- "Create New Segment"
43308
+ "Create New ",
43309
+ t("engage:segment")
42596
43310
  ]
42597
43311
  }
42598
43312
  ) })
@@ -42649,8 +43363,8 @@ const AllSegmentList = () => {
42649
43363
  title: "No Segments Found",
42650
43364
  description: "Create your first segment to get started."
42651
43365
  },
42652
- onRowClick: (segment) => {
42653
- if (segment.type !== BusinessSegmentTypeEnum.CUSTOM) {
43366
+ onRowClick: (segment2) => {
43367
+ if (segment2.type !== BusinessSegmentTypeEnum.CUSTOM) {
42654
43368
  toast2({
42655
43369
  title: "This segment is not editable",
42656
43370
  description: "Only custom segments can be edited",
@@ -42658,7 +43372,7 @@ const AllSegmentList = () => {
42658
43372
  });
42659
43373
  return;
42660
43374
  }
42661
- setSelectedSegment(segment.id);
43375
+ setSelectedSegment(segment2.id);
42662
43376
  setCreateNewSegmentDialogOpen(true);
42663
43377
  },
42664
43378
  className: "rounded-lg bg-white"
@@ -42680,7 +43394,7 @@ const EngageMain = ({
42680
43394
  const tabs = [
42681
43395
  {
42682
43396
  id: "automations",
42683
- label: "Automations",
43397
+ label: `${t("engage:automation", { count: 2 })}`,
42684
43398
  content: /* @__PURE__ */ jsx(
42685
43399
  AllAutomationList,
42686
43400
  {
@@ -42691,7 +43405,7 @@ const EngageMain = ({
42691
43405
  },
42692
43406
  {
42693
43407
  id: "segments",
42694
- label: "Segments",
43408
+ label: `${t("engage:segment", { count: 2 })}`,
42695
43409
  content: /* @__PURE__ */ jsx(AllSegmentList, {})
42696
43410
  }
42697
43411
  ];
@@ -42778,7 +43492,7 @@ var AutomationSteps = /* @__PURE__ */ ((AutomationSteps2) => {
42778
43492
  return AutomationSteps2;
42779
43493
  })(AutomationSteps || {});
42780
43494
  const validateAutomationStep = async (args) => {
42781
- const { currentStep, automation, communicationGroup } = args;
43495
+ const { currentStep, automation: automation2, communicationGroup } = args;
42782
43496
  if (currentStep === 0) {
42783
43497
  return {
42784
43498
  canMove: true,
@@ -42787,12 +43501,12 @@ const validateAutomationStep = async (args) => {
42787
43501
  }
42788
43502
  if (currentStep === 1) {
42789
43503
  return {
42790
- canMove: automation.includeSegmentIds.length > 0,
43504
+ canMove: automation2.includeSegmentIds.length > 0,
42791
43505
  errorMessage: "Please ensure you have selected at least one segment"
42792
43506
  };
42793
43507
  }
42794
43508
  if (currentStep === 2) {
42795
- const actionDataCommunication = automation.action_data?.find(
43509
+ const actionDataCommunication = automation2.action_data?.find(
42796
43510
  (action) => action.action_type === "send_communication"
42797
43511
  );
42798
43512
  if (!actionDataCommunication) {
@@ -42827,7 +43541,7 @@ const validateAutomationStep = async (args) => {
42827
43541
  if (currentStep === 3) {
42828
43542
  return {
42829
43543
  canMove: Boolean(
42830
- isOneTimeTriggerMetadata(automation.trigger_metadata) && automation.trigger_metadata.scheduled_at && new Date(automation.trigger_metadata.scheduled_at) > /* @__PURE__ */ new Date() && automation.action_data?.some(
43544
+ isOneTimeTriggerMetadata(automation2.trigger_metadata) && automation2.trigger_metadata.scheduled_at && new Date(automation2.trigger_metadata.scheduled_at) > /* @__PURE__ */ new Date() && automation2.action_data?.some(
42831
43545
  (action) => action.action_type === "send_communication" && action.action_metadata.communication_group_id
42832
43546
  )
42833
43547
  ),
@@ -42839,17 +43553,17 @@ const validateAutomationStep = async (args) => {
42839
43553
  errorMessage: null
42840
43554
  };
42841
43555
  };
42842
- const useRecipientStats = (automation) => {
43556
+ const useRecipientStats = (automation2) => {
42843
43557
  const { data: estimatedMatches } = useGetCountOfBusinessAutomationRecipients({
42844
- include_segments: automation?.includeSegmentIds ?? [],
42845
- exclude_segments: automation?.excludeSegmentIds ?? []
43558
+ include_segments: automation2?.includeSegmentIds ?? [],
43559
+ exclude_segments: automation2?.excludeSegmentIds ?? []
42846
43560
  });
42847
43561
  const estimatedMatchesStats = useMemo(() => {
42848
43562
  if (!estimatedMatches?.recipients) return { emails: 0, phones: 0 };
42849
43563
  return estimatedMatches.recipients.reduce(
42850
- (acc, user) => ({
42851
- emails: acc.emails + (user.email ? 1 : 0),
42852
- phones: acc.phones + (user.phone ? 1 : 0)
43564
+ (acc, user2) => ({
43565
+ emails: acc.emails + (user2.email ? 1 : 0),
43566
+ phones: acc.phones + (user2.phone ? 1 : 0)
42853
43567
  }),
42854
43568
  { emails: 0, phones: 0 }
42855
43569
  );
@@ -42867,14 +43581,14 @@ const useAutomation = (automationId, existingAutomation) => {
42867
43581
  isLoading: isFetchLoading,
42868
43582
  invalidateAutomation: originalInvalidateAutomation
42869
43583
  } = useGetBusinessAutomation(automationId);
42870
- const automation = fetchedAutomation;
43584
+ const automation2 = fetchedAutomation;
42871
43585
  const { updateAutomation: updateAutomation2, isUpdating } = useUpdateBusinessAutomation(automationId);
42872
- const communicationGroupId = automation?.action_data?.find(
43586
+ const communicationGroupId = automation2?.action_data?.find(
42873
43587
  (action) => action.action_type === "send_communication"
42874
43588
  )?.action_metadata.communication_group_id;
42875
43589
  const { communicationGroup, isGetting: isLoadingCommunicationGroup } = useGetCommunicationGroup(communicationGroupId || void 0);
42876
43590
  const { updateCommunicationGroup: updateCommunicationGroup2, isUpdating: isUpdatingCommunicationGroup } = useUpdateCommunicationGroup();
42877
- const { estimatedMatchesStats } = useRecipientStats(automation);
43591
+ const { estimatedMatchesStats } = useRecipientStats(automation2);
42878
43592
  const [isValidatingStep, setIsValidatingStep] = useState(false);
42879
43593
  const [isLoading, setIsLoading] = useState(false);
42880
43594
  const invalidateAutomation = useCallback(() => {
@@ -42900,7 +43614,7 @@ const useAutomation = (automationId, existingAutomation) => {
42900
43614
  }, []);
42901
43615
  const validateStep = useCallback(
42902
43616
  async (currentStep) => {
42903
- if (!automation) {
43617
+ if (!automation2) {
42904
43618
  return {
42905
43619
  canMove: false,
42906
43620
  errorMessage: "Automation not loaded"
@@ -42910,7 +43624,7 @@ const useAutomation = (automationId, existingAutomation) => {
42910
43624
  setIsValidatingStep(true);
42911
43625
  return await validateAutomationStep({
42912
43626
  currentStep,
42913
- automation,
43627
+ automation: automation2,
42914
43628
  communicationGroup
42915
43629
  });
42916
43630
  } finally {
@@ -42919,7 +43633,7 @@ const useAutomation = (automationId, existingAutomation) => {
42919
43633
  }
42920
43634
  }
42921
43635
  },
42922
- [automation, communicationGroup]
43636
+ [automation2, communicationGroup]
42923
43637
  );
42924
43638
  const setIsLoadingSafe = useCallback((loading2) => {
42925
43639
  if (mountedRef.current) {
@@ -42927,7 +43641,7 @@ const useAutomation = (automationId, existingAutomation) => {
42927
43641
  }
42928
43642
  }, []);
42929
43643
  return {
42930
- automation,
43644
+ automation: automation2,
42931
43645
  updateAutomation: updateAutomation2,
42932
43646
  communicationGroup,
42933
43647
  updateCommunicationGroup: updateCommunicationGroup2,
@@ -43173,7 +43887,7 @@ const PreviewPanel = ({ emailPreview, smsPreview, iconDefinitions }) => {
43173
43887
  }
43174
43888
  )
43175
43889
  ] }),
43176
- /* @__PURE__ */ jsx("div", { className: "p-6", children: /* @__PURE__ */ jsxs(AnimatePresence, { mode: "wait", children: [
43890
+ /* @__PURE__ */ jsx("div", { className: "p-6", children: /* @__PURE__ */ jsxs(AnimatePresence, { children: [
43177
43891
  selectedTab === "email" && emailPreview && /* @__PURE__ */ jsx(
43178
43892
  motion.div,
43179
43893
  {
@@ -43316,7 +44030,7 @@ const AutomationContent = ({
43316
44030
  const AutomationRecipients = ({
43317
44031
  automationId,
43318
44032
  iconDefinitions,
43319
- automation,
44033
+ automation: automation2,
43320
44034
  isLoading: isLoadingRecipients
43321
44035
  }) => {
43322
44036
  const { recipients, isLoading, fetchError } = useGetBusinessAutomationRecipients(automationId);
@@ -43348,7 +44062,7 @@ const AutomationRecipients = ({
43348
44062
  {
43349
44063
  automationId,
43350
44064
  iconDefinitions,
43351
- automation
44065
+ automation: automation2
43352
44066
  }
43353
44067
  ) }),
43354
44068
  /* @__PURE__ */ jsx(Separator$2, { className: "my-4" }),
@@ -45212,7 +45926,7 @@ const initStripo = (options) => {
45212
45926
  });
45213
45927
  };
45214
45928
  const StripoWrapper = ({
45215
- automation,
45929
+ automation: automation2,
45216
45930
  setShowStripoEditor,
45217
45931
  saveClicked,
45218
45932
  setSaveClicked,
@@ -45223,7 +45937,7 @@ const StripoWrapper = ({
45223
45937
  const stripoOpenedOnce = useRef(false);
45224
45938
  const containerRef = useRef(null);
45225
45939
  const { data: template2, isLoading: isTemplateLoading } = useStripoTemplate(
45226
- automation.id
45940
+ automation2.id
45227
45941
  );
45228
45942
  const { data: editorData, isLoading: isEditorDataLoading } = useStripoEditorData();
45229
45943
  const [stripoEmailSaved, setStripoEmailSaved] = useState(false);
@@ -45320,7 +46034,7 @@ const StripoWrapper = ({
45320
46034
  ) });
45321
46035
  };
45322
46036
  const EmailPreview = ({
45323
- automation,
46037
+ automation: automation2,
45324
46038
  mergeFieldsResponse,
45325
46039
  communicationGroup,
45326
46040
  updateCommunicationGroup: updateCommunicationGroup2
@@ -45346,7 +46060,7 @@ const EmailPreview = ({
45346
46060
  null
45347
46061
  );
45348
46062
  const { refetchAutomation: refreshAutomation } = useGetBusinessAutomation(
45349
- automation.id
46063
+ automation2.id
45350
46064
  );
45351
46065
  const [showHelpDialog, setShowHelpDialog] = useState(false);
45352
46066
  const initialRenderRef = useRef(true);
@@ -45597,7 +46311,7 @@ const EmailPreview = ({
45597
46311
  StripoWrapper,
45598
46312
  {
45599
46313
  showStripoEditor,
45600
- automation,
46314
+ automation: automation2,
45601
46315
  setShowStripoEditor,
45602
46316
  saveClicked,
45603
46317
  setSaveClicked,
@@ -45983,14 +46697,14 @@ const useMe = () => {
45983
46697
  });
45984
46698
  return query;
45985
46699
  };
45986
- const SMSPreview = ({ automation, iconDefinitions, mergeFieldsResponse }) => {
46700
+ const SMSPreview = ({ automation: automation2, iconDefinitions, mergeFieldsResponse }) => {
45987
46701
  const [isUpdating, setIsUpdating] = useState(false);
45988
46702
  const _getCommunicationGroupFromAutomation = useCallback(() => {
45989
- const actionGroup = automation.action_data?.find(
46703
+ const actionGroup = automation2.action_data?.find(
45990
46704
  (action) => action.action_type === "send_communication"
45991
46705
  );
45992
46706
  return actionGroup?.action_metadata.communication_group_id;
45993
- }, [automation.action_data]);
46707
+ }, [automation2.action_data]);
45994
46708
  const [mergeFieldValue, setMergeFieldValue] = useState("");
45995
46709
  const [fromNumber, setFromNumber] = useState(null);
45996
46710
  const [initCompanyName, setInitCompanyName] = useState(false);
@@ -46205,7 +46919,7 @@ ${message2}` : message2
46205
46919
  ] });
46206
46920
  };
46207
46921
  const EditCampaignContent = ({
46208
- automation,
46922
+ automation: automation2,
46209
46923
  iconDefinitions,
46210
46924
  getExtraMergeFields,
46211
46925
  communicationGroup,
@@ -46247,7 +46961,7 @@ const EditCampaignContent = ({
46247
46961
  setExpandedChannels(["email"]);
46248
46962
  return;
46249
46963
  }
46250
- }, [automation, communicationGroup]);
46964
+ }, [automation2, communicationGroup]);
46251
46965
  const setSelectedChannelsBasedOnCommunicationGroup = useCallback(
46252
46966
  (data) => {
46253
46967
  const finalSelectedChannels = [];
@@ -46416,7 +47130,7 @@ const EditCampaignContent = ({
46416
47130
  /* @__PURE__ */ jsx(
46417
47131
  EmailPreview,
46418
47132
  {
46419
- automation,
47133
+ automation: automation2,
46420
47134
  iconDefinitions,
46421
47135
  updateAutomation: updateAutomation2,
46422
47136
  communicationGroup,
@@ -46432,7 +47146,7 @@ const EditCampaignContent = ({
46432
47146
  /* @__PURE__ */ jsx(
46433
47147
  SMSPreview,
46434
47148
  {
46435
- automation,
47149
+ automation: automation2,
46436
47150
  iconDefinitions,
46437
47151
  mergeFieldsResponse
46438
47152
  }
@@ -46518,9 +47232,9 @@ const EstimatedMatchesView = ({
46518
47232
  const contactStats = React__default.useMemo(() => {
46519
47233
  if (!data?.recipients) return { emails: 0, phones: 0 };
46520
47234
  return data.recipients.reduce(
46521
- (acc, user) => ({
46522
- emails: acc.emails + (user.email ? 1 : 0),
46523
- phones: acc.phones + (user.phone ? 1 : 0)
47235
+ (acc, user2) => ({
47236
+ emails: acc.emails + (user2.email ? 1 : 0),
47237
+ phones: acc.phones + (user2.phone ? 1 : 0)
46524
47238
  }),
46525
47239
  { emails: 0, phones: 0 }
46526
47240
  );
@@ -46687,10 +47401,10 @@ const ComboboxDemo = ({
46687
47401
  ] }) })
46688
47402
  ] });
46689
47403
  };
46690
- const OneTimeBroadcastMetadata = ({ automation }) => {
47404
+ const OneTimeBroadcastMetadata = ({ automation: automation2 }) => {
46691
47405
  const _getDateFromAutomation = () => {
46692
- if (isOneTimeTriggerMetadata(automation.trigger_metadata) && automation.trigger_metadata.scheduled_at) {
46693
- return new Date(automation.trigger_metadata.scheduled_at);
47406
+ if (isOneTimeTriggerMetadata(automation2.trigger_metadata) && automation2.trigger_metadata.scheduled_at) {
47407
+ return new Date(automation2.trigger_metadata.scheduled_at);
46694
47408
  }
46695
47409
  return addMinutes(/* @__PURE__ */ new Date(), 15);
46696
47410
  };
@@ -46699,9 +47413,9 @@ const OneTimeBroadcastMetadata = ({ automation }) => {
46699
47413
  _getDateFromAutomation() < /* @__PURE__ */ new Date() ? "Please select a time in the future" : null
46700
47414
  );
46701
47415
  const [timeInput, setTimeInput] = React.useState(format$1(date2, "HH:mm"));
46702
- const { updateAutomation: updateAutomation2 } = useUpdateBusinessAutomation(automation.id);
47416
+ const { updateAutomation: updateAutomation2 } = useUpdateBusinessAutomation(automation2.id);
46703
47417
  const [timezone, setTimezone] = React.useState(
46704
- isOneTimeTriggerMetadata(automation.trigger_metadata) && automation.trigger_metadata.timezone ? automation.trigger_metadata.timezone : Intl.DateTimeFormat().resolvedOptions().timeZone
47418
+ isOneTimeTriggerMetadata(automation2.trigger_metadata) && automation2.trigger_metadata.timezone ? automation2.trigger_metadata.timezone : Intl.DateTimeFormat().resolvedOptions().timeZone
46705
47419
  );
46706
47420
  const timezones = Intl.supportedValuesOf("timeZone");
46707
47421
  const timezoneOptions = timezones.map((tz) => ({
@@ -46770,7 +47484,7 @@ const OneTimeBroadcastMetadata = ({ automation }) => {
46770
47484
  timezone
46771
47485
  }
46772
47486
  });
46773
- }, [date2, timezone, updateAutomation2, automation.id]);
47487
+ }, [date2, timezone, updateAutomation2, automation2.id]);
46774
47488
  return /* @__PURE__ */ jsxs("div", { className: "flex flex-col items-center justify-center h-full", children: [
46775
47489
  /* @__PURE__ */ jsxs("div", { className: "flex flex-col sm:flex-row gap-2 w-full ", children: [
46776
47490
  /* @__PURE__ */ jsxs(Popover, { children: [
@@ -46834,7 +47548,7 @@ const OneTimeBroadcastMetadata = ({ automation }) => {
46834
47548
  ] })
46835
47549
  ] });
46836
47550
  };
46837
- const SelectTime = ({ iconDefinitions, automation, updateAutomation: updateAutomation2 }) => {
47551
+ const SelectTime = ({ iconDefinitions, automation: automation2, updateAutomation: updateAutomation2 }) => {
46838
47552
  const [deliveryOption, setDeliveryOption] = useState(null);
46839
47553
  return /* @__PURE__ */ jsx("div", { className: "@container", children: /* @__PURE__ */ jsx(
46840
47554
  motion.div,
@@ -46885,11 +47599,11 @@ const SelectTime = ({ iconDefinitions, automation, updateAutomation: updateAutom
46885
47599
  exit: { opacity: 0, height: 0 },
46886
47600
  transition: { duration: 0.3 },
46887
47601
  className: "overflow-hidden mt-8",
46888
- children: /* @__PURE__ */ jsx("div", { className: "bg-gray-50 rounded-xl p-5 border border-gray-100 flex items-center justify-center", children: /* @__PURE__ */ jsx(OneTimeBroadcastMetadata, { automation }) })
47602
+ children: /* @__PURE__ */ jsx("div", { className: "bg-gray-50 rounded-xl p-5 border border-gray-100 flex items-center justify-center", children: /* @__PURE__ */ jsx(OneTimeBroadcastMetadata, { automation: automation2 }) })
46889
47603
  }
46890
47604
  ) })
46891
47605
  ] }),
46892
- isOneTimeTriggerMetadata(automation.trigger_metadata) && automation.trigger_metadata.scheduled_at && /* @__PURE__ */ jsxs(
47606
+ isOneTimeTriggerMetadata(automation2.trigger_metadata) && automation2.trigger_metadata.scheduled_at && /* @__PURE__ */ jsxs(
46893
47607
  motion.div,
46894
47608
  {
46895
47609
  initial: { opacity: 0, y: 10, scale: 0.98 },
@@ -46919,7 +47633,7 @@ const SelectTime = ({ iconDefinitions, automation, updateAutomation: updateAutom
46919
47633
  transition: { delay: 0.4, duration: 0.4 },
46920
47634
  className: "text-md font-bold text-gray-800",
46921
47635
  children: new Date(
46922
- automation.trigger_metadata.scheduled_at
47636
+ automation2.trigger_metadata.scheduled_at
46923
47637
  ).toLocaleString("en-US", {
46924
47638
  weekday: "long",
46925
47639
  month: "long",
@@ -46929,7 +47643,7 @@ const SelectTime = ({ iconDefinitions, automation, updateAutomation: updateAutom
46929
47643
  minute: "2-digit",
46930
47644
  hour12: true,
46931
47645
  timeZoneName: "short",
46932
- timeZone: automation.trigger_metadata.timezone || void 0
47646
+ timeZone: automation2.trigger_metadata.timezone || void 0
46933
47647
  })
46934
47648
  }
46935
47649
  )
@@ -46941,13 +47655,13 @@ const SelectTime = ({ iconDefinitions, automation, updateAutomation: updateAutom
46941
47655
  ) });
46942
47656
  };
46943
47657
  const PreviewAndSchedule = ({
46944
- automation,
47658
+ automation: automation2,
46945
47659
  iconDefinitions,
46946
47660
  isLoading,
46947
47661
  communicationGroup,
46948
47662
  updateAutomation: externalUpdateAutomation
46949
47663
  }) => {
46950
- const { updateAutomation: businessUpdateAutomation } = useUpdateBusinessAutomation(automation.id);
47664
+ const { updateAutomation: businessUpdateAutomation } = useUpdateBusinessAutomation(automation2.id);
46951
47665
  const updateAutomation2 = externalUpdateAutomation || ((params) => businessUpdateAutomation(params));
46952
47666
  const { channelSenders } = useChannelSender();
46953
47667
  const { channelAccounts } = useChannelAccount();
@@ -47033,15 +47747,15 @@ const PreviewAndSchedule = ({
47033
47747
  {
47034
47748
  subtitle: "Estimated recipient count may vary at time of delivery",
47035
47749
  iconDefinitions,
47036
- includeSegments: automation.includeSegmentIds,
47037
- excludeSegments: automation.excludeSegmentIds
47750
+ includeSegments: automation2.includeSegmentIds,
47751
+ excludeSegments: automation2.excludeSegmentIds
47038
47752
  }
47039
47753
  )
47040
47754
  ] }),
47041
- automation.trigger_type === AutomationTriggerType.ONE_TIME && /* @__PURE__ */ jsx(Card, { className: "p-4 shadow-sm border-none mt-4", children: /* @__PURE__ */ jsx(
47755
+ automation2.trigger_type === AutomationTriggerType.ONE_TIME && /* @__PURE__ */ jsx(Card, { className: "p-4 shadow-sm border-none mt-4", children: /* @__PURE__ */ jsx(
47042
47756
  SelectTime,
47043
47757
  {
47044
- automation,
47758
+ automation: automation2,
47045
47759
  iconDefinitions,
47046
47760
  updateAutomation: updateAutomation2
47047
47761
  }
@@ -47059,7 +47773,7 @@ const AllOrSelectSegmentPicker = ({ iconDefinitions, onSelectionChange, defaultV
47059
47773
  BigSelector,
47060
47774
  {
47061
47775
  onClick: () => handleSelect("all"),
47062
- title: "All patrons",
47776
+ title: `All ${t("engage:user", { count: 2 })}`,
47063
47777
  subtitle: "Send to everyone",
47064
47778
  icon: /* @__PURE__ */ jsx(iconDefinitions.UsersIcon, { className: "w-5 h-5 mb-2 text-gray-600" }),
47065
47779
  selected: selected === "all"
@@ -47069,7 +47783,7 @@ const AllOrSelectSegmentPicker = ({ iconDefinitions, onSelectionChange, defaultV
47069
47783
  BigSelector,
47070
47784
  {
47071
47785
  onClick: () => handleSelect("segments"),
47072
- title: "Select patrons",
47786
+ title: `Select ${t("engage:user", { count: 2 })}`,
47073
47787
  subtitle: "Choose from segments",
47074
47788
  icon: /* @__PURE__ */ jsx(iconDefinitions.UserEdit, { className: "w-5 h-5 mb-2 text-gray-600" }),
47075
47789
  selected: selected === "segments"
@@ -47092,9 +47806,9 @@ const SegmentSection = ({
47092
47806
  segmentsToRemove.forEach(onRemoveSegment);
47093
47807
  };
47094
47808
  const [segmentSelectedIds, setSegmentSelectedIds] = useState([]);
47095
- const options = allSegments.map((segment) => ({
47096
- label: segment.name,
47097
- value: segment.id
47809
+ const options = allSegments.map((segment2) => ({
47810
+ label: segment2.name,
47811
+ value: segment2.id
47098
47812
  }));
47099
47813
  useEffect(() => {
47100
47814
  setSegmentSelectedIds(segments);
@@ -47197,22 +47911,22 @@ const SelectSegments = ({
47197
47911
  ] })
47198
47912
  ] });
47199
47913
  };
47200
- const SelectAudience = ({ iconDefinitions, automation }) => {
47914
+ const SelectAudience = ({ iconDefinitions, automation: automation2 }) => {
47201
47915
  const [openCreateSegmentDialog, setOpenCreateSegmentDialog] = React__default.useState(false);
47202
47916
  const [initialStateSet, setInitialStateSet] = React__default.useState(false);
47203
47917
  const { segments, isLoading } = useListSegments();
47204
- const { updateAutomation: updateAutomation2 } = useUpdateBusinessAutomation(automation.id);
47918
+ const { updateAutomation: updateAutomation2 } = useUpdateBusinessAutomation(automation2.id);
47205
47919
  const [includedSegments, setIncludedSegments] = React__default.useState(
47206
- automation.includeSegmentIds || []
47920
+ automation2.includeSegmentIds || []
47207
47921
  );
47208
47922
  const [excludedSegments, setExcludedSegments] = React__default.useState(
47209
- automation.excludeSegmentIds || []
47923
+ automation2.excludeSegmentIds || []
47210
47924
  );
47211
47925
  const allUsersSelected = includedSegments.length === 1 && excludedSegments.length === 0 && /**
47212
47926
  * Check if the all users segment is selected in the atuomation
47213
47927
  */
47214
47928
  segments?.data?.find(
47215
- (segment) => segment.type === BusinessSegmentTypeEnum.ALL_USERS && segment.id === includedSegments[0]
47929
+ (segment2) => segment2.type === BusinessSegmentTypeEnum.ALL_USERS && segment2.id === includedSegments[0]
47216
47930
  ) !== void 0;
47217
47931
  const [selectedAudience, setSelectedAudience] = useState(
47218
47932
  allUsersSelected ? "all" : "segments"
@@ -47232,7 +47946,7 @@ const SelectAudience = ({ iconDefinitions, automation }) => {
47232
47946
  }
47233
47947
  };
47234
47948
  useEffect(() => {
47235
- const hasSegmentsChanged = JSON.stringify(automation.includeSegmentIds) !== JSON.stringify(includedSegments) || JSON.stringify(automation.excludeSegmentIds) !== JSON.stringify(excludedSegments);
47949
+ const hasSegmentsChanged = JSON.stringify(automation2.includeSegmentIds) !== JSON.stringify(includedSegments) || JSON.stringify(automation2.excludeSegmentIds) !== JSON.stringify(excludedSegments);
47236
47950
  if (hasSegmentsChanged) {
47237
47951
  updateAutomation2({
47238
47952
  include_segments: includedSegments,
@@ -47242,14 +47956,14 @@ const SelectAudience = ({ iconDefinitions, automation }) => {
47242
47956
  }, [
47243
47957
  includedSegments,
47244
47958
  excludedSegments,
47245
- automation.includeSegmentIds,
47246
- automation.excludeSegmentIds,
47959
+ automation2.includeSegmentIds,
47960
+ automation2.excludeSegmentIds,
47247
47961
  updateAutomation2,
47248
- automation.id
47962
+ automation2.id
47249
47963
  ]);
47250
47964
  const getAllUsersSegment = useCallback(() => {
47251
47965
  return segments?.data?.find(
47252
- (segment) => segment.type === BusinessSegmentTypeEnum.ALL_USERS
47966
+ (segment2) => segment2.type === BusinessSegmentTypeEnum.ALL_USERS
47253
47967
  );
47254
47968
  }, [segments]);
47255
47969
  useEffect(() => {
@@ -47268,7 +47982,7 @@ const SelectAudience = ({ iconDefinitions, automation }) => {
47268
47982
  if (!segments) {
47269
47983
  return;
47270
47984
  }
47271
- if (automation.includeSegmentIds.length === 0 && automation.excludeSegmentIds.length === 0) {
47985
+ if (automation2.includeSegmentIds.length === 0 && automation2.excludeSegmentIds.length === 0) {
47272
47986
  setSelectedAudience("all");
47273
47987
  const allUsersSegment = getAllUsersSegment();
47274
47988
  if (allUsersSegment) {
@@ -47295,9 +48009,9 @@ const SelectAudience = ({ iconDefinitions, automation }) => {
47295
48009
  allUsersSelected,
47296
48010
  getAllUsersSegment,
47297
48011
  updateAutomation2,
47298
- automation.includeSegmentIds,
47299
- automation.excludeSegmentIds,
47300
- automation.id
48012
+ automation2.includeSegmentIds,
48013
+ automation2.excludeSegmentIds,
48014
+ automation2.id
47301
48015
  ]);
47302
48016
  if (isLoading || !segments || !initialStateSet) {
47303
48017
  return /* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsx(SpinLoader, { text: ["Fetching segments", "Finishing up"] }) });
@@ -47341,7 +48055,7 @@ const SelectAudience = ({ iconDefinitions, automation }) => {
47341
48055
  defaultValue: selectedAudience
47342
48056
  }
47343
48057
  ),
47344
- /* @__PURE__ */ jsx(AnimatePresence, { mode: "wait", children: selectedAudience === "segments" && /* @__PURE__ */ jsx(
48058
+ /* @__PURE__ */ jsx(AnimatePresence, { children: selectedAudience === "segments" && /* @__PURE__ */ jsx(
47345
48059
  motion.div,
47346
48060
  {
47347
48061
  initial: { opacity: 0, height: 0 },
@@ -47359,7 +48073,7 @@ const SelectAudience = ({ iconDefinitions, automation }) => {
47359
48073
  handleRemoveSegment,
47360
48074
  setOpenCreateSegmentDialog,
47361
48075
  segments,
47362
- defaultIsExcludeOpen: automation.excludeSegmentIds?.length > 0
48076
+ defaultIsExcludeOpen: automation2.excludeSegmentIds?.length > 0
47363
48077
  }
47364
48078
  )
47365
48079
  }
@@ -47430,14 +48144,14 @@ const lineVariant = {
47430
48144
  }
47431
48145
  }
47432
48146
  };
47433
- const TriggerEditAutomation = ({ automation }) => {
48147
+ const TriggerEditAutomation = ({ automation: automation2 }) => {
47434
48148
  const [getSegmentResponse, setGetSegmentResponse] = useState(void 0);
47435
48149
  useEffect(() => {
47436
48150
  const getSegmentData = async () => {
47437
- if (automation.trigger_metadata.trigger_type !== AutomationTriggerType.TRIGGER_BASED) {
48151
+ if (automation2.trigger_metadata.trigger_type !== AutomationTriggerType.TRIGGER_BASED) {
47438
48152
  return;
47439
48153
  }
47440
- const triggerSegmentId = automation.trigger_metadata.event_filter.segment_id;
48154
+ const triggerSegmentId = automation2.trigger_metadata.event_filter.segment_id;
47441
48155
  const segmentResponse = await getSegment(triggerSegmentId);
47442
48156
  if (!segmentResponse) {
47443
48157
  return;
@@ -47445,7 +48159,7 @@ const TriggerEditAutomation = ({ automation }) => {
47445
48159
  setGetSegmentResponse(segmentResponse);
47446
48160
  };
47447
48161
  getSegmentData();
47448
- }, [automation.trigger_metadata, automation.trigger_metadata.trigger_type]);
48162
+ }, [automation2.trigger_metadata, automation2.trigger_metadata.trigger_type]);
47449
48163
  if (!getSegmentResponse) {
47450
48164
  return /* @__PURE__ */ jsx("div", { className: "flex items-center justify-center min-h-[200px]", children: /* @__PURE__ */ jsx(SpinLoader, {}) });
47451
48165
  }
@@ -47536,7 +48250,7 @@ const TriggerEditAutomation = ({ automation }) => {
47536
48250
  ) });
47537
48251
  };
47538
48252
  const useAutomationSteps = ({
47539
- automation,
48253
+ automation: automation2,
47540
48254
  updateAutomation: updateAutomation2,
47541
48255
  communicationGroup,
47542
48256
  updateCommunicationGroup: updateCommunicationGroup2,
@@ -47545,9 +48259,9 @@ const useAutomationSteps = ({
47545
48259
  handleSaveAsDraft,
47546
48260
  isLoading
47547
48261
  }) => {
47548
- if (!automation) return [];
48262
+ if (!automation2) return [];
47549
48263
  return [
47550
- ...automation.trigger_type === AutomationTriggerType.TRIGGER_BASED ? [
48264
+ ...automation2.trigger_type === AutomationTriggerType.TRIGGER_BASED ? [
47551
48265
  {
47552
48266
  id: "trigger",
47553
48267
  title: "Trigger",
@@ -47561,7 +48275,7 @@ const useAutomationSteps = ({
47561
48275
  TriggerEditAutomation,
47562
48276
  {
47563
48277
  iconDefinitions,
47564
- automation
48278
+ automation: automation2
47565
48279
  }
47566
48280
  )
47567
48281
  }
@@ -47580,7 +48294,7 @@ const useAutomationSteps = ({
47580
48294
  title: "Audience",
47581
48295
  step: AutomationSteps.SelectAudience,
47582
48296
  isValid: () => {
47583
- return automation.includeSegmentIds.length > 0;
48297
+ return automation2.includeSegmentIds.length > 0;
47584
48298
  },
47585
48299
  content: /* @__PURE__ */ jsx(
47586
48300
  TitleAndContent,
@@ -47590,7 +48304,7 @@ const useAutomationSteps = ({
47590
48304
  SelectAudience,
47591
48305
  {
47592
48306
  iconDefinitions,
47593
- automation
48307
+ automation: automation2
47594
48308
  }
47595
48309
  )
47596
48310
  }
@@ -47601,7 +48315,7 @@ const useAutomationSteps = ({
47601
48315
  /**
47602
48316
  * We dont show the back button for one_time_based automations
47603
48317
  */
47604
- hideBack: automation.trigger_type === AutomationTriggerType.ONE_TIME ? true : false,
48318
+ hideBack: automation2.trigger_type === AutomationTriggerType.ONE_TIME ? true : false,
47605
48319
  backDisabled: false,
47606
48320
  nextDisabled: () => false
47607
48321
  }
@@ -47611,7 +48325,7 @@ const useAutomationSteps = ({
47611
48325
  title: "Content",
47612
48326
  step: AutomationSteps.SelectCommunication,
47613
48327
  isValid: () => {
47614
- const actionDataCommunication = automation.action_data?.find(
48328
+ const actionDataCommunication = automation2.action_data?.find(
47615
48329
  (action) => action.action_type === "send_communication"
47616
48330
  );
47617
48331
  if (!actionDataCommunication || !actionDataCommunication.action_metadata.communication_group_id) {
@@ -47633,7 +48347,7 @@ const useAutomationSteps = ({
47633
48347
  /* @__PURE__ */ jsx(
47634
48348
  EditCampaignContent,
47635
48349
  {
47636
- automation,
48350
+ automation: automation2,
47637
48351
  updateAutomation: updateAutomation2,
47638
48352
  communicationGroup,
47639
48353
  updateCommunicationGroup: updateCommunicationGroup2,
@@ -47656,7 +48370,7 @@ const useAutomationSteps = ({
47656
48370
  step: AutomationSteps.PreviewAndSchedule,
47657
48371
  isValid: () => {
47658
48372
  return Boolean(
47659
- automation.trigger_metadata?.trigger_type === AutomationTriggerType.ONE_TIME && automation.trigger_metadata?.scheduled_at && new Date(automation.trigger_metadata.scheduled_at) > /* @__PURE__ */ new Date() && automation.action_data?.some(
48373
+ automation2.trigger_metadata?.trigger_type === AutomationTriggerType.ONE_TIME && automation2.trigger_metadata?.scheduled_at && new Date(automation2.trigger_metadata.scheduled_at) > /* @__PURE__ */ new Date() && automation2.action_data?.some(
47660
48374
  (action) => action.action_type === "send_communication" && action.action_metadata.communication_group_id
47661
48375
  )
47662
48376
  );
@@ -47669,7 +48383,7 @@ const useAutomationSteps = ({
47669
48383
  content: /* @__PURE__ */ jsx(
47670
48384
  PreviewAndSchedule,
47671
48385
  {
47672
- automation,
48386
+ automation: automation2,
47673
48387
  iconDefinitions,
47674
48388
  isLoading,
47675
48389
  communicationGroup
@@ -47679,12 +48393,12 @@ const useAutomationSteps = ({
47679
48393
  ),
47680
48394
  footerConfig: {
47681
48395
  backText: "Back",
47682
- nextText: automation.trigger_metadata?.trigger_type === AutomationTriggerType.ONE_TIME ? "Schedule" : "Start",
48396
+ nextText: automation2.trigger_metadata?.trigger_type === AutomationTriggerType.ONE_TIME ? "Schedule" : "Start",
47683
48397
  hideBack: false,
47684
48398
  backDisabled: false,
47685
48399
  nextDisabled: () => {
47686
- return automation.trigger_metadata?.trigger_type === AutomationTriggerType.ONE_TIME && !(automation.trigger_metadata?.scheduled_at && new Date(automation.trigger_metadata?.scheduled_at) > /* @__PURE__ */ new Date() && Boolean(
47687
- automation.action_data?.some(
48400
+ return automation2.trigger_metadata?.trigger_type === AutomationTriggerType.ONE_TIME && !(automation2.trigger_metadata?.scheduled_at && new Date(automation2.trigger_metadata?.scheduled_at) > /* @__PURE__ */ new Date() && Boolean(
48401
+ automation2.action_data?.some(
47688
48402
  (action) => action.action_type === "send_communication" && action.action_metadata.communication_group_id
47689
48403
  )
47690
48404
  ));
@@ -47751,7 +48465,7 @@ const BackNextButtonGroup = ({
47751
48465
  ] });
47752
48466
  };
47753
48467
  const EditAutomation = ({
47754
- automation,
48468
+ automation: automation2,
47755
48469
  updateAutomation: updateAutomation2,
47756
48470
  communicationGroup,
47757
48471
  updateCommunicationGroup: updateCommunicationGroup2,
@@ -47770,7 +48484,7 @@ const EditAutomation = ({
47770
48484
  /**
47771
48485
  * We dont show the trigger step for trigger based automations
47772
48486
  */
47773
- automation.trigger_type === AutomationTriggerType.TRIGGER_BASED ? AutomationSteps.SelectTrigger : AutomationSteps.SelectAudience
48487
+ automation2.trigger_type === AutomationTriggerType.TRIGGER_BASED ? AutomationSteps.SelectTrigger : AutomationSteps.SelectAudience
47774
48488
  );
47775
48489
  const [isValidatingStep, setIsValidatingStep] = useState(false);
47776
48490
  const handleSaveAsDraft = () => {
@@ -47786,7 +48500,7 @@ const EditAutomation = ({
47786
48500
  setIsLoading(false);
47787
48501
  };
47788
48502
  const STEPS = useAutomationSteps({
47789
- automation,
48503
+ automation: automation2,
47790
48504
  iconDefinitions,
47791
48505
  getExtraMergeFields,
47792
48506
  handleSaveAsDraft,
@@ -47842,7 +48556,7 @@ const EditAutomation = ({
47842
48556
  const handleNextStep = async () => {
47843
48557
  const { canMove, errorMessage } = await validateCanGoToNextStep({
47844
48558
  currentStep,
47845
- automation,
48559
+ automation: automation2,
47846
48560
  communicationGroup
47847
48561
  });
47848
48562
  if (!canMove) {
@@ -47873,7 +48587,7 @@ const EditAutomation = ({
47873
48587
  for (let step = currentStep; step < targetStep; step++) {
47874
48588
  const { canMove, errorMessage } = await validateCanGoToNextStep({
47875
48589
  currentStep: step,
47876
- automation,
48590
+ automation: automation2,
47877
48591
  communicationGroup
47878
48592
  });
47879
48593
  if (!canMove) {
@@ -47896,19 +48610,19 @@ const EditAutomation = ({
47896
48610
  }
47897
48611
  ),
47898
48612
  logoUrl && /* @__PURE__ */ jsx("div", { className: "flex-shrink-0", children: /* @__PURE__ */ jsx("img", { src: logoUrl, alt: "Logo", className: "w-6 h-6" }) }),
47899
- /* @__PURE__ */ jsx("h1", { className: "text-xl font-bold leading-none", children: automation.name }),
48613
+ /* @__PURE__ */ jsx("h1", { className: "text-xl font-bold leading-none", children: automation2.name }),
47900
48614
  /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-4", children: [
47901
48615
  /* @__PURE__ */ jsx(
47902
48616
  Badge,
47903
48617
  {
47904
- variant: automation.status === AutomationStatus.ACTIVE ? "default" : automation.status === AutomationStatus.DRAFT ? "secondary" : "outline",
47905
- children: automation.status === AutomationStatus.ACTIVE ? "Active" : automation.status === AutomationStatus.DRAFT ? "Draft" : "Inactive"
48618
+ variant: automation2.status === AutomationStatus.ACTIVE ? "default" : automation2.status === AutomationStatus.DRAFT ? "secondary" : "outline",
48619
+ children: automation2.status === AutomationStatus.ACTIVE ? "Active" : automation2.status === AutomationStatus.DRAFT ? "Draft" : "Inactive"
47906
48620
  }
47907
48621
  ),
47908
48622
  /* @__PURE__ */ jsxs("span", { className: "text-xs text-gray-500", children: [
47909
48623
  "Last modified",
47910
48624
  " ",
47911
- automation?.updated_at ? formatDistanceToNow(new Date(automation.updated_at)) + " ago" : "N/A"
48625
+ automation2?.updated_at ? formatDistanceToNow(new Date(automation2.updated_at)) + " ago" : "N/A"
47912
48626
  ] })
47913
48627
  ] })
47914
48628
  ] });
@@ -47951,7 +48665,7 @@ const EditAutomation = ({
47951
48665
  },
47952
48666
  step.step
47953
48667
  )) });
47954
- 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: "absolute overflow-y-auto top-0 left-0 right-0 bottom-0 flex-1 h-full flex-col flex", children: /* @__PURE__ */ jsx(AnimatePresence, { mode: "wait", children: /* @__PURE__ */ jsx(BlurDiv, { className: "pt-0 h-full", children: STEPS.find((step) => step.step === currentStep)?.content }, currentStep) }) }) });
48668
+ 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: "absolute overflow-y-auto top-0 left-0 right-0 bottom-0 flex-1 h-full flex-col flex", children: /* @__PURE__ */ jsx(AnimatePresence, { children: /* @__PURE__ */ jsx(BlurDiv, { className: "pt-0 h-full", children: STEPS.find((step) => step.step === currentStep)?.content }, currentStep) }) }) });
47955
48669
  const renderFooter = () => /* @__PURE__ */ jsx("footer", { className: "w-full flex justify-end shadow-md z-10 items-center h-16 px-6", children: /* @__PURE__ */ jsx(
47956
48670
  BackNextButtonGroup,
47957
48671
  {
@@ -48003,14 +48717,14 @@ const validatePhoneNumber = (phoneNumber) => {
48003
48717
  const PhoneUtils = {
48004
48718
  validatePhoneNumber
48005
48719
  };
48006
- const SendPreviewPopup = ({ automation, type, setOpenSendPreviewPopup, iconDefinitions }) => {
48720
+ const SendPreviewPopup = ({ automation: automation2, type, setOpenSendPreviewPopup, iconDefinitions }) => {
48007
48721
  const [recipient, setRecipient] = useState("");
48008
48722
  const [error2, setError2] = useState("");
48009
48723
  const [senderId, setSenderId] = useState(null);
48010
48724
  const [finishedLoading, setFinishedLoading] = useState(false);
48011
48725
  const { sendTestCommunication: sendTestCommunication2, sendError, isSendSuccess } = useSendTestCommunication();
48012
48726
  const { toast: toast2 } = useToast();
48013
- const actionDataCommunication = automation.action_data?.find(
48727
+ const actionDataCommunication = automation2.action_data?.find(
48014
48728
  (action) => action.action_type === "send_communication"
48015
48729
  );
48016
48730
  const communicationGroupId = actionDataCommunication?.action_metadata.communication_group_id;
@@ -48082,7 +48796,7 @@ const SendPreviewPopup = ({ automation, type, setOpenSendPreviewPopup, iconDefin
48082
48796
  setError2("No sender found, please update the automation first!");
48083
48797
  return;
48084
48798
  }
48085
- const actionDataCommunication2 = automation.action_data?.find(
48799
+ const actionDataCommunication2 = automation2.action_data?.find(
48086
48800
  (action) => action.action_type === "send_communication"
48087
48801
  );
48088
48802
  const communicationGroupId2 = actionDataCommunication2?.action_metadata.communication_group_id;
@@ -48135,7 +48849,7 @@ const SendPreviewPopup = ({ automation, type, setOpenSendPreviewPopup, iconDefin
48135
48849
  ] });
48136
48850
  };
48137
48851
  const ViewAutomationHeaderContainer = ({
48138
- automation,
48852
+ automation: automation2,
48139
48853
  updateAutomation: updateAutomation2,
48140
48854
  communicationGroup,
48141
48855
  updateCommunicationGroup: updateCommunicationGroup2,
@@ -48186,7 +48900,7 @@ const ViewAutomationHeaderContainer = ({
48186
48900
  };
48187
48901
  const handleDuplicateAutomation = async () => {
48188
48902
  const { id: duplicatedId } = await duplicateBusinessAutomation(
48189
- automation.id
48903
+ automation2.id
48190
48904
  );
48191
48905
  if (!duplicatedId) {
48192
48906
  toast2({
@@ -48224,7 +48938,7 @@ const ViewAutomationHeaderContainer = ({
48224
48938
  /* @__PURE__ */ jsx(
48225
48939
  EditAutomation,
48226
48940
  {
48227
- automation,
48941
+ automation: automation2,
48228
48942
  updateAutomation: updateAutomation2,
48229
48943
  communicationGroup,
48230
48944
  updateCommunicationGroup: updateCommunicationGroup2,
@@ -48279,7 +48993,7 @@ const ViewAutomationHeaderContainer = ({
48279
48993
  /* @__PURE__ */ jsx(
48280
48994
  SendPreviewPopup,
48281
48995
  {
48282
- automation,
48996
+ automation: automation2,
48283
48997
  type: "sms",
48284
48998
  setOpenSendPreviewPopup: setOpenSendPreviewSmsPopup,
48285
48999
  iconDefinitions: mergedIconDefinitions
@@ -48301,7 +49015,7 @@ const ViewAutomationHeaderContainer = ({
48301
49015
  /* @__PURE__ */ jsx(
48302
49016
  SendPreviewPopup,
48303
49017
  {
48304
- automation,
49018
+ automation: automation2,
48305
49019
  type: "email",
48306
49020
  setOpenSendPreviewPopup: setOpenSendPreviewEmailPopup,
48307
49021
  iconDefinitions: mergedIconDefinitions
@@ -48318,12 +49032,15 @@ const ViewAutomationHeaderContainer = ({
48318
49032
  /* @__PURE__ */ jsxs("div", { children: [
48319
49033
  /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
48320
49034
  /* @__PURE__ */ jsxs("h1", { className: "text-2xl font-semibold mb-1", children: [
48321
- automation.name,
49035
+ automation2.name,
48322
49036
  " "
48323
49037
  ] }),
48324
- /* @__PURE__ */ jsx(StatusBadge, { status: automation.status })
49038
+ /* @__PURE__ */ jsx(StatusBadge, { status: automation2.status })
48325
49039
  ] }),
48326
- /* @__PURE__ */ jsx("div", { className: "text-sm text-gray-600", children: "View and edit this email campaign" })
49040
+ /* @__PURE__ */ jsxs("div", { className: "text-sm text-gray-600", children: [
49041
+ "View and edit this ",
49042
+ t("engage:automation")
49043
+ ] })
48327
49044
  ] }),
48328
49045
  renderActionsMenu()
48329
49046
  ] });
@@ -48333,9 +49050,9 @@ const ViewAutomationHeaderContainer = ({
48333
49050
  /* @__PURE__ */ jsx(mergedIconDefinitions.DropdownMenuTrigger, { className: "ml-2 h-4 w-4" })
48334
49051
  ] }) }),
48335
49052
  /* @__PURE__ */ jsxs(DropdownMenuContent, { children: [
48336
- automation.status === AutomationStatus.DRAFT && /* @__PURE__ */ jsx(DropdownMenuItem, { onClick: () => setOpenEditAutomationPopup(true), children: "Edit" }),
48337
- automation.status === AutomationStatus.ACTIVE && /* @__PURE__ */ jsx(DropdownMenuItem, { onClick: convertToDraft, children: "Convert to Draft" }),
48338
- automation.status !== AutomationStatus.COMPLETED && automation.status !== AutomationStatus.FAILED && automation.status !== AutomationStatus.DEACTIVATED && /* @__PURE__ */ jsx(
49053
+ automation2.status === AutomationStatus.DRAFT && /* @__PURE__ */ jsx(DropdownMenuItem, { onClick: () => setOpenEditAutomationPopup(true), children: "Edit" }),
49054
+ automation2.status === AutomationStatus.ACTIVE && /* @__PURE__ */ jsx(DropdownMenuItem, { onClick: convertToDraft, children: "Convert to Draft" }),
49055
+ automation2.status !== AutomationStatus.COMPLETED && automation2.status !== AutomationStatus.FAILED && automation2.status !== AutomationStatus.DEACTIVATED && /* @__PURE__ */ jsx(
48339
49056
  DropdownMenuItem,
48340
49057
  {
48341
49058
  onClick: () => setCancelAutomationConfirmationPopup(true),
@@ -48350,29 +49067,29 @@ const ViewAutomationHeaderContainer = ({
48350
49067
  const renderAutomationDetails = () => /* @__PURE__ */ jsx("div", { className: "@container", children: /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-1 @[750px]:grid-cols-2 gap-6", children: [
48351
49068
  /* @__PURE__ */ jsxs("div", { className: "", children: [
48352
49069
  /* @__PURE__ */ jsx("div", { className: "text-sm text-muted-foreground", children: "Name" }),
48353
- /* @__PURE__ */ jsx("div", { className: "font-medium truncate", children: automation.name })
49070
+ /* @__PURE__ */ jsx("div", { className: "font-medium truncate", children: automation2.name })
48354
49071
  ] }),
48355
- automation.description && /* @__PURE__ */ jsxs("div", { className: "", children: [
49072
+ automation2.description && /* @__PURE__ */ jsxs("div", { className: "", children: [
48356
49073
  /* @__PURE__ */ jsx("div", { className: "text-sm text-muted-foreground", children: "Description" }),
48357
- /* @__PURE__ */ jsx("div", { className: "font-medium whitespace-pre-wrap", children: automation.description })
49074
+ /* @__PURE__ */ jsx("div", { className: "font-medium whitespace-pre-wrap", children: automation2.description })
48358
49075
  ] }),
48359
49076
  /* @__PURE__ */ jsxs("div", { children: [
48360
49077
  /* @__PURE__ */ jsx("div", { className: "text-sm text-muted-foreground", children: "Date Created" }),
48361
- /* @__PURE__ */ jsx("div", { className: "font-medium", children: format$1(new Date(automation.created_at), "h:mma MM/dd/yy") })
49078
+ /* @__PURE__ */ jsx("div", { className: "font-medium", children: format$1(new Date(automation2.created_at), "h:mma MM/dd/yy") })
48362
49079
  ] }),
48363
- automation.trigger_type === AutomationTriggerType.ONE_TIME && isOneTimeTriggerMetadata(automation.trigger_metadata) && /* @__PURE__ */ jsxs("div", { children: [
49080
+ automation2.trigger_type === AutomationTriggerType.ONE_TIME && isOneTimeTriggerMetadata(automation2.trigger_metadata) && /* @__PURE__ */ jsxs("div", { children: [
48364
49081
  /* @__PURE__ */ jsx("div", { className: "text-sm text-muted-foreground", children: "Type" }),
48365
49082
  /* @__PURE__ */ jsx("div", { className: "font-medium", children: "One Time" })
48366
49083
  ] }),
48367
- automation.trigger_type === AutomationTriggerType.TRIGGER_BASED && isTriggerBasedTriggerMetadata(automation.trigger_metadata) && /* @__PURE__ */ jsxs("div", { children: [
49084
+ automation2.trigger_type === AutomationTriggerType.TRIGGER_BASED && isTriggerBasedTriggerMetadata(automation2.trigger_metadata) && /* @__PURE__ */ jsxs("div", { children: [
48368
49085
  /* @__PURE__ */ jsx("div", { className: "text-sm text-muted-foreground", children: "Type" }),
48369
49086
  /* @__PURE__ */ jsx("div", { className: "font-medium", children: "Trigger Based" })
48370
49087
  ] }),
48371
49088
  /* @__PURE__ */ jsx("div", { className: "col-span-1 @[400px]:col-span-2", children: /* @__PURE__ */ jsx("div", { className: "border-t border-gray-200" }) }),
48372
- automation.trigger_type === AutomationTriggerType.ONE_TIME && isOneTimeTriggerMetadata(automation.trigger_metadata) && automation.trigger_metadata.scheduled_at && /* @__PURE__ */ jsxs("div", { children: [
49089
+ automation2.trigger_type === AutomationTriggerType.ONE_TIME && isOneTimeTriggerMetadata(automation2.trigger_metadata) && automation2.trigger_metadata.scheduled_at && /* @__PURE__ */ jsxs("div", { children: [
48373
49090
  /* @__PURE__ */ jsx("div", { className: "text-sm text-gray-600", children: "Scheduled For" }),
48374
49091
  /* @__PURE__ */ jsx("div", { className: "font-medium", children: format$1(
48375
- new Date(automation.trigger_metadata.scheduled_at),
49092
+ new Date(automation2.trigger_metadata.scheduled_at),
48376
49093
  "h:mma MM/dd/yy"
48377
49094
  ) })
48378
49095
  ] })
@@ -48408,7 +49125,7 @@ const ViewAutomationContent = ({
48408
49125
  const shouldAutoOpenEditPopup = autoOpenEditPopup || searchParams.get("autoOpenEditPopup");
48409
49126
  const shouldShowBackButton = searchParams.get("showBackButton") === "true" || showBackButton;
48410
49127
  const {
48411
- automation,
49128
+ automation: automation2,
48412
49129
  updateAutomation: updateAutomation2,
48413
49130
  communicationGroup,
48414
49131
  updateCommunicationGroup: updateCommunicationGroup2,
@@ -48418,14 +49135,14 @@ const ViewAutomationContent = ({
48418
49135
  validateStep,
48419
49136
  estimatedMatchesStats
48420
49137
  } = useAutomation(effectiveAutomationId);
48421
- if (!automation || !communicationGroup) {
49138
+ if (!automation2 || !communicationGroup) {
48422
49139
  return /* @__PURE__ */ jsx("div", { className: "flex h-screen items-center justify-center", children: /* @__PURE__ */ jsx(SpinLoader, { text: ["Fetching Automation data", "Finishing up"] }) });
48423
49140
  }
48424
49141
  return /* @__PURE__ */ jsxs("div", { className: "bg-background", children: [
48425
49142
  /* @__PURE__ */ jsx(
48426
49143
  ViewAutomationHeader,
48427
49144
  {
48428
- automation,
49145
+ automation: automation2,
48429
49146
  updateAutomation: updateAutomation2,
48430
49147
  communicationGroup,
48431
49148
  updateCommunicationGroup: updateCommunicationGroup2,
@@ -48465,9 +49182,9 @@ const ViewAutomationContent = ({
48465
49182
  content: /* @__PURE__ */ jsx(
48466
49183
  AutomationRecipients,
48467
49184
  {
48468
- automationId: automation.id,
49185
+ automationId: automation2.id,
48469
49186
  iconDefinitions: finalIconDefinitions,
48470
- automation,
49187
+ automation: automation2,
48471
49188
  isLoading
48472
49189
  }
48473
49190
  )