@embedreach/components 0.3.39 → 0.3.41

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.
@@ -31555,6 +31555,7 @@ const statusDraft = "reach-styles-module__statusDraft___3BUrD";
31555
31555
  const statusDeactivated = "reach-styles-module__statusDeactivated___xVw1N";
31556
31556
  const statusFailed = "reach-styles-module__statusFailed___VQiDA";
31557
31557
  const statusRunning = "reach-styles-module__statusRunning___1iEjx";
31558
+ const statusSending = "reach-styles-module__statusSending___ZPEvQ";
31558
31559
  const statusScheduled = "reach-styles-module__statusScheduled___jsdbl";
31559
31560
  const statusQueued = "reach-styles-module__statusQueued___lYgbS";
31560
31561
  const statusPartiallyCancelled = "reach-styles-module__statusPartiallyCancelled___yLZUc";
@@ -31585,6 +31586,7 @@ const styles$6 = {
31585
31586
  statusDeactivated,
31586
31587
  statusFailed,
31587
31588
  statusRunning,
31589
+ statusSending,
31588
31590
  statusScheduled,
31589
31591
  statusQueued,
31590
31592
  statusPartiallyCancelled,
@@ -31611,6 +31613,7 @@ const badgeVariants = cva([styles$6.base], {
31611
31613
  statusDeactivated: styles$6.statusDeactivated,
31612
31614
  statusFailed: styles$6.statusFailed,
31613
31615
  statusRunning: styles$6.statusRunning,
31616
+ statusSending: styles$6.statusSending,
31614
31617
  segmentAllUsers: styles$6.segmentAllUsers,
31615
31618
  segmentManaged: styles$6.segmentManaged,
31616
31619
  segmentCustom: styles$6.segmentCustom,
@@ -32048,6 +32051,22 @@ const useDirectFeedbackEnabled = () => {
32048
32051
  const reputationConfig = partner?.feature_customizations?.reputation;
32049
32052
  return reputationConfig?.directFeedbackEnabled ?? true;
32050
32053
  };
32054
+ const useSmsEnabled = () => {
32055
+ const { config } = useConfig();
32056
+ const { data: partner } = usePartner$1();
32057
+ const mergedConfig = mergeFeatureConfig(
32058
+ {
32059
+ hideFeature: config.hideFeature,
32060
+ enableFeature: config.enableFeature
32061
+ },
32062
+ {
32063
+ hideFeature: partner?.feature_customizations?.hideFeature,
32064
+ enableFeature: partner?.feature_customizations?.enableFeature
32065
+ }
32066
+ );
32067
+ const isHidden2 = mergedConfig.hideFeature?.engage?.sms;
32068
+ return !isHidden2;
32069
+ };
32051
32070
  const ReputationMethodologyDialogContent = () => {
32052
32071
  const isDirectFeedbackEnabled = useDirectFeedbackEnabled();
32053
32072
  const containerVariants = {
@@ -35768,6 +35787,7 @@ var SmsRegistrationApplicationStatus = /* @__PURE__ */ ((SmsRegistrationApplicat
35768
35787
  SmsRegistrationApplicationStatus2["IN_REVIEW"] = "in_review";
35769
35788
  SmsRegistrationApplicationStatus2["APPROVED"] = "approved";
35770
35789
  SmsRegistrationApplicationStatus2["REJECTED"] = "rejected";
35790
+ SmsRegistrationApplicationStatus2["ARCHIVED"] = "archived";
35771
35791
  return SmsRegistrationApplicationStatus2;
35772
35792
  })(SmsRegistrationApplicationStatus || {});
35773
35793
  const getSmsChannelSenders = (args) => {
@@ -37291,9 +37311,10 @@ const useAutomationSelection = () => {
37291
37311
  },
37292
37312
  onError: (error2) => {
37293
37313
  console.error("Error updating automations:", error2);
37314
+ const errorMessage = error2 instanceof Error ? error2.message : "Please try again.";
37294
37315
  toast2({
37295
37316
  title: "Error updating automations",
37296
- description: "Please try again.",
37317
+ description: errorMessage,
37297
37318
  variant: "destructive"
37298
37319
  });
37299
37320
  }
@@ -65961,6 +65982,7 @@ const measure$1 = {
65961
65982
  columns: {
65962
65983
  campaign: "Campaign",
65963
65984
  client: "Client",
65985
+ keyword: "Keyword",
65964
65986
  first_marketing_click_date: "First Marketing Click Date",
65965
65987
  source: "Source",
65966
65988
  total_amount: "Total Amount"
@@ -66816,6 +66838,7 @@ const measure = {
66816
66838
  columns: {
66817
66839
  campaign: "Campaña",
66818
66840
  client: "Cliente",
66841
+ keyword: "Palabra clave",
66819
66842
  first_marketing_click_date: "Fecha del primer clic de marketing",
66820
66843
  source: "Fuente",
66821
66844
  total_amount: "Cantidad total"
@@ -67759,6 +67782,7 @@ const defaultTranslations = {
67759
67782
  columns: {
67760
67783
  campaign: "Campaign",
67761
67784
  client: "Client",
67785
+ keyword: "Keyword",
67762
67786
  first_marketing_click_date: "First Marketing Click Date",
67763
67787
  source: "Source",
67764
67788
  total_amount: "Total Amount"
@@ -69623,39 +69647,448 @@ const previewSegmentRecipients = async (params) => {
69623
69647
  pagination: result.data.pagination
69624
69648
  };
69625
69649
  };
69626
- var JSONSchemaType = /* @__PURE__ */ ((JSONSchemaType2) => {
69650
+ var DateUnit;
69651
+ (function(DateUnit2) {
69652
+ DateUnit2["DAYS"] = "days";
69653
+ })(DateUnit || (DateUnit = {}));
69654
+ var RelativeDateDirection;
69655
+ (function(RelativeDateDirection2) {
69656
+ RelativeDateDirection2["BEFORE"] = "before";
69657
+ RelativeDateDirection2["AFTER"] = "after";
69658
+ })(RelativeDateDirection || (RelativeDateDirection = {}));
69659
+ const ConditionFieldEnum = z$2.enum([
69660
+ "userId",
69661
+ "email",
69662
+ "phone",
69663
+ "firstName",
69664
+ "lastName"
69665
+ ]);
69666
+ const sqlSegmentConditionSchema = z$2.object({
69667
+ sql_segment_id: z$2.string()
69668
+ });
69669
+ var ConditionOperatorEnumType;
69670
+ (function(ConditionOperatorEnumType2) {
69671
+ ConditionOperatorEnumType2["EQUALS"] = "equals";
69672
+ ConditionOperatorEnumType2["NOT_EQUALS"] = "not_equals";
69673
+ ConditionOperatorEnumType2["GREATER_THAN"] = "greater_than";
69674
+ ConditionOperatorEnumType2["LESS_THAN"] = "less_than";
69675
+ ConditionOperatorEnumType2["EXISTS"] = "exists";
69676
+ ConditionOperatorEnumType2["NOT_EXISTS"] = "not_exists";
69677
+ ConditionOperatorEnumType2["EQUALS_MONTH_DAY"] = "equals_month_day";
69678
+ ConditionOperatorEnumType2["EQUALS_MONTH_DAY_YEAR"] = "equals_month_day_year";
69679
+ ConditionOperatorEnumType2["BETWEEN_MONTH_DAY"] = "between_month_day";
69680
+ ConditionOperatorEnumType2["BETWEEN_MONTH_DAY_YEAR"] = "between_month_day_year";
69681
+ ConditionOperatorEnumType2["ARRAY_CONTAINS"] = "array_contains";
69682
+ })(ConditionOperatorEnumType || (ConditionOperatorEnumType = {}));
69683
+ const ConditionOperatorEnum = z$2.nativeEnum(ConditionOperatorEnumType);
69684
+ const relativeDateSchema = z$2.object({
69685
+ type: z$2.literal("relative"),
69686
+ value: z$2.number().describe("Number of days to add/subtract from today"),
69687
+ unit: z$2.nativeEnum(DateUnit),
69688
+ direction: z$2.nativeEnum(RelativeDateDirection)
69689
+ });
69690
+ const betweenDateSchema = z$2.object({
69691
+ startDate: z$2.union([z$2.coerce.date(), relativeDateSchema]),
69692
+ endDate: z$2.union([z$2.coerce.date(), relativeDateSchema])
69693
+ });
69694
+ const fieldConditionSchema = z$2.object({
69695
+ field: z$2.union([ConditionFieldEnum, z$2.string()]),
69696
+ value: z$2.array(z$2.union([
69697
+ z$2.string(),
69698
+ z$2.number(),
69699
+ z$2.boolean(),
69700
+ z$2.date(),
69701
+ relativeDateSchema,
69702
+ betweenDateSchema
69703
+ ])).describe("The value to compare the field against (string, number, boolean, date)"),
69704
+ operator: ConditionOperatorEnum
69705
+ });
69706
+ function isFieldCondition(condition) {
69707
+ return "field" in condition;
69708
+ }
69709
+ const ConditionSchema = z$2.union([
69710
+ fieldConditionSchema,
69711
+ sqlSegmentConditionSchema
69712
+ ]);
69713
+ z$2.array(fieldConditionSchema);
69714
+ z$2.array(ConditionSchema);
69715
+ var CurrencyCode;
69716
+ (function(CurrencyCode2) {
69717
+ CurrencyCode2["USD"] = "USD";
69718
+ CurrencyCode2["CAD"] = "CAD";
69719
+ CurrencyCode2["EUR"] = "EUR";
69720
+ CurrencyCode2["AED"] = "AED";
69721
+ CurrencyCode2["AFN"] = "AFN";
69722
+ CurrencyCode2["ALL"] = "ALL";
69723
+ CurrencyCode2["AMD"] = "AMD";
69724
+ CurrencyCode2["ARS"] = "ARS";
69725
+ CurrencyCode2["AUD"] = "AUD";
69726
+ CurrencyCode2["AZN"] = "AZN";
69727
+ CurrencyCode2["BAM"] = "BAM";
69728
+ CurrencyCode2["BDT"] = "BDT";
69729
+ CurrencyCode2["BGN"] = "BGN";
69730
+ CurrencyCode2["BHD"] = "BHD";
69731
+ CurrencyCode2["BIF"] = "BIF";
69732
+ CurrencyCode2["BND"] = "BND";
69733
+ CurrencyCode2["BOB"] = "BOB";
69734
+ CurrencyCode2["BRL"] = "BRL";
69735
+ CurrencyCode2["BWP"] = "BWP";
69736
+ CurrencyCode2["BYN"] = "BYN";
69737
+ CurrencyCode2["BZD"] = "BZD";
69738
+ CurrencyCode2["CDF"] = "CDF";
69739
+ CurrencyCode2["CHF"] = "CHF";
69740
+ CurrencyCode2["CLP"] = "CLP";
69741
+ CurrencyCode2["CNY"] = "CNY";
69742
+ CurrencyCode2["COP"] = "COP";
69743
+ CurrencyCode2["CRC"] = "CRC";
69744
+ CurrencyCode2["CVE"] = "CVE";
69745
+ CurrencyCode2["CZK"] = "CZK";
69746
+ CurrencyCode2["DJF"] = "DJF";
69747
+ CurrencyCode2["DKK"] = "DKK";
69748
+ CurrencyCode2["DOP"] = "DOP";
69749
+ CurrencyCode2["DZD"] = "DZD";
69750
+ CurrencyCode2["EEK"] = "EEK";
69751
+ CurrencyCode2["EGP"] = "EGP";
69752
+ CurrencyCode2["ERN"] = "ERN";
69753
+ CurrencyCode2["ETB"] = "ETB";
69754
+ CurrencyCode2["GBP"] = "GBP";
69755
+ CurrencyCode2["GEL"] = "GEL";
69756
+ CurrencyCode2["GHS"] = "GHS";
69757
+ CurrencyCode2["GNF"] = "GNF";
69758
+ CurrencyCode2["GTQ"] = "GTQ";
69759
+ CurrencyCode2["HKD"] = "HKD";
69760
+ CurrencyCode2["HNL"] = "HNL";
69761
+ CurrencyCode2["HRK"] = "HRK";
69762
+ CurrencyCode2["HUF"] = "HUF";
69763
+ CurrencyCode2["IDR"] = "IDR";
69764
+ CurrencyCode2["ILS"] = "ILS";
69765
+ CurrencyCode2["INR"] = "INR";
69766
+ CurrencyCode2["IQD"] = "IQD";
69767
+ CurrencyCode2["IRR"] = "IRR";
69768
+ CurrencyCode2["ISK"] = "ISK";
69769
+ CurrencyCode2["JMD"] = "JMD";
69770
+ CurrencyCode2["JOD"] = "JOD";
69771
+ CurrencyCode2["JPY"] = "JPY";
69772
+ CurrencyCode2["KES"] = "KES";
69773
+ CurrencyCode2["KHR"] = "KHR";
69774
+ CurrencyCode2["KMF"] = "KMF";
69775
+ CurrencyCode2["KRW"] = "KRW";
69776
+ CurrencyCode2["KWD"] = "KWD";
69777
+ CurrencyCode2["KZT"] = "KZT";
69778
+ CurrencyCode2["LBP"] = "LBP";
69779
+ CurrencyCode2["LKR"] = "LKR";
69780
+ CurrencyCode2["LTL"] = "LTL";
69781
+ CurrencyCode2["LVL"] = "LVL";
69782
+ CurrencyCode2["LYD"] = "LYD";
69783
+ CurrencyCode2["MAD"] = "MAD";
69784
+ CurrencyCode2["MDL"] = "MDL";
69785
+ CurrencyCode2["MGA"] = "MGA";
69786
+ CurrencyCode2["MKD"] = "MKD";
69787
+ CurrencyCode2["MMK"] = "MMK";
69788
+ CurrencyCode2["MOP"] = "MOP";
69789
+ CurrencyCode2["MUR"] = "MUR";
69790
+ CurrencyCode2["MXN"] = "MXN";
69791
+ CurrencyCode2["MYR"] = "MYR";
69792
+ CurrencyCode2["MZN"] = "MZN";
69793
+ CurrencyCode2["NAD"] = "NAD";
69794
+ CurrencyCode2["NGN"] = "NGN";
69795
+ CurrencyCode2["NIO"] = "NIO";
69796
+ CurrencyCode2["NOK"] = "NOK";
69797
+ CurrencyCode2["NPR"] = "NPR";
69798
+ CurrencyCode2["NZD"] = "NZD";
69799
+ CurrencyCode2["OMR"] = "OMR";
69800
+ CurrencyCode2["PAB"] = "PAB";
69801
+ CurrencyCode2["PEN"] = "PEN";
69802
+ CurrencyCode2["PHP"] = "PHP";
69803
+ CurrencyCode2["PKR"] = "PKR";
69804
+ CurrencyCode2["PLN"] = "PLN";
69805
+ CurrencyCode2["PYG"] = "PYG";
69806
+ CurrencyCode2["QAR"] = "QAR";
69807
+ CurrencyCode2["RON"] = "RON";
69808
+ CurrencyCode2["RSD"] = "RSD";
69809
+ CurrencyCode2["RUB"] = "RUB";
69810
+ CurrencyCode2["RWF"] = "RWF";
69811
+ CurrencyCode2["SAR"] = "SAR";
69812
+ CurrencyCode2["SDG"] = "SDG";
69813
+ CurrencyCode2["SEK"] = "SEK";
69814
+ CurrencyCode2["SGD"] = "SGD";
69815
+ CurrencyCode2["SOS"] = "SOS";
69816
+ CurrencyCode2["SYP"] = "SYP";
69817
+ CurrencyCode2["THB"] = "THB";
69818
+ CurrencyCode2["TND"] = "TND";
69819
+ CurrencyCode2["TOP"] = "TOP";
69820
+ CurrencyCode2["TRY"] = "TRY";
69821
+ CurrencyCode2["TTD"] = "TTD";
69822
+ CurrencyCode2["TWD"] = "TWD";
69823
+ CurrencyCode2["TZS"] = "TZS";
69824
+ CurrencyCode2["UAH"] = "UAH";
69825
+ CurrencyCode2["UGX"] = "UGX";
69826
+ CurrencyCode2["UYU"] = "UYU";
69827
+ CurrencyCode2["UZS"] = "UZS";
69828
+ CurrencyCode2["VEF"] = "VEF";
69829
+ CurrencyCode2["VND"] = "VND";
69830
+ CurrencyCode2["XAF"] = "XAF";
69831
+ CurrencyCode2["XOF"] = "XOF";
69832
+ CurrencyCode2["YER"] = "YER";
69833
+ CurrencyCode2["ZAR"] = "ZAR";
69834
+ CurrencyCode2["ZMK"] = "ZMK";
69835
+ CurrencyCode2["ZWL"] = "ZWL";
69836
+ })(CurrencyCode || (CurrencyCode = {}));
69837
+ const jsonLogicSchema = z$2.union([
69838
+ z$2.boolean(),
69839
+ z$2.string(),
69840
+ z$2.number(),
69841
+ z$2.null(),
69842
+ z$2.record(z$2.any()),
69843
+ z$2.array(z$2.any())
69844
+ ]);
69845
+ const schemaMappingEnum = z$2.enum([
69846
+ "contacts_schema",
69847
+ "transactions_schema",
69848
+ "custom_schema",
69849
+ "combined_schema",
69850
+ // this is a combined schema that contains both contacts and transactions data
69851
+ "locations_schema",
69852
+ /**
69853
+ * This is a schema that contains customer fields for a business (e.g. number of dogs owned, etc.)
69854
+ */
69855
+ "customer_fields"
69856
+ ]);
69857
+ var JSONSchemaType;
69858
+ (function(JSONSchemaType2) {
69627
69859
  JSONSchemaType2["String"] = "string";
69628
69860
  JSONSchemaType2["Number"] = "number";
69629
69861
  JSONSchemaType2["Integer"] = "integer";
69630
69862
  JSONSchemaType2["Boolean"] = "boolean";
69863
+ JSONSchemaType2["Array"] = "array";
69631
69864
  JSONSchemaType2["Date"] = "date";
69632
69865
  JSONSchemaType2["DateTime"] = "date-time";
69633
- JSONSchemaType2["Array"] = "array";
69634
69866
  JSONSchemaType2["ReachResource"] = "reach-resource";
69635
- return JSONSchemaType2;
69636
- })(JSONSchemaType || {});
69637
- var BusinessSegmentTypeEnum = /* @__PURE__ */ ((BusinessSegmentTypeEnum2) => {
69867
+ })(JSONSchemaType || (JSONSchemaType = {}));
69868
+ const contactStatusSchema = z$2.object({
69869
+ field: z$2.string(),
69870
+ activeValue: z$2.string(),
69871
+ deactivatedValue: z$2.string()
69872
+ });
69873
+ const contactSourceSchema = z$2.object({
69874
+ type: z$2.literal(schemaMappingEnum.enum.contacts_schema),
69875
+ schemaId: z$2.string().uuid("schemaID must be a UUID referencing a schema definition of type contacts_schema"),
69876
+ email: z$2.string().optional(),
69877
+ phone: z$2.string().optional(),
69878
+ userId: z$2.string().min(1, "User ID field is required"),
69879
+ firstName: z$2.string().optional(),
69880
+ lastName: z$2.string().optional(),
69881
+ fullName: z$2.string().optional(),
69882
+ location: z$2.string().optional(),
69883
+ status: contactStatusSchema.optional(),
69884
+ createdDate: z$2.string().min(1, "Created date field is required"),
69885
+ emailOptOut: z$2.string().optional(),
69886
+ emailOptIn: z$2.string().optional(),
69887
+ emailOptOutTimestamp: z$2.string().optional(),
69888
+ smsOptOut: z$2.string().optional(),
69889
+ smsOptIn: z$2.string().optional(),
69890
+ urlPattern: z$2.string().optional(),
69891
+ smsOptOutTimestamp: z$2.string().optional()
69892
+ }).refine((data) => {
69893
+ const hasFirstAndLast = data.firstName && data.lastName;
69894
+ const hasFullName = data.fullName;
69895
+ return hasFirstAndLast || hasFullName;
69896
+ }, {
69897
+ message: "Either both first name and last name, or full name must be provided",
69898
+ path: ["firstName"]
69899
+ // This will show the error on the firstName field
69900
+ }).refine((data) => {
69901
+ const hasEmail = data.email && data.email.trim().length > 0;
69902
+ const hasPhone = data.phone && data.phone.trim().length > 0;
69903
+ return hasEmail || hasPhone;
69904
+ }, {
69905
+ message: "Either email or phone (or both) must be provided",
69906
+ path: ["email"]
69907
+ // This will show the error on the email field
69908
+ });
69909
+ const locationSourceSchema = z$2.object({
69910
+ type: z$2.literal(schemaMappingEnum.enum.locations_schema),
69911
+ schemaId: z$2.string().uuid("schemaID must be a UUID referencing a schema definition of type locations_schema"),
69912
+ id_field: z$2.string().min(1, "ID field is required"),
69913
+ name: z$2.string().optional(),
69914
+ address_line_1: z$2.string().optional(),
69915
+ address_line_2: z$2.string().optional(),
69916
+ address_line_3: z$2.string().optional(),
69917
+ locality: z$2.string().optional(),
69918
+ district: z$2.string().optional(),
69919
+ postal_code: z$2.string().optional(),
69920
+ country_code: z$2.string().optional(),
69921
+ phone: z$2.string().optional(),
69922
+ email: z$2.string().optional(),
69923
+ website: z$2.string().optional(),
69924
+ urlPattern: z$2.string().optional()
69925
+ });
69926
+ const contactSchemaMappingSchema = z$2.object({
69927
+ primarySource: contactSourceSchema,
69928
+ additionalSources: z$2.array(contactSourceSchema).optional()
69929
+ });
69930
+ const billableEventFilterConditionSchema = z$2.object({
69931
+ path: z$2.string().describe('Dot notation path to the value, e.g., "primaryServiceType.serviceType.isVisit"'),
69932
+ operator: z$2.enum([
69933
+ "eq",
69934
+ "neq",
69935
+ "gt",
69936
+ "lt",
69937
+ "gte",
69938
+ "lte",
69939
+ "exists",
69940
+ "not_exists"
69941
+ ]),
69942
+ value: z$2.any().describe('The value to compare against. Not used for "exists" and "not_exists"')
69943
+ });
69944
+ z$2.object({
69945
+ logicalOperator: z$2.enum(["AND", "OR"]).default("AND"),
69946
+ conditions: z$2.array(billableEventFilterConditionSchema)
69947
+ });
69948
+ const transactionAmountSchema = z$2.object({
69949
+ field: z$2.string().min(1, "Amount field is required"),
69950
+ // the field that contains the amount
69951
+ currencyField: z$2.string().optional(),
69952
+ // the field that contains the currency
69953
+ currency: z$2.nativeEnum(CurrencyCode).optional()
69954
+ // the currency of the amount (If has currency field, this is ignored)
69955
+ });
69956
+ const transactionDatesSchema = z$2.object({
69957
+ createdDate: z$2.string().optional(),
69958
+ paidDate: z$2.string().optional(),
69959
+ dueDate: z$2.string().optional(),
69960
+ startDate: z$2.string().optional(),
69961
+ endDate: z$2.string().optional()
69962
+ });
69963
+ const transactionSchema = z$2.object({
69964
+ type: z$2.literal(schemaMappingEnum.enum.transactions_schema),
69965
+ eventType: z$2.string(),
69966
+ schemaId: z$2.string().uuid("schemaID must be a UUID referencing a schema definition of type transactions_schema"),
69967
+ id_field: z$2.string().min(1, "ID field is required"),
69968
+ userId: z$2.string().min(1, "User ID field is required"),
69969
+ amount: transactionAmountSchema,
69970
+ dates: transactionDatesSchema,
69971
+ locationId: z$2.string().optional().describe("Location ID field"),
69972
+ metadata: z$2.array(z$2.string()).optional(),
69973
+ filter: jsonLogicSchema.optional().describe("JSONLogic rule to conditionally create billable events from resources. See: https://jsonlogic.com/"),
69974
+ urlPattern: z$2.string().optional()
69975
+ });
69976
+ const customEventSchema = z$2.object({
69977
+ type: z$2.literal(schemaMappingEnum.enum.custom_schema),
69978
+ id_field: z$2.string().min(1, "ID field is required"),
69979
+ date: z$2.string().min(1, "Date field is required"),
69980
+ userId: z$2.string().min(1, "User ID field is required"),
69981
+ metadata: z$2.array(z$2.string()).optional(),
69982
+ schemaId: z$2.string().min(1, "Schema ID is required")
69983
+ });
69984
+ z$2.object({
69985
+ type: z$2.literal(schemaMappingEnum.enum.combined_schema),
69986
+ contactsSchema: contactSchemaMappingSchema.optional(),
69987
+ transactionsSchema: z$2.array(transactionSchema).optional(),
69988
+ customSchema: z$2.array(customEventSchema).optional(),
69989
+ locationsSchema: z$2.array(locationSourceSchema).optional()
69990
+ });
69991
+ var BusinessSegmentTypeEnum;
69992
+ (function(BusinessSegmentTypeEnum2) {
69638
69993
  BusinessSegmentTypeEnum2["ALL_USERS"] = "all_users";
69639
69994
  BusinessSegmentTypeEnum2["MANAGED"] = "managed";
69640
69995
  BusinessSegmentTypeEnum2["CUSTOM"] = "custom";
69641
69996
  BusinessSegmentTypeEnum2["ONE_OFF"] = "one_off";
69642
69997
  BusinessSegmentTypeEnum2["SQL"] = "sql";
69643
- return BusinessSegmentTypeEnum2;
69644
- })(BusinessSegmentTypeEnum || {});
69645
- var ConditionOperatorEnumType = /* @__PURE__ */ ((ConditionOperatorEnumType2) => {
69646
- ConditionOperatorEnumType2["EQUALS"] = "equals";
69647
- ConditionOperatorEnumType2["NOT_EQUALS"] = "not_equals";
69648
- ConditionOperatorEnumType2["GREATER_THAN"] = "greater_than";
69649
- ConditionOperatorEnumType2["LESS_THAN"] = "less_than";
69650
- ConditionOperatorEnumType2["EXISTS"] = "exists";
69651
- ConditionOperatorEnumType2["NOT_EXISTS"] = "not_exists";
69652
- ConditionOperatorEnumType2["EQUALS_MONTH_DAY"] = "equals_month_day";
69653
- ConditionOperatorEnumType2["EQUALS_MONTH_DAY_YEAR"] = "equals_month_day_year";
69654
- ConditionOperatorEnumType2["BETWEEN_MONTH_DAY"] = "between_month_day";
69655
- ConditionOperatorEnumType2["BETWEEN_MONTH_DAY_YEAR"] = "between_month_day_year";
69656
- ConditionOperatorEnumType2["ARRAY_CONTAINS"] = "array_contains";
69657
- return ConditionOperatorEnumType2;
69658
- })(ConditionOperatorEnumType || {});
69998
+ })(BusinessSegmentTypeEnum || (BusinessSegmentTypeEnum = {}));
69999
+ z$2.object({
70000
+ name: z$2.string().describe("A friendly name for the segment"),
70001
+ description: z$2.string().describe("A friendly description for the segment").optional(),
70002
+ conditions: z$2.array(ConditionSchema).describe("The conditions to include in the segment"),
70003
+ type: z$2.enum([BusinessSegmentTypeEnum.CUSTOM, BusinessSegmentTypeEnum.ONE_OFF]).describe("The type of segment").default(BusinessSegmentTypeEnum.CUSTOM).optional()
70004
+ });
70005
+ z$2.object({
70006
+ id: z$2.string().describe("The id of the segment"),
70007
+ name: z$2.string().describe("A friendly name for the segment"),
70008
+ description: z$2.string().describe("A friendly description for the segment").optional(),
70009
+ createdAt: z$2.date().nullable().describe("The date and time the segment was created"),
70010
+ type: z$2.nativeEnum(BusinessSegmentTypeEnum).describe("The type of segment")
70011
+ });
70012
+ z$2.object({
70013
+ name: z$2.string().optional().describe("A friendly name for the segment"),
70014
+ description: z$2.string().optional().describe("A friendly description for the segment"),
70015
+ conditions: z$2.array(ConditionSchema).optional().describe("The conditions to include in the segment")
70016
+ });
70017
+ z$2.object({
70018
+ id: z$2.string().describe("The id of the segment"),
70019
+ name: z$2.string().describe("A friendly name for the segment"),
70020
+ description: z$2.string().describe("A friendly description for the segment").optional(),
70021
+ createdAt: z$2.date().nullable().describe("The date and time the segment was created"),
70022
+ type: z$2.nativeEnum(BusinessSegmentTypeEnum).describe("The type of segment")
70023
+ });
70024
+ z$2.object({
70025
+ results: z$2.array(z$2.object({
70026
+ id: z$2.string().describe("The id of the segment"),
70027
+ name: z$2.string().describe("A friendly name for the segment"),
70028
+ description: z$2.string().describe("A friendly description for the segment").optional(),
70029
+ createdAt: z$2.date().nullable().describe("The date and time the segment was created"),
70030
+ type: z$2.nativeEnum(BusinessSegmentTypeEnum).describe("The type of segment"),
70031
+ userCount: z$2.number().describe("The number of users in the segment"),
70032
+ phoneCount: z$2.number().describe("The number of phone numbers in the segment"),
70033
+ emailCount: z$2.number().describe("The number of emails in the segment"),
70034
+ userCountUpdatedAt: z$2.date().describe("The date and time the user count was updated")
70035
+ })).describe("The segments"),
70036
+ pagination: z$2.object({
70037
+ hasNextPage: z$2.boolean().nullable().describe("Whether there is a next page"),
70038
+ cursor: z$2.string().nullable().describe("The cursor to start from"),
70039
+ total: z$2.number().nullable().describe("The total number of segments")
70040
+ })
70041
+ });
70042
+ z$2.object({
70043
+ id: z$2.string().describe("The id of the segment"),
70044
+ name: z$2.string().describe("A friendly name for the segment"),
70045
+ description: z$2.string().describe("A friendly description for the segment").optional(),
70046
+ createdAt: z$2.date().nullable().describe("The date and time the segment was created"),
70047
+ type: z$2.nativeEnum(BusinessSegmentTypeEnum).describe("The type of segment"),
70048
+ conditions: z$2.array(ConditionSchema).describe("The conditions to include in the segment")
70049
+ });
70050
+ z$2.object({
70051
+ conditions: z$2.array(z$2.object({
70052
+ field: z$2.string().describe("The field to include in the segment"),
70053
+ operators: z$2.array(ConditionOperatorEnum).describe("The operators to include in the segment"),
70054
+ type: z$2.nativeEnum(JSONSchemaType).describe("The type of segment"),
70055
+ itemType: z$2.nativeEnum(JSONSchemaType).optional().describe("If the type is an array, this is the type of the items"),
70056
+ options: z$2.array(z$2.object({
70057
+ displayName: z$2.string().describe("The display name of the option"),
70058
+ id: z$2.string().describe("The id of the option")
70059
+ })).optional().describe("The options to include in the segment"),
70060
+ description: z$2.string().optional().describe("The description of the condition")
70061
+ })).describe("The conditions to include in the segment")
70062
+ });
70063
+ z$2.object({
70064
+ count: z$2.number().describe("The number of users in the segment"),
70065
+ recipients: z$2.array(z$2.object({
70066
+ firstName: z$2.string().nullable().describe("The first name of the recipient"),
70067
+ lastName: z$2.string().nullable().describe("The last name of the recipient"),
70068
+ email: z$2.string().nullable().describe("The email of the recipient"),
70069
+ phone: z$2.string().nullable().describe("The phone of the recipient"),
70070
+ id: z$2.string().nullable().describe("The reach id of the recipient"),
70071
+ externalId: z$2.string().nullable().describe("The external id of the recipient"),
70072
+ emailOptedOut: z$2.boolean().optional().describe("Whether the user has opted out of email"),
70073
+ smsOptedOut: z$2.boolean().optional().describe("Whether the user has opted out of SMS")
70074
+ })).describe("The recipients in the segment (paginated)"),
70075
+ pagination: z$2.object({
70076
+ hasNextPage: z$2.boolean().describe("Whether there are more pages"),
70077
+ cursor: z$2.string().nullable().describe("Cursor for the next page (null if no more pages)")
70078
+ }).describe("Pagination metadata")
70079
+ });
70080
+ z$2.object({
70081
+ success: z$2.boolean().describe("Whether the text to segment was successful"),
70082
+ failureReason: z$2.string().optional().describe("The reason the text to segment was not successful."),
70083
+ conditions: z$2.array(ConditionSchema).optional().describe("The conditions to include in the segment. If the text to segment was not successful, this will be null"),
70084
+ title: z$2.string().optional().describe("A suggested title for the segment generated by AI"),
70085
+ description: z$2.string().optional().describe("A suggested description for the segment generated by AI")
70086
+ });
70087
+ z$2.object({
70088
+ cursor: z$2.string().optional().describe("The cursor to start from"),
70089
+ limit: z$2.coerce.number().optional().describe("The limit of items to return, default is 100"),
70090
+ search: z$2.string().optional().describe("The search query to filter by segment name")
70091
+ });
69659
70092
  const segmentKeys = {
69660
70093
  all: ["segments"],
69661
70094
  lists: (params) => [
@@ -69756,11 +70189,26 @@ const useGetCountOfBusinessAutomationRecipientsDebounced = (includeSegments, exc
69756
70189
  const [debouncedIncludeSegments, setDebouncedIncludeSegments] = useState(includeSegments);
69757
70190
  const [debouncedExcludeSegments, setDebouncedExcludeSegments] = useState(excludeSegments);
69758
70191
  const [debouncedSearch, setDebouncedSearch] = useState(options?.search || "");
70192
+ const [accumulatedRecipients, setAccumulatedRecipients] = useState([]);
70193
+ const [currentCursor, setCurrentCursor] = useState(
70194
+ options?.cursor
70195
+ );
70196
+ const includeSegmentsKey = JSON.stringify(debouncedIncludeSegments);
70197
+ const excludeSegmentsKey = JSON.stringify(debouncedExcludeSegments);
70198
+ useEffect(() => {
70199
+ setAccumulatedRecipients([]);
70200
+ setCurrentCursor(void 0);
70201
+ }, [
70202
+ includeSegmentsKey,
70203
+ excludeSegmentsKey,
70204
+ debouncedSearch,
70205
+ options?.filter
70206
+ ]);
69759
70207
  useEffect(() => {
69760
70208
  const timer = setTimeout(() => {
69761
70209
  setDebouncedIncludeSegments(includeSegments);
69762
70210
  setDebouncedExcludeSegments(excludeSegments);
69763
- }, options?.debounceMs);
70211
+ }, options?.debounceMs ?? 500);
69764
70212
  return () => clearTimeout(timer);
69765
70213
  }, [includeSegments, excludeSegments, options?.debounceMs]);
69766
70214
  useEffect(() => {
@@ -69779,6 +70227,7 @@ const useGetCountOfBusinessAutomationRecipientsDebounced = (includeSegments, exc
69779
70227
  debouncedSearch
69780
70228
  ),
69781
70229
  filter2,
70230
+ currentCursor || "initial",
69782
70231
  options?.limit ?? 100
69783
70232
  ],
69784
70233
  queryFn: () => getCountOfBusinessAutomationRecipients({
@@ -69787,18 +70236,41 @@ const useGetCountOfBusinessAutomationRecipientsDebounced = (includeSegments, exc
69787
70236
  automationId,
69788
70237
  search: debouncedSearch || void 0,
69789
70238
  limit: options?.limit ?? 100,
69790
- filter: filter2
70239
+ filter: filter2,
70240
+ cursor: currentCursor
69791
70241
  }),
69792
70242
  enabled: (options?.enabled ?? true) && !!automationId,
69793
- staleTime: 0
70243
+ staleTime: 0,
69794
70244
  // Always refetch when query key changes (including filter changes)
70245
+ placeholderData: keepPreviousData
70246
+ // Keep previous data while fetching
69795
70247
  });
70248
+ useEffect(() => {
70249
+ if (query.data?.recipients) {
70250
+ if (currentCursor) {
70251
+ setAccumulatedRecipients((prev) => [...prev, ...query.data.recipients]);
70252
+ } else {
70253
+ setAccumulatedRecipients(query.data.recipients);
70254
+ }
70255
+ }
70256
+ }, [query.data, currentCursor]);
70257
+ const handleLoadMore = () => {
70258
+ if (query.data?.pagination.hasNextPage && query.data.pagination.cursor && !query.isFetching) {
70259
+ setCurrentCursor(query.data.pagination.cursor);
70260
+ options?.onLoadMore?.(query.data.pagination.cursor);
70261
+ }
70262
+ };
69796
70263
  return {
69797
- data: query.data,
69798
- isLoading: query.isLoading,
70264
+ data: query.data ? {
70265
+ ...query.data,
70266
+ recipients: accumulatedRecipients
70267
+ } : void 0,
70268
+ isLoading: query.isLoading && accumulatedRecipients.length === 0,
69799
70269
  isFetching: query.isFetching,
69800
70270
  error: query.error,
69801
- refetch: query.refetch
70271
+ refetch: query.refetch,
70272
+ hasMore: query.data?.pagination.hasNextPage ?? false,
70273
+ loadMore: handleLoadMore
69802
70274
  };
69803
70275
  };
69804
70276
  const useGetSegment = (segmentId) => {
@@ -79839,6 +80311,7 @@ const primarySourceEnum = z$2.enum([
79839
80311
  "Attentive SMS",
79840
80312
  "Google Ads",
79841
80313
  "Google Organic Search",
80314
+ "Google Business Profile",
79842
80315
  "Facebook Ads",
79843
80316
  "Facebook Organic",
79844
80317
  "Instagram Ads",
@@ -79856,7 +80329,7 @@ const primarySourceEnum = z$2.enum([
79856
80329
  sourceTypeEnum.enum;
79857
80330
  primarySourceEnum.enum;
79858
80331
  z$2.object({
79859
- primary_source: primarySourceEnum,
80332
+ primary_source: z$2.union([primarySourceEnum, z$2.string()]),
79860
80333
  source_type: sourceTypeEnum,
79861
80334
  utm_source: z$2.string().nullable(),
79862
80335
  utm_medium: z$2.string().nullable(),
@@ -79868,7 +80341,8 @@ z$2.object({
79868
80341
  ad_account_id: z$2.string().nullable().optional(),
79869
80342
  ad_platform: adAccountPlatformEnum.nullable().optional(),
79870
80343
  visit_id: z$2.string().nullable(),
79871
- visit_date: z$2.string().nullable()
80344
+ visit_date: z$2.string().nullable(),
80345
+ keyword: z$2.string().nullable().optional()
79872
80346
  });
79873
80347
  const dashboardFilterReducer = (state, action) => {
79874
80348
  switch (action.type) {
@@ -83368,7 +83842,7 @@ const getAutomationStatusVariant = (status) => {
83368
83842
  case AutomationStatus.RUNNING:
83369
83843
  return "statusRunning";
83370
83844
  case AutomationStatus.SENDING:
83371
- return "statusScheduled";
83845
+ return "statusSending";
83372
83846
  case AutomationStatus.SCHEDULED:
83373
83847
  return "statusQueued";
83374
83848
  case AutomationStatus.PARTIALLY_CANCELLED:
@@ -83435,7 +83909,7 @@ function createNameColumn(nameAccessor = "name", headerText, showDescription = f
83435
83909
  [AutomationStatus.DEACTIVATED]: "bg-red-500",
83436
83910
  [AutomationStatus.FAILED]: "bg-red-500",
83437
83911
  [AutomationStatus.RUNNING]: "bg-yellow-500",
83438
- [AutomationStatus.SENDING]: "bg-indigo-500",
83912
+ [AutomationStatus.SENDING]: "bg-yellow-500",
83439
83913
  [AutomationStatus.SCHEDULED]: "bg-purple-500",
83440
83914
  [AutomationStatus.PARTIALLY_CANCELLED]: "bg-red-500",
83441
83915
  [AutomationStatus.CANCELLED]: "bg-red-500",
@@ -84095,14 +84569,61 @@ const AIContentLoading = ({
84095
84569
  /* @__PURE__ */ jsx("div", { className: "text-sm text-muted-foreground", children: /* @__PURE__ */ jsx("p", { children: "This usually takes about 60 seconds. We're crafting personalized content just for you." }) })
84096
84570
  ] }) });
84097
84571
  };
84572
+ const IMAGE_STYLE_STORAGE_KEY = "reach-ai-image-style";
84573
+ const IMAGE_STYLE_OPTIONS = [
84574
+ {
84575
+ value: "illustration",
84576
+ label: "Illustration",
84577
+ description: "Clean, modern digital artwork"
84578
+ },
84579
+ {
84580
+ value: "photorealistic",
84581
+ label: "Photo-like",
84582
+ description: "Lifelike, like a real photo"
84583
+ },
84584
+ {
84585
+ value: "graphic_design",
84586
+ label: "Bold & Colorful",
84587
+ description: "Bold shapes and vibrant colors"
84588
+ },
84589
+ {
84590
+ value: "cartoon",
84591
+ label: "Cartoon",
84592
+ description: "Fun, playful animated style"
84593
+ },
84594
+ {
84595
+ value: "minimalist",
84596
+ label: "Minimalist",
84597
+ description: "Simple and clean with white space"
84598
+ },
84599
+ {
84600
+ value: "watercolor",
84601
+ label: "Watercolor",
84602
+ description: "Soft, artistic painted look"
84603
+ }
84604
+ ];
84098
84605
  const AIContentPrompt = forwardRef(({ onGenerateContent, onPromptChange }, ref) => {
84099
- const { sendNotificationAsync } = useSlackNotification();
84100
84606
  const { generateContent, generateContentError, isGeneratingContent } = useGenerateAIContent();
84101
84607
  const {
84102
84608
  state: { selectedChannels }
84103
84609
  } = useContext(Context);
84610
+ const flags = ne$1();
84611
+ const useGemini = flags["use-gemini-image-generation"] ?? false;
84104
84612
  const [localPrompt, setLocalPrompt] = useState("");
84613
+ const [imageStyle, setImageStyle] = useState(() => {
84614
+ if (typeof window !== "undefined") {
84615
+ const saved = localStorage.getItem(IMAGE_STYLE_STORAGE_KEY);
84616
+ if (saved && IMAGE_STYLE_OPTIONS.some((option) => option.value === saved)) {
84617
+ return saved;
84618
+ }
84619
+ }
84620
+ return "illustration";
84621
+ });
84105
84622
  const promptRef = useRef(localPrompt);
84623
+ const handleImageStyleChange = (value) => {
84624
+ setImageStyle(value);
84625
+ localStorage.setItem(IMAGE_STYLE_STORAGE_KEY, value);
84626
+ };
84106
84627
  useEffect(() => {
84107
84628
  promptRef.current = localPrompt;
84108
84629
  }, [localPrompt]);
@@ -84113,16 +84634,12 @@ const AIContentPrompt = forwardRef(({ onGenerateContent, onPromptChange }, ref)
84113
84634
  const handleGenerate = () => {
84114
84635
  const currentPrompt = promptRef.current;
84115
84636
  if (!currentPrompt.trim()) return;
84116
- sendNotificationAsync({
84117
- message: "💬 New AI Email requested",
84118
- product: "engage",
84119
- feature: "ai-email",
84120
- details: { userInput: currentPrompt }
84121
- });
84122
84637
  generateContent(
84123
84638
  {
84124
84639
  userPrompt: currentPrompt,
84125
- selectedChannels
84640
+ selectedChannels,
84641
+ imageStyle,
84642
+ imageProvider: useGemini ? "gemini" : "openai"
84126
84643
  },
84127
84644
  {
84128
84645
  onSuccess: (data) => {
@@ -84169,7 +84686,7 @@ const AIContentPrompt = forwardRef(({ onGenerateContent, onPromptChange }, ref)
84169
84686
  /* @__PURE__ */ jsx("div", { className: "absolute -bottom-2 -right-2", children: /* @__PURE__ */ jsx(BetaTag, { size: "sm" }) })
84170
84687
  ] }) }),
84171
84688
  /* @__PURE__ */ jsx("h2", { className: "text-2xl font-bold", children: "Generate Content with AI" }),
84172
- /* @__PURE__ */ jsx("p", { className: "text-muted-foreground", children: "Describe the context of your email, any images you'd like included, tone, and what you want to achieve" })
84689
+ /* @__PURE__ */ jsx("div", { className: "py-3", children: /* @__PURE__ */ jsx("p", { className: "text-muted-foreground text-sm", children: "Describe what you want your message to say and we'll generate the content for you with marketing optimized best practices. Up to one image will be AI-generated for you." }) })
84173
84690
  ] }),
84174
84691
  /* @__PURE__ */ jsxs("div", { className: "space-y-4", children: [
84175
84692
  /* @__PURE__ */ jsx("div", { className: "flex justify-center", children: /* @__PURE__ */ jsx(
@@ -84183,6 +84700,33 @@ const AIContentPrompt = forwardRef(({ onGenerateContent, onPromptChange }, ref)
84183
84700
  disabled: isGeneratingContent
84184
84701
  }
84185
84702
  ) }),
84703
+ /* @__PURE__ */ jsx("div", { className: "flex justify-center", children: /* @__PURE__ */ jsxs("div", { className: "w-full max-w-2xl", children: [
84704
+ /* @__PURE__ */ jsx(Label$1, { htmlFor: "image-style", className: "block mb-1", children: "Image Style" }),
84705
+ /* @__PURE__ */ jsx("p", { className: "text-muted-foreground text-sm mb-2", children: "Choose how AI-generated images will look in your message" }),
84706
+ /* @__PURE__ */ jsxs(
84707
+ Select,
84708
+ {
84709
+ value: imageStyle,
84710
+ onValueChange: (value) => handleImageStyleChange(value),
84711
+ disabled: isGeneratingContent,
84712
+ children: [
84713
+ /* @__PURE__ */ jsx(SelectTrigger, { id: "image-style", className: "w-full", children: /* @__PURE__ */ jsx(SelectValue, { children: IMAGE_STYLE_OPTIONS.find((o2) => o2.value === imageStyle)?.label }) }),
84714
+ /* @__PURE__ */ jsx(SelectContent, { children: IMAGE_STYLE_OPTIONS.map((option) => /* @__PURE__ */ jsx(
84715
+ SelectItem,
84716
+ {
84717
+ value: option.value,
84718
+ className: "py-2",
84719
+ children: /* @__PURE__ */ jsxs("div", { className: "flex flex-col", children: [
84720
+ /* @__PURE__ */ jsx("span", { children: option.label }),
84721
+ /* @__PURE__ */ jsx("span", { className: "text-xs text-muted-foreground", children: option.description })
84722
+ ] })
84723
+ },
84724
+ option.value
84725
+ )) })
84726
+ ]
84727
+ }
84728
+ )
84729
+ ] }) }),
84186
84730
  generateContentError && /* @__PURE__ */ jsx("div", { className: "bg-destructive/10 border border-destructive/20 rounded-lg p-4", children: /* @__PURE__ */ jsx("p", { className: "text-sm text-destructive", children: "Error generating content. Please try again or contact an administrator." }) })
84187
84731
  ] })
84188
84732
  ]
@@ -84213,7 +84757,7 @@ const ContentBuilderStyleStep = () => {
84213
84757
  children: "Content Builder Style"
84214
84758
  }
84215
84759
  ),
84216
- /* @__PURE__ */ jsx(MinorText, { className: "text-muted-foreground text-sm", children: "Choose how you want to create your content" })
84760
+ /* @__PURE__ */ jsx("p", { className: "text-muted-foreground text-sm", children: "Choose how you want to create your content" })
84217
84761
  ] }),
84218
84762
  /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-1 md:grid-cols-2 gap-4 w-full max-w-4xl mx-auto", children: [
84219
84763
  /* @__PURE__ */ jsx("div", { id: "wizard-ai-builder-option", className: "min-w-0 w-full h-full", children: /* @__PURE__ */ jsx(
@@ -85309,7 +85853,7 @@ const ComboboxSelect = ({
85309
85853
  }
85310
85854
  );
85311
85855
  };
85312
- const SendPreviewPopup = ({ automation: automation2, type, setOpenSendPreviewPopup, open }) => {
85856
+ const SendPreviewPopup = ({ type, setOpenSendPreviewPopup, open }) => {
85313
85857
  const [recipient, setRecipient] = useState("");
85314
85858
  const [error2, setError2] = useState("");
85315
85859
  const [senderId, setSenderId] = useState(null);
@@ -85321,11 +85865,8 @@ const SendPreviewPopup = ({ automation: automation2, type, setOpenSendPreviewPop
85321
85865
  const { sendTestCommunication: sendTestCommunication2, sendError, isSendSuccess } = useSendTestCommunication();
85322
85866
  const { toast: toast2 } = useToast();
85323
85867
  const { segments } = useListSegments();
85324
- const actionDataCommunication = automation2.actionData?.find(
85325
- (action) => action.actionType === "send_communication"
85326
- );
85327
- const communicationGroupId = actionDataCommunication?.actionMetadata.communicationGroupId;
85328
- const { communicationGroup, isGetting: isGettingCommunicationGroup } = useGetCommunicationGroup(communicationGroupId ?? void 0);
85868
+ const { communicationGroup, isGetting: isGettingCommunicationGroup } = useCurrentCommunicationGroup();
85869
+ const communicationGroupId = communicationGroup?.id;
85329
85870
  const fetchUsersIfNeeded = React__default.useCallback(async () => {
85330
85871
  if (hasAttemptedFetch || allUsersForDropdown?.recipients || !segments) {
85331
85872
  return;
@@ -85365,6 +85906,7 @@ const SendPreviewPopup = ({ automation: automation2, type, setOpenSendPreviewPop
85365
85906
  ]);
85366
85907
  const filteredRecipients = React__default.useMemo(() => {
85367
85908
  return [...allUsersForDropdown?.recipients ?? []].filter((recipient2) => {
85909
+ if (!recipient2.id) return false;
85368
85910
  if (!recipient2.firstName || !recipient2.lastName) return false;
85369
85911
  if (type === "email" && !recipient2.email) return false;
85370
85912
  if (type === "sms" && !recipient2.phone) return false;
@@ -85377,7 +85919,7 @@ const SendPreviewPopup = ({ automation: automation2, type, setOpenSendPreviewPop
85377
85919
  const nameB = `${b3.firstName} ${b3.lastName}`.toLowerCase();
85378
85920
  return nameA.localeCompare(nameB);
85379
85921
  });
85380
- return sortedRecipients.map((recipient2) => ({
85922
+ return sortedRecipients.filter((recipient2) => recipient2.id !== null).map((recipient2) => ({
85381
85923
  value: recipient2.id,
85382
85924
  label: `${recipient2.firstName} ${recipient2.lastName}`,
85383
85925
  id: recipient2.id,
@@ -85464,15 +86006,14 @@ const SendPreviewPopup = ({ automation: automation2, type, setOpenSendPreviewPop
85464
86006
  setError2("No sender found, please update the automation first!");
85465
86007
  return;
85466
86008
  }
85467
- const actionDataCommunication2 = automation2.actionData?.find(
85468
- (action) => action.actionType === "send_communication"
85469
- );
85470
- const communicationGroupId2 = actionDataCommunication2?.actionMetadata.communicationGroupId;
85471
- if (!communicationGroupId2) {
85472
- return Promise.resolve(null);
86009
+ if (!communicationGroupId) {
86010
+ setError2(
86011
+ "No communication group found. Please select a communication step first."
86012
+ );
86013
+ return;
85473
86014
  }
85474
86015
  sendTestCommunication2({
85475
- id: communicationGroupId2,
86016
+ id: communicationGroupId,
85476
86017
  params: type === "email" ? {
85477
86018
  emailAddress: recipient,
85478
86019
  previewAsRecipientId: selectedPreviewAsRecipientId
@@ -106856,7 +107397,8 @@ function MultiSelectDialog({
106856
107397
  emptyMessage = "No items found",
106857
107398
  extraCommandItems = [],
106858
107399
  canOpen = true,
106859
- singleSelect = false
107400
+ singleSelect = false,
107401
+ totalCount
106860
107402
  }) {
106861
107403
  const [open, setOpen2] = React.useState(false);
106862
107404
  const [searchQuery, setSearchQuery] = React.useState("");
@@ -107088,10 +107630,7 @@ function MultiSelectDialog({
107088
107630
  ] }) }),
107089
107631
  !singleSelect && /* @__PURE__ */ jsx("div", { className: "px-6 pb-4", children: /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between text-sm", children: [
107090
107632
  /* @__PURE__ */ jsxs("span", { className: "text-muted-foreground", children: [
107091
- selectedCount,
107092
- " of ",
107093
- cleanedOptions.length,
107094
- " selected",
107633
+ totalCount !== void 0 ? `${selectedCount} of ${totalCount} selected` : `${selectedCount} selected`,
107095
107634
  maxCount && ` (max ${maxCount})`
107096
107635
  ] }),
107097
107636
  /* @__PURE__ */ jsxs("div", { className: "flex gap-2", children: [
@@ -107346,7 +107885,8 @@ const SMSEditor = ({
107346
107885
  imageBase64,
107347
107886
  isUpdating,
107348
107887
  hasUnsavedChanges,
107349
- communicationGroupId
107888
+ communicationGroupId,
107889
+ hasDynamicMergeFieldImage = false
107350
107890
  }) => {
107351
107891
  const [characterCount, setCharacterCount] = useState(0);
107352
107892
  const [isAddImagePopoverOpen, setIsAddImagePopoverOpen] = useState(false);
@@ -107472,6 +108012,68 @@ const SMSEditor = ({
107472
108012
  if (!editor) {
107473
108013
  return /* @__PURE__ */ jsx("div", { children: "Loading editor..." });
107474
108014
  }
108015
+ const isAddImageDisabled = (initialImageUrls?.length || 0) >= 1 || isRemovingImage || imageBase64 !== null || isUpdatingCommunicationGroup || hasDynamicMergeFieldImage;
108016
+ const addImageButton = /* @__PURE__ */ jsxs(
108017
+ Popover,
108018
+ {
108019
+ modal: true,
108020
+ open: isAddImagePopoverOpen,
108021
+ onOpenChange: setIsAddImagePopoverOpen,
108022
+ children: [
108023
+ /* @__PURE__ */ jsx(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsxs(
108024
+ Button$1,
108025
+ {
108026
+ variant: "outline",
108027
+ disabled: isAddImageDisabled,
108028
+ className: "flex items-center gap-2",
108029
+ children: [
108030
+ "Add Image",
108031
+ /* @__PURE__ */ jsx(ChevronDown, { className: "h-3 w-3" })
108032
+ ]
108033
+ }
108034
+ ) }),
108035
+ /* @__PURE__ */ jsx(PopoverContent, { className: "w-56 p-3 z-[100]", align: "start", children: /* @__PURE__ */ jsxs("div", { className: "space-y-2", children: [
108036
+ /* @__PURE__ */ jsxs(
108037
+ Button$1,
108038
+ {
108039
+ variant: "ghost",
108040
+ size: "sm",
108041
+ onClick: handleAddImageFromFile,
108042
+ className: "w-full justify-start gap-2 h-9",
108043
+ children: [
108044
+ /* @__PURE__ */ jsx(Upload, { className: "h-4 w-4" }),
108045
+ "Upload from file"
108046
+ ]
108047
+ }
108048
+ ),
108049
+ /* @__PURE__ */ jsxs(
108050
+ Button$1,
108051
+ {
108052
+ variant: "ghost",
108053
+ size: "sm",
108054
+ onClick: handleAddImageFromUrl,
108055
+ className: "w-full justify-start gap-2 h-9",
108056
+ children: [
108057
+ /* @__PURE__ */ jsx(Link$1, { className: "h-4 w-4" }),
108058
+ "Add from URL"
108059
+ ]
108060
+ }
108061
+ ),
108062
+ /* @__PURE__ */ jsx("div", { className: "text-xs text-muted-foreground pt-1 border-t", children: "Maximum size of all images: 5MB. We will try to compress the image if possible." })
108063
+ ] }) })
108064
+ ]
108065
+ }
108066
+ );
108067
+ const addImageButtonWithTooltip = isAddImageDisabled && hasDynamicMergeFieldImage ? /* @__PURE__ */ jsx(
108068
+ InfoTooltip,
108069
+ {
108070
+ title: "Image attachment limit",
108071
+ description: "We've identified an image that will be added to this message through a merge field. To ensure image quality, we don't allow uploading extra images.",
108072
+ asChild: true,
108073
+ className: "cursor-not-allowed",
108074
+ children: /* @__PURE__ */ jsx("span", { className: "inline-block cursor-not-allowed", children: addImageButton })
108075
+ }
108076
+ ) : addImageButton;
107475
108077
  return /* @__PURE__ */ jsxs("div", { className: "space-y-4", children: [
107476
108078
  /* @__PURE__ */ jsxs("div", { ref: editorRef, className: "relative", children: [
107477
108079
  /* @__PURE__ */ jsx(EditorContent, { id: "wizard-sms-editor-input", editor }),
@@ -107513,57 +108115,7 @@ const SMSEditor = ({
107513
108115
  disabled: isRemovingImage || isUpdatingCommunicationGroup,
107514
108116
  children: "Remove Image"
107515
108117
  }
107516
- ) : /* @__PURE__ */ jsxs(
107517
- Popover,
107518
- {
107519
- modal: true,
107520
- open: isAddImagePopoverOpen,
107521
- onOpenChange: setIsAddImagePopoverOpen,
107522
- children: [
107523
- /* @__PURE__ */ jsx(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsxs(
107524
- Button$1,
107525
- {
107526
- variant: "outline",
107527
- disabled: (initialImageUrls?.length || 0) >= 1 || isRemovingImage || imageBase64 !== null || isUpdatingCommunicationGroup,
107528
- className: "flex items-center gap-2",
107529
- children: [
107530
- "Add Image",
107531
- /* @__PURE__ */ jsx(ChevronDown, { className: "h-3 w-3" })
107532
- ]
107533
- }
107534
- ) }),
107535
- /* @__PURE__ */ jsx(PopoverContent, { className: "w-56 p-3 z-[100]", align: "start", children: /* @__PURE__ */ jsxs("div", { className: "space-y-2", children: [
107536
- /* @__PURE__ */ jsxs(
107537
- Button$1,
107538
- {
107539
- variant: "ghost",
107540
- size: "sm",
107541
- onClick: handleAddImageFromFile,
107542
- className: "w-full justify-start gap-2 h-9",
107543
- children: [
107544
- /* @__PURE__ */ jsx(Upload, { className: "h-4 w-4" }),
107545
- "Upload from file"
107546
- ]
107547
- }
107548
- ),
107549
- /* @__PURE__ */ jsxs(
107550
- Button$1,
107551
- {
107552
- variant: "ghost",
107553
- size: "sm",
107554
- onClick: handleAddImageFromUrl,
107555
- className: "w-full justify-start gap-2 h-9",
107556
- children: [
107557
- /* @__PURE__ */ jsx(Link$1, { className: "h-4 w-4" }),
107558
- "Add from URL"
107559
- ]
107560
- }
107561
- ),
107562
- /* @__PURE__ */ jsx("div", { className: "text-xs text-muted-foreground pt-1 border-t", children: "Maximum size of all images: 5MB. We will try to compress the image if possible." })
107563
- ] }) })
107564
- ]
107565
- }
107566
- ),
108118
+ ) : addImageButtonWithTooltip,
107567
108119
  /* @__PURE__ */ jsx(Dialog, { open: isUrlDialogOpen, onOpenChange: setIsUrlDialogOpen, children: /* @__PURE__ */ jsxs(DialogContent, { className: "sm:max-w-md", children: [
107568
108120
  /* @__PURE__ */ jsxs(DialogHeader$1, { children: [
107569
108121
  /* @__PURE__ */ jsx(DialogTitle, { children: "Add Image from URL" }),
@@ -108392,7 +108944,8 @@ const SMSEditorContent = React__default.memo(
108392
108944
  imageBase64,
108393
108945
  isUpdating: isUpdatingCommunicationGroup || isUploadingImage,
108394
108946
  hasUnsavedChanges,
108395
- communicationGroupId
108947
+ communicationGroupId,
108948
+ hasDynamicMergeFieldImage: dynamicMergeFieldImages.length > 0
108396
108949
  }
108397
108950
  )
108398
108951
  ] }),
@@ -109727,54 +110280,6 @@ var AutomationAudienceSelectorType = /* @__PURE__ */ ((AutomationAudienceSelecto
109727
110280
  const generateOneOffSegmentName = (automationId) => {
109728
110281
  return `ONE-OFF-SEGMENT-${automationId}`;
109729
110282
  };
109730
- var DateUnit = /* @__PURE__ */ ((DateUnit2) => {
109731
- DateUnit2["DAYS"] = "days";
109732
- return DateUnit2;
109733
- })(DateUnit || {});
109734
- ({
109735
- [JSONSchemaType.String]: [
109736
- ConditionOperatorEnumType.EQUALS,
109737
- ConditionOperatorEnumType.NOT_EQUALS,
109738
- ConditionOperatorEnumType.EXISTS
109739
- ],
109740
- [JSONSchemaType.Number]: [
109741
- ConditionOperatorEnumType.EQUALS,
109742
- ConditionOperatorEnumType.NOT_EQUALS,
109743
- ConditionOperatorEnumType.GREATER_THAN,
109744
- ConditionOperatorEnumType.LESS_THAN,
109745
- ConditionOperatorEnumType.EXISTS
109746
- ],
109747
- [JSONSchemaType.Boolean]: [
109748
- ConditionOperatorEnumType.EQUALS,
109749
- ConditionOperatorEnumType.NOT_EQUALS,
109750
- ConditionOperatorEnumType.EXISTS
109751
- ],
109752
- [JSONSchemaType.Date]: [
109753
- ConditionOperatorEnumType.GREATER_THAN,
109754
- ConditionOperatorEnumType.LESS_THAN,
109755
- ConditionOperatorEnumType.EXISTS,
109756
- ConditionOperatorEnumType.EQUALS_MONTH_DAY,
109757
- ConditionOperatorEnumType.EQUALS_MONTH_DAY_YEAR
109758
- ],
109759
- [JSONSchemaType.DateTime]: [
109760
- ConditionOperatorEnumType.EQUALS,
109761
- ConditionOperatorEnumType.NOT_EQUALS,
109762
- ConditionOperatorEnumType.GREATER_THAN,
109763
- ConditionOperatorEnumType.LESS_THAN,
109764
- ConditionOperatorEnumType.EXISTS,
109765
- ConditionOperatorEnumType.EQUALS_MONTH_DAY,
109766
- ConditionOperatorEnumType.EQUALS_MONTH_DAY_YEAR
109767
- ],
109768
- [JSONSchemaType.Integer]: [
109769
- ConditionOperatorEnumType.EQUALS,
109770
- ConditionOperatorEnumType.NOT_EQUALS,
109771
- ConditionOperatorEnumType.GREATER_THAN,
109772
- ConditionOperatorEnumType.LESS_THAN,
109773
- ConditionOperatorEnumType.EXISTS
109774
- ],
109775
- [JSONSchemaType.ReachResource]: [ConditionOperatorEnumType.EQUALS],
109776
- [JSONSchemaType.Array]: [ConditionOperatorEnumType.EQUALS]
109777
- });
109778
110283
  const PromptBuilderStyle = ({ onSelectStyle }) => {
109779
110284
  const [selectedStyle, setSelectedStyle] = useState(null);
109780
110285
  return /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-1 md:grid-cols-2 gap-4 p-4 max-w-4xl mx-auto", children: [
@@ -109846,7 +110351,6 @@ const RecipientsTable = ({
109846
110351
  audienceMode,
109847
110352
  isSegmentBuilder = false,
109848
110353
  isLoading = false,
109849
- totalCount,
109850
110354
  searchQuery = "",
109851
110355
  onSearchChange,
109852
110356
  onLoadMore,
@@ -109921,8 +110425,8 @@ const RecipientsTable = ({
109921
110425
  if (!container2 || isLoadingMoreState || !hasMoreItems || isLoadingMoreRef.current)
109922
110426
  return;
109923
110427
  const { scrollTop, scrollHeight, clientHeight } = container2;
109924
- const scrollPercentage = (scrollTop + clientHeight) / scrollHeight;
109925
- if (scrollPercentage > 0.9) {
110428
+ const distanceFromBottom = scrollHeight - (scrollTop + clientHeight);
110429
+ if (distanceFromBottom < 100) {
109926
110430
  loadMore();
109927
110431
  }
109928
110432
  }, [loadMore, isLoadingMoreState, hasMoreItems]);
@@ -109986,17 +110490,10 @@ const RecipientsTable = ({
109986
110490
  )
109987
110491
  ] })
109988
110492
  ] }),
109989
- searchQuery.trim() && filteredRecipients.length > 0 ? /* @__PURE__ */ jsx("div", { className: "flex-shrink-0 px-3 py-2 bg-blue-50/50 border-b border-blue-100/50", children: /* @__PURE__ */ jsxs("p", { className: "text-xs text-blue-700", children: [
110493
+ searchQuery.trim() && filteredRecipients.length > 0 && /* @__PURE__ */ jsx("div", { className: "flex-shrink-0 px-3 py-2 bg-blue-50/50 border-b border-blue-100/50", children: /* @__PURE__ */ jsxs("p", { className: "text-xs text-blue-700", children: [
109990
110494
  'Showing all users matching "',
109991
110495
  searchQuery,
109992
110496
  '"'
109993
- ] }) }) : totalCount !== void 0 && totalCount > filteredRecipients.length && filteredRecipients.length > 0 && /* @__PURE__ */ jsx("div", { className: "flex-shrink-0 px-3 py-2 bg-blue-50/50 border-b border-blue-100/50", children: /* @__PURE__ */ jsxs("p", { className: "text-xs text-blue-700", children: [
109994
- "Showing first ",
109995
- filteredRecipients.length.toLocaleString(),
109996
- " of",
109997
- " ",
109998
- totalCount.toLocaleString(),
109999
- " recipients. Use search to find specific recipients."
110000
110497
  ] }) }),
110001
110498
  /* @__PURE__ */ jsx(AnimatePresence, { mode: "wait", children: isSearchOpen && /* @__PURE__ */ jsxs(
110002
110499
  motion.div,
@@ -111097,6 +111594,50 @@ const TabsContent = React.forwardRef(({ className, ...props2 }, ref) => /* @__PU
111097
111594
  }
111098
111595
  ));
111099
111596
  TabsContent.displayName = Content.displayName;
111597
+ ({
111598
+ [JSONSchemaType.String]: [
111599
+ ConditionOperatorEnumType.EQUALS,
111600
+ ConditionOperatorEnumType.NOT_EQUALS,
111601
+ ConditionOperatorEnumType.EXISTS
111602
+ ],
111603
+ [JSONSchemaType.Number]: [
111604
+ ConditionOperatorEnumType.EQUALS,
111605
+ ConditionOperatorEnumType.NOT_EQUALS,
111606
+ ConditionOperatorEnumType.GREATER_THAN,
111607
+ ConditionOperatorEnumType.LESS_THAN,
111608
+ ConditionOperatorEnumType.EXISTS
111609
+ ],
111610
+ [JSONSchemaType.Boolean]: [
111611
+ ConditionOperatorEnumType.EQUALS,
111612
+ ConditionOperatorEnumType.NOT_EQUALS,
111613
+ ConditionOperatorEnumType.EXISTS
111614
+ ],
111615
+ [JSONSchemaType.Date]: [
111616
+ ConditionOperatorEnumType.GREATER_THAN,
111617
+ ConditionOperatorEnumType.LESS_THAN,
111618
+ ConditionOperatorEnumType.EXISTS,
111619
+ ConditionOperatorEnumType.EQUALS_MONTH_DAY,
111620
+ ConditionOperatorEnumType.EQUALS_MONTH_DAY_YEAR
111621
+ ],
111622
+ [JSONSchemaType.DateTime]: [
111623
+ ConditionOperatorEnumType.EQUALS,
111624
+ ConditionOperatorEnumType.NOT_EQUALS,
111625
+ ConditionOperatorEnumType.GREATER_THAN,
111626
+ ConditionOperatorEnumType.LESS_THAN,
111627
+ ConditionOperatorEnumType.EXISTS,
111628
+ ConditionOperatorEnumType.EQUALS_MONTH_DAY,
111629
+ ConditionOperatorEnumType.EQUALS_MONTH_DAY_YEAR
111630
+ ],
111631
+ [JSONSchemaType.Integer]: [
111632
+ ConditionOperatorEnumType.EQUALS,
111633
+ ConditionOperatorEnumType.NOT_EQUALS,
111634
+ ConditionOperatorEnumType.GREATER_THAN,
111635
+ ConditionOperatorEnumType.LESS_THAN,
111636
+ ConditionOperatorEnumType.EXISTS
111637
+ ],
111638
+ [JSONSchemaType.ReachResource]: [ConditionOperatorEnumType.EQUALS],
111639
+ [JSONSchemaType.Array]: [ConditionOperatorEnumType.EQUALS]
111640
+ });
111100
111641
  var SingleDatePreset = /* @__PURE__ */ ((SingleDatePreset2) => {
111101
111642
  SingleDatePreset2["Today"] = "today";
111102
111643
  SingleDatePreset2["Yesterday"] = "yesterday";
@@ -111311,8 +111852,8 @@ const formatDateForDisplay = (value) => {
111311
111852
  }
111312
111853
  if (typeof value === "object" && "startDate" in value && "endDate" in value) {
111313
111854
  const betweenDate = value;
111314
- const startStr = formatDateForDisplay(betweenDate.startDate);
111315
- const endStr = formatDateForDisplay(betweenDate.endDate);
111855
+ const startStr = betweenDate.startDate ? formatDateForDisplay(betweenDate.startDate) : "Select start date...";
111856
+ const endStr = betweenDate.endDate ? formatDateForDisplay(betweenDate.endDate) : "Select end date...";
111316
111857
  return `${startStr} - ${endStr}`;
111317
111858
  }
111318
111859
  return "Select date...";
@@ -111952,7 +112493,7 @@ const DateValueDialog = ({
111952
112493
  /* @__PURE__ */ jsxs("div", { children: [
111953
112494
  "Parsed as:",
111954
112495
  " ",
111955
- showBetweenDateOption && "startDate" in aiParsedDate && "endDate" in aiParsedDate ? `${formatDateForDisplay(aiParsedDate.startDate)} to ${formatDateForDisplay(aiParsedDate.endDate)}` : formatDateForDisplay(aiParsedDate)
112496
+ showBetweenDateOption && "startDate" in aiParsedDate && "endDate" in aiParsedDate ? `${aiParsedDate.startDate ? formatDateForDisplay(aiParsedDate.startDate) : "..."} to ${aiParsedDate.endDate ? formatDateForDisplay(aiParsedDate.endDate) : "..."}` : formatDateForDisplay(aiParsedDate)
111956
112497
  ] })
111957
112498
  ] }),
111958
112499
  !showBetweenDateOption && /* @__PURE__ */ jsxs("div", { className: "space-y-4", children: [
@@ -112422,7 +112963,8 @@ const ValueInput = ({
112422
112963
  onChange,
112423
112964
  options,
112424
112965
  toast: toast2,
112425
- viewOnly = false
112966
+ viewOnly = false,
112967
+ totalCount
112426
112968
  }) => {
112427
112969
  const [isDateDialogOpen, setIsDateDialogOpen] = React.useState(false);
112428
112970
  if (fieldType === JSONSchemaType.String || fieldType === JSONSchemaType.ReachResource || fieldType === JSONSchemaType.Array) {
@@ -112458,7 +113000,8 @@ const ValueInput = ({
112458
113000
  onChange(selectedIds);
112459
113001
  }
112460
113002
  },
112461
- isLoading: !options || options.length === 0
113003
+ isLoading: !options || options.length === 0,
113004
+ totalCount
112462
113005
  }
112463
113006
  );
112464
113007
  }
@@ -112550,6 +113093,11 @@ const ConditionRow = ({
112550
113093
  const cardRef = useRef(null);
112551
113094
  const [buttonPosition, setButtonPosition] = useState({ top: 0, right: 0 });
112552
113095
  const hoverTimeoutRef = useRef(null);
113096
+ const { segments } = useListSegments();
113097
+ const allUsersSegment = segments?.find(
113098
+ (segment2) => segment2.type === BusinessSegmentTypeEnum.ALL_USERS
113099
+ );
113100
+ const totalCount = condition.field === "userId" ? allUsersSegment?.userCount : void 0;
112553
113101
  const getMetadataForField = (field) => {
112554
113102
  const fieldMetadata = segmentsConditions.conditions.find(
112555
113103
  (condition2) => condition2.field === field
@@ -112813,7 +113361,8 @@ const ConditionRow = ({
112813
113361
  value: condition.value,
112814
113362
  onChange: (newValue) => onUpdate({ ...condition, value: newValue }),
112815
113363
  toast: toast2,
112816
- viewOnly
113364
+ viewOnly,
113365
+ totalCount
112817
113366
  }
112818
113367
  ) })
112819
113368
  ] })
@@ -113352,7 +113901,7 @@ function SegmentBuilder({
113352
113901
  return;
113353
113902
  }
113354
113903
  if (existingSegment) {
113355
- const mappedConditions = existingSegment.conditions.map((condition) => ({
113904
+ const mappedConditions = existingSegment.conditions.filter(isFieldCondition).map((condition) => ({
113356
113905
  field: condition.field,
113357
113906
  operator: condition.operator,
113358
113907
  value: condition.value
@@ -113361,20 +113910,20 @@ function SegmentBuilder({
113361
113910
  version: "1.0",
113362
113911
  id: existingSegment.id,
113363
113912
  name: existingSegment.name,
113364
- description: existingSegment.description,
113913
+ description: existingSegment.description || "",
113365
113914
  logic: "AND",
113366
113915
  conditions: mappedConditions,
113367
- type: existingSegment.type
113916
+ type: existingSegment.type,
113917
+ createdAt: existingSegment.createdAt
113368
113918
  });
113369
113919
  } else {
113370
113920
  setSegment((prevSegment) => ({
113371
113921
  version: "1.0",
113372
113922
  id: "",
113373
113923
  name: prevSegment?.name || "",
113374
- // Preserve existing name
113375
113924
  description: prevSegment?.description || "",
113376
- // Preserve existing description
113377
113925
  logic: "AND",
113926
+ createdAt: null,
113378
113927
  conditions: [
113379
113928
  /**
113380
113929
  * Use the first fields of segment conditions to create a new segment
@@ -113408,12 +113957,12 @@ function SegmentBuilder({
113408
113957
  };
113409
113958
  const hasRelativeDate = (condition) => {
113410
113959
  return condition.value.some((value) => {
113411
- return typeof value === "object" && "type" in value && value.type === "relative";
113960
+ return typeof value === "object" && value !== null && "type" in value && value.type === "relative";
113412
113961
  });
113413
113962
  };
113414
113963
  const hasBetweenDate = (condition) => {
113415
113964
  return condition.value.some(
113416
- (value) => typeof value === "object" && "startDate" in value && "endDate" in value
113965
+ (value) => typeof value === "object" && value !== null && "startDate" in value && "endDate" in value
113417
113966
  );
113418
113967
  };
113419
113968
  const validationConditions = (conditions) => {
@@ -113579,12 +114128,15 @@ function SegmentBuilder({
113579
114128
  (c3) => c3.field === condition.field
113580
114129
  );
113581
114130
  if (fieldMetadata?.type === JSONSchemaType.Date) {
113582
- condition.value = condition.value.map((value) => {
113583
- if (value instanceof Date) {
113584
- return value.toISOString().split("T")[0];
113585
- }
113586
- return value;
113587
- });
114131
+ return {
114132
+ ...condition,
114133
+ value: condition.value.map((value) => {
114134
+ if (value instanceof Date) {
114135
+ return value.toISOString().split("T")[0];
114136
+ }
114137
+ return value;
114138
+ })
114139
+ };
113588
114140
  }
113589
114141
  return condition;
113590
114142
  });
@@ -113680,16 +114232,14 @@ function SegmentBuilder({
113680
114232
  });
113681
114233
  };
113682
114234
  const addCondition = () => {
114235
+ const newCondition = {
114236
+ field: segmentsConditions.conditions[0].field,
114237
+ operator: segmentsConditions.conditions[0].operators[0],
114238
+ value: []
114239
+ };
113683
114240
  setSegment({
113684
114241
  ...segment2,
113685
- conditions: [
113686
- ...segment2.conditions,
113687
- {
113688
- field: segmentsConditions.conditions[0].field,
113689
- operator: segmentsConditions.conditions[0].operators[0],
113690
- value: []
113691
- }
113692
- ]
114242
+ conditions: [...segment2.conditions, newCondition]
113693
114243
  });
113694
114244
  };
113695
114245
  return /* @__PURE__ */ jsxs(Fragment$1, { children: [
@@ -113763,7 +114313,12 @@ function SegmentBuilder({
113763
114313
  {
113764
114314
  segment: segment2,
113765
114315
  setSegment,
113766
- segmentsConditions,
114316
+ segmentsConditions: {
114317
+ conditions: segmentsConditions?.conditions.map((c3) => ({
114318
+ ...c3,
114319
+ operators: c3.operators
114320
+ })) ?? []
114321
+ },
113767
114322
  updateCondition,
113768
114323
  duplicateCondition,
113769
114324
  deleteCondition,
@@ -114222,6 +114777,13 @@ const SelectIndividualUsersContent = ({ selectedUserIds, onUserSelectionChange,
114222
114777
  const [isLoadingUsers, setIsLoadingUsers] = useState(false);
114223
114778
  const [hasAttemptedFetch, setHasAttemptedFetch] = useState(false);
114224
114779
  const { segments } = useListSegments();
114780
+ const allUsersSegment = React__default.useMemo(
114781
+ () => segments?.find(
114782
+ (segment2) => segment2.type === BusinessSegmentTypeEnum.ALL_USERS
114783
+ ),
114784
+ [segments]
114785
+ );
114786
+ const totalUserCount = allUsersSegment?.userCount ?? 0;
114225
114787
  useEffect(() => {
114226
114788
  setTempSelectedUserIds(selectedUserIds);
114227
114789
  }, [selectedUserIds]);
@@ -114232,12 +114794,12 @@ const SelectIndividualUsersContent = ({ selectedUserIds, onUserSelectionChange,
114232
114794
  setHasAttemptedFetch(true);
114233
114795
  setIsLoadingUsers(true);
114234
114796
  try {
114235
- const allUsersSegment = segments.find(
114797
+ const allUsersSegment2 = segments.find(
114236
114798
  (segment2) => segment2.type === BusinessSegmentTypeEnum.ALL_USERS
114237
114799
  );
114238
- if (allUsersSegment) {
114800
+ if (allUsersSegment2) {
114239
114801
  const allUsersResponse = await getCountOfBusinessAutomationRecipients({
114240
- includeSegments: [allUsersSegment.id],
114802
+ includeSegments: [allUsersSegment2.id],
114241
114803
  excludeSegments: []
114242
114804
  });
114243
114805
  setAllUsersForDropdown(allUsersResponse);
@@ -114263,7 +114825,7 @@ const SelectIndividualUsersContent = ({ selectedUserIds, onUserSelectionChange,
114263
114825
  ]);
114264
114826
  const userOptions = React__default.useMemo(() => {
114265
114827
  if (!allUsersForDropdown?.recipients) return [];
114266
- return allUsersForDropdown.recipients.map((recipient) => {
114828
+ return allUsersForDropdown.recipients.filter((recipient) => recipient.externalId !== null).map((recipient) => {
114267
114829
  const hasEmail = !!recipient.email;
114268
114830
  const hasPhone = !!recipient.phone;
114269
114831
  const emailOptedOut = recipient.emailOptedOut || false;
@@ -114280,23 +114842,31 @@ const SelectIndividualUsersContent = ({ selectedUserIds, onUserSelectionChange,
114280
114842
  }
114281
114843
  }
114282
114844
  return {
114283
- label: getDisplayName(recipient, "Unnamed User"),
114845
+ label: getDisplayName(
114846
+ {
114847
+ firstName: recipient.firstName ?? "",
114848
+ lastName: recipient.lastName ?? "",
114849
+ email: recipient.email ?? void 0,
114850
+ phone: recipient.phone ?? void 0
114851
+ },
114852
+ "Unnamed User"
114853
+ ),
114284
114854
  value: recipient.externalId,
114285
114855
  disabled: isDisabled,
114286
114856
  disabledReason,
114287
114857
  customComponent: /* @__PURE__ */ jsx(
114288
114858
  ContactMethodPills,
114289
114859
  {
114290
- email: recipient.email,
114291
- phone: recipient.phone,
114860
+ email: recipient.email ?? void 0,
114861
+ phone: recipient.phone ?? void 0,
114292
114862
  size: "sm"
114293
114863
  }
114294
114864
  ),
114295
114865
  searchData: {
114296
- email: recipient.email,
114297
- phone: recipient.phone,
114298
- firstName: recipient.firstName,
114299
- lastName: recipient.lastName
114866
+ email: recipient.email ?? void 0,
114867
+ phone: recipient.phone ?? void 0,
114868
+ firstName: recipient.firstName ?? void 0,
114869
+ lastName: recipient.lastName ?? void 0
114300
114870
  }
114301
114871
  };
114302
114872
  });
@@ -114335,7 +114905,8 @@ const SelectIndividualUsersContent = ({ selectedUserIds, onUserSelectionChange,
114335
114905
  title: "Select Individual Users",
114336
114906
  searchPlaceholder: RECIPIENT_SEARCH_PLACEHOLDER,
114337
114907
  emptyMessage: "No users found",
114338
- canOpen: canEditAudience
114908
+ canOpen: canEditAudience,
114909
+ totalCount: totalUserCount
114339
114910
  }
114340
114911
  )
114341
114912
  ] });
@@ -114497,7 +115068,6 @@ const AutomationAudienceSelectorMain = ({ title: title2 = "Preview Audience" })
114497
115068
  const [initialStateSet, setInitialStateSet] = useState(false);
114498
115069
  const [selectedFilter, setSelectedFilter] = useState("all");
114499
115070
  const [searchQuery, setSearchQuery] = useState("");
114500
- const [limit, setLimit] = React__default.useState(100);
114501
115071
  const { segments, isLoading } = useListSegments();
114502
115072
  const { updateAutomation: updateAutomation2 } = useUpdateBusinessAutomation(
114503
115073
  automation2?.id ?? ""
@@ -114539,16 +115109,19 @@ const AutomationAudienceSelectorMain = ({ title: title2 = "Preview Audience" })
114539
115109
  count: totalCount,
114540
115110
  emailCount,
114541
115111
  phoneCount,
114542
- recipients: []
115112
+ recipients: [],
115113
+ pagination: {
115114
+ hasNextPage: false,
115115
+ cursor: null
115116
+ }
114543
115117
  };
114544
115118
  }, [segments, includedSegments, excludedSegments]);
114545
- React__default.useEffect(() => {
114546
- setLimit(100);
114547
- }, [searchQuery, includedSegments, excludedSegments, selectedFilter]);
114548
115119
  const {
114549
115120
  data: recipientsData,
114550
115121
  isLoading: isLoadingRecipients,
114551
- isFetching: isFetchingRecipients
115122
+ isFetching: isFetchingRecipients,
115123
+ hasMore,
115124
+ loadMore
114552
115125
  } = useGetCountOfBusinessAutomationRecipientsDebounced(
114553
115126
  includedSegments,
114554
115127
  excludedSegments,
@@ -114557,7 +115130,8 @@ const AutomationAudienceSelectorMain = ({ title: title2 = "Preview Audience" })
114557
115130
  debounceMs: 500,
114558
115131
  enabled: !!automation2?.id && initialStateSet && (includedSegments.length > 0 || excludedSegments.length > 0),
114559
115132
  search: searchQuery,
114560
- limit,
115133
+ limit: 100,
115134
+ // Default page size
114561
115135
  filter: selectedFilter
114562
115136
  }
114563
115137
  );
@@ -114578,8 +115152,8 @@ const AutomationAudienceSelectorMain = ({ title: title2 = "Preview Audience" })
114578
115152
  (recipient) => ({
114579
115153
  firstName: recipient.firstName ?? "",
114580
115154
  lastName: recipient.lastName ?? "",
114581
- email: recipient.email,
114582
- phone: recipient.phone
115155
+ email: recipient.email ?? void 0,
115156
+ phone: recipient.phone ?? void 0
114583
115157
  })
114584
115158
  );
114585
115159
  setFilterChanged(false);
@@ -114590,14 +115164,12 @@ const AutomationAudienceSelectorMain = ({ title: title2 = "Preview Audience" })
114590
115164
  return [];
114591
115165
  }
114592
115166
  if (recipientsData?.recipients !== void 0) {
114593
- return recipientsData.recipients.map(
114594
- (recipient) => ({
114595
- firstName: recipient.firstName ?? "",
114596
- lastName: recipient.lastName ?? "",
114597
- email: recipient.email,
114598
- phone: recipient.phone
114599
- })
114600
- );
115167
+ return recipientsData.recipients.map((recipient) => ({
115168
+ firstName: recipient.firstName ?? "",
115169
+ lastName: recipient.lastName ?? "",
115170
+ email: recipient.email ?? void 0,
115171
+ phone: recipient.phone ?? void 0
115172
+ }));
114601
115173
  }
114602
115174
  return previousRecipientsRef.current;
114603
115175
  }, [recipientsData?.recipients, filterChanged]);
@@ -114610,13 +115182,18 @@ const AutomationAudienceSelectorMain = ({ title: title2 = "Preview Audience" })
114610
115182
  emailCount: countResponse.emailCount,
114611
115183
  phoneCount: countResponse.phoneCount,
114612
115184
  // Use API recipients for display (filtered by selectedFilter)
114613
- recipients: recipientsData?.recipients || []
115185
+ recipients: recipientsData?.recipients || [],
115186
+ // Include pagination from API response
115187
+ pagination: recipientsData?.pagination || {
115188
+ hasNextPage: false,
115189
+ cursor: null
115190
+ }
114614
115191
  };
114615
115192
  }, [countResponse, recipientsData]);
114616
115193
  const handleLoadMore = React__default.useCallback(() => {
114617
- if (isFetchingRecipients || isLoadingRecipients) return;
114618
- setLimit((prev) => prev + 100);
114619
- }, [isFetchingRecipients, isLoadingRecipients]);
115194
+ if (isFetchingRecipients || isLoadingRecipients || !hasMore) return;
115195
+ loadMore();
115196
+ }, [isFetchingRecipients, isLoadingRecipients, hasMore, loadMore]);
114620
115197
  const allUsersSelected = includedSegments.length === 1 && excludedSegments.length === 0 && segments?.find(
114621
115198
  (segment2) => segment2.type === BusinessSegmentTypeEnum.ALL_USERS && segment2.id === includedSegments[0]
114622
115199
  ) !== void 0;
@@ -114923,6 +115500,7 @@ const AutomationAudienceSelectorMain = ({ title: title2 = "Preview Audience" })
114923
115500
  searchQuery,
114924
115501
  onSearchChange: setSearchQuery,
114925
115502
  onLoadMore: handleLoadMore,
115503
+ hasMore,
114926
115504
  isLoadingMore: (
114927
115505
  // Only show bottom loading indicator if filter hasn't changed (pagination)
114928
115506
  isFetchingRecipients && !filterChanged
@@ -116792,6 +117370,7 @@ const styles$1 = {
116792
117370
  headerActions
116793
117371
  };
116794
117372
  const EmailAttributionDialogContent = () => {
117373
+ const isSmsEnabled = useSmsEnabled();
116795
117374
  const containerVariants = {
116796
117375
  hidden: { opacity: 0 },
116797
117376
  visible: {
@@ -116817,9 +117396,9 @@ const EmailAttributionDialogContent = () => {
116817
117396
  description: "Short attribution lookback period"
116818
117397
  },
116819
117398
  {
116820
- icon: Eye,
116821
- title: "Engagement Required",
116822
- description: "Must click or open email"
117399
+ icon: Mail,
117400
+ title: "Send-Based Attribution",
117401
+ description: "Based on email send, not clicks"
116823
117402
  },
116824
117403
  {
116825
117404
  icon: Target,
@@ -116835,16 +117414,11 @@ const EmailAttributionDialogContent = () => {
116835
117414
  },
116836
117415
  {
116837
117416
  number: 2,
116838
- title: "Customer Engagement",
116839
- description: "The customer either clicks a link or opens the email (engagement is required for attribution)."
116840
- },
116841
- {
116842
- number: 3,
116843
117417
  title: "Purchase Occurs",
116844
- description: "Within 5 days of the email engagement, the customer makes a purchase."
117418
+ description: "Within 5 days of when the email was sent, the customer makes a purchase."
116845
117419
  },
116846
117420
  {
116847
- number: 4,
117421
+ number: 3,
116848
117422
  title: "Revenue Attribution",
116849
117423
  description: "The purchase revenue is attributed to the specific automation that sent the email."
116850
117424
  }
@@ -116853,7 +117427,7 @@ const EmailAttributionDialogContent = () => {
116853
117427
  {
116854
117428
  id: 1,
116855
117429
  title: "Valid Email Attribution",
116856
- description: "Customer receives email, engages with it, and purchases within 5 days",
117430
+ description: "Customer receives email and purchases within 5 days",
116857
117431
  steps: [
116858
117432
  {
116859
117433
  platform: "Email Campaign",
@@ -116874,12 +117448,12 @@ const EmailAttributionDialogContent = () => {
116874
117448
  color: "bg-green-600"
116875
117449
  }
116876
117450
  ],
116877
- attribution: "Email campaign gets 100% credit (customer engaged and purchased within 5 days)"
117451
+ attribution: "Email campaign gets 100% credit (customer purchased within 5 days of when email was sent)"
116878
117452
  },
116879
117453
  {
116880
117454
  id: 2,
116881
- title: "No Engagement - No Attribution",
116882
- description: "Customer receives email but never opens or clicks, then purchases",
117455
+ title: "Valid Attribution Without Click",
117456
+ description: "Customer receives email but never clicks, then purchases",
116883
117457
  steps: [
116884
117458
  {
116885
117459
  platform: "Email Campaign",
@@ -116889,7 +117463,7 @@ const EmailAttributionDialogContent = () => {
116889
117463
  },
116890
117464
  {
116891
117465
  platform: "Customer",
116892
- action: "No Engagement",
117466
+ action: "No Click",
116893
117467
  day: "Day 1-5",
116894
117468
  color: "bg-gray-400"
116895
117469
  },
@@ -116900,12 +117474,12 @@ const EmailAttributionDialogContent = () => {
116900
117474
  color: "bg-green-600"
116901
117475
  }
116902
117476
  ],
116903
- attribution: "No attribution (email was sent but customer never engaged with it)"
117477
+ attribution: "Email campaign gets 100% credit (customer purchased within 5 days of when email was sent)"
116904
117478
  },
116905
117479
  {
116906
117480
  id: 3,
116907
117481
  title: "Attribution Window Expired",
116908
- description: "Customer engaged with email but purchased outside the 5-day window",
117482
+ description: "Customer purchased more than 5 days after the email was sent",
116909
117483
  steps: [
116910
117484
  {
116911
117485
  platform: "Email Campaign",
@@ -116926,7 +117500,7 @@ const EmailAttributionDialogContent = () => {
116926
117500
  color: "bg-green-600"
116927
117501
  }
116928
117502
  ],
116929
- attribution: "No attribution (purchase occurred 7 days after email engagement, outside 5-day window)"
117503
+ attribution: "No attribution (purchase occurred 7 days after email was sent, outside 5-day window)"
116930
117504
  }
116931
117505
  ];
116932
117506
  const keyPoints = [
@@ -116934,10 +117508,7 @@ const EmailAttributionDialogContent = () => {
116934
117508
  text: "Only emails sent through automations count for attribution"
116935
117509
  },
116936
117510
  {
116937
- text: "Customer must click or open the email for attribution to occur"
116938
- },
116939
- {
116940
- text: "The 5-day window starts from when the email was sent, not when it was opened"
117511
+ text: "The 5-day window starts from when the email was sent"
116941
117512
  },
116942
117513
  {
116943
117514
  text: "Revenue is attributed to the specific automation that sent the email"
@@ -116963,8 +117534,8 @@ const EmailAttributionDialogContent = () => {
116963
117534
  FeatureHighlights,
116964
117535
  {
116965
117536
  highlights: featureHighlights,
116966
- cardTitle: "Email Engagement Attribution Model",
116967
- cardDescription: "We use a 5-day engagement-based attribution model that requires customer interaction with your emails",
117537
+ cardTitle: "Email Send Attribution Model",
117538
+ cardDescription: "We use a 5-day send-based attribution model. When an email is sent, any purchase within 5 days is attributed to that automation.",
116968
117539
  cardIcon: MousePointer
116969
117540
  }
116970
117541
  ) }),
@@ -116992,7 +117563,141 @@ const EmailAttributionDialogContent = () => {
116992
117563
  points: keyPoints,
116993
117564
  variant: "highlighted"
116994
117565
  }
116995
- ) })
117566
+ ) }),
117567
+ isSmsEnabled && /* @__PURE__ */ jsxs(Fragment$1, { children: [
117568
+ /* @__PURE__ */ jsx(motion.div, { variants: itemVariants2, children: /* @__PURE__ */ jsx(
117569
+ DialogHeader,
117570
+ {
117571
+ title: "SMS Attribution Methodology",
117572
+ description: "How we track and attribute conversions to your SMS marketing automations",
117573
+ icon: MessageSquare
117574
+ }
117575
+ ) }),
117576
+ /* @__PURE__ */ jsx(motion.div, { variants: itemVariants2, children: /* @__PURE__ */ jsx(
117577
+ FeatureHighlights,
117578
+ {
117579
+ highlights: [
117580
+ {
117581
+ icon: Clock,
117582
+ title: "5-Day Window",
117583
+ description: "Short attribution lookback period"
117584
+ },
117585
+ {
117586
+ icon: Target,
117587
+ title: "Automation-Linked",
117588
+ description: "Tied to specific campaigns"
117589
+ }
117590
+ ],
117591
+ cardTitle: "SMS Send Attribution Model",
117592
+ cardDescription: "We use a 5-day send-based attribution model. When an SMS is sent, any purchase within 5 days is attributed to that automation.",
117593
+ cardIcon: MousePointer
117594
+ }
117595
+ ) }),
117596
+ /* @__PURE__ */ jsx(motion.div, { variants: itemVariants2, children: /* @__PURE__ */ jsx(
117597
+ ProcessSteps,
117598
+ {
117599
+ steps: [
117600
+ {
117601
+ number: 1,
117602
+ title: "SMS Sent via Automation",
117603
+ description: "An SMS is sent to a customer through one of your marketing automations."
117604
+ },
117605
+ {
117606
+ number: 2,
117607
+ title: "Purchase Occurs",
117608
+ description: "Within 5 days of when the SMS was sent, the customer makes a purchase."
117609
+ },
117610
+ {
117611
+ number: 3,
117612
+ title: "Revenue Attribution",
117613
+ description: "The purchase revenue is attributed to the specific automation that sent the SMS."
117614
+ }
117615
+ ],
117616
+ title: "How SMS Attribution Works",
117617
+ icon: TrendingUp
117618
+ }
117619
+ ) }),
117620
+ /* @__PURE__ */ jsx(motion.div, { variants: itemVariants2, children: /* @__PURE__ */ jsx(
117621
+ ExpandableScenarios,
117622
+ {
117623
+ scenarios: [
117624
+ {
117625
+ id: 4,
117626
+ title: "Valid SMS Attribution",
117627
+ description: "Customer receives SMS and purchases within 5 days",
117628
+ steps: [
117629
+ {
117630
+ platform: "SMS Campaign",
117631
+ action: "Sent",
117632
+ day: "Day 1",
117633
+ color: "bg-blue-500"
117634
+ },
117635
+ {
117636
+ platform: "Customer",
117637
+ action: "Clicked",
117638
+ day: "Day 1",
117639
+ color: "bg-green-500"
117640
+ },
117641
+ {
117642
+ platform: "Purchase",
117643
+ action: "Completed",
117644
+ day: "Day 3",
117645
+ color: "bg-green-600"
117646
+ }
117647
+ ],
117648
+ attribution: "SMS campaign gets 100% credit (customer purchased within 5 days of when SMS was sent)"
117649
+ },
117650
+ {
117651
+ id: 6,
117652
+ title: "Attribution Window Expired",
117653
+ description: "Customer purchased more than 5 days after the SMS was sent",
117654
+ steps: [
117655
+ {
117656
+ platform: "SMS Campaign",
117657
+ action: "Sent",
117658
+ day: "Day 1",
117659
+ color: "bg-blue-500"
117660
+ },
117661
+ {
117662
+ platform: "Customer",
117663
+ action: "Clicked",
117664
+ day: "Day 1",
117665
+ color: "bg-green-500"
117666
+ },
117667
+ {
117668
+ platform: "Purchase",
117669
+ action: "Completed",
117670
+ day: "Day 8",
117671
+ color: "bg-green-600"
117672
+ }
117673
+ ],
117674
+ attribution: "No attribution (purchase occurred 7 days after SMS was sent, outside 5-day window)"
117675
+ }
117676
+ ],
117677
+ title: "SMS Attribution Scenarios",
117678
+ description: "See how different SMS engagement patterns are attributed",
117679
+ icon: Eye
117680
+ }
117681
+ ) }),
117682
+ /* @__PURE__ */ jsx(motion.div, { variants: itemVariants2, children: /* @__PURE__ */ jsx(
117683
+ KeyPointsList,
117684
+ {
117685
+ title: "Important Notes",
117686
+ points: [
117687
+ {
117688
+ text: "Only SMS messages sent through automations count for attribution"
117689
+ },
117690
+ {
117691
+ text: "The 5-day window starts from when the SMS was sent"
117692
+ },
117693
+ {
117694
+ text: "Revenue is attributed to the specific automation that sent the SMS"
117695
+ }
117696
+ ],
117697
+ variant: "highlighted"
117698
+ }
117699
+ ) })
117700
+ ] })
116996
117701
  ]
116997
117702
  }
116998
117703
  );
@@ -117262,6 +117967,7 @@ const AutomationStatistics = ({
117262
117967
  }) => {
117263
117968
  const [isLinkClickStatsOpen, setIsLinkClickStatsOpen] = useState(false);
117264
117969
  const [isEmailAttributionOpen, setIsEmailAttributionOpen] = useState(false);
117970
+ const isSmsEnabled = useSmsEnabled();
117265
117971
  const {
117266
117972
  statistics: automationStatistics,
117267
117973
  isLoading: isAutomationStatisticsLoading
@@ -117312,11 +118018,16 @@ const AutomationStatistics = ({
117312
118018
  header: "Customer",
117313
118019
  enableSorting: false,
117314
118020
  cell: ({ row }) => {
117315
- const firstName = row.original.first_name || "";
117316
- const lastName = row.original.last_name || "";
118021
+ const displayName = getDisplayName(
118022
+ {
118023
+ firstName: row.original.first_name || "",
118024
+ lastName: row.original.last_name || ""
118025
+ },
118026
+ "Unknown"
118027
+ );
117317
118028
  const email = row.original.email || "";
117318
118029
  return /* @__PURE__ */ jsxs("div", { className: "flex flex-col", children: [
117319
- /* @__PURE__ */ jsx("span", { className: "font-medium", children: firstName && lastName ? `${firstName} ${lastName}` : "Unknown" }),
118030
+ /* @__PURE__ */ jsx("span", { className: "font-medium", children: displayName }),
117320
118031
  email && /* @__PURE__ */ jsx("span", { className: "text-xs text-muted-foreground", children: email })
117321
118032
  ] });
117322
118033
  },
@@ -117386,7 +118097,7 @@ const AutomationStatistics = ({
117386
118097
  statistics,
117387
118098
  automationId,
117388
118099
  onLinkClickStatsOpen: () => setIsLinkClickStatsOpen(true),
117389
- includeSms,
118100
+ includeSms: includeSms && isSmsEnabled,
117390
118101
  showErrors
117391
118102
  }
117392
118103
  )
@@ -117834,7 +118545,7 @@ function SegmentList() {
117834
118545
  const segmentsMapped = useMemo(
117835
118546
  () => segments ? segments.map((segment2) => ({
117836
118547
  ...segment2,
117837
- updated_at: segment2.createdAt.toString(),
118548
+ updated_at: segment2.createdAt?.toString(),
117838
118549
  user_count: segment2.userCount,
117839
118550
  user_count_updated_at: segment2.userCountUpdatedAt
117840
118551
  })) : [],
@@ -119346,11 +120057,16 @@ const AutomationsEditorStatsTab = () => {
119346
120057
  header: "Customer",
119347
120058
  enableSorting: false,
119348
120059
  cell: ({ row }) => {
119349
- const firstName = row.original.first_name || "";
119350
- const lastName = row.original.last_name || "";
120060
+ const displayName = getDisplayName(
120061
+ {
120062
+ firstName: row.original.first_name || "",
120063
+ lastName: row.original.last_name || ""
120064
+ },
120065
+ "Unknown"
120066
+ );
119351
120067
  const email = row.original.email || "";
119352
120068
  return /* @__PURE__ */ jsxs("div", { className: "flex flex-col", children: [
119353
- /* @__PURE__ */ jsx("span", { className: "font-medium", children: firstName && lastName ? `${firstName} ${lastName}` : "Unknown" }),
120069
+ /* @__PURE__ */ jsx("span", { className: "font-medium", children: displayName }),
119354
120070
  email && /* @__PURE__ */ jsx("span", { className: "text-xs text-muted-foreground", children: email })
119355
120071
  ] });
119356
120072
  },