@embedreach/components 0.1.91 → 0.1.92

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -2739,7 +2739,6 @@ const useUpdateBusinessAutomation = (automationId) => {
2739
2739
  const updateAutomationMutation = useMutation({
2740
2740
  mutationFn: (params) => updateAutomation(automationId, params),
2741
2741
  onSuccess: () => {
2742
- queryClient.invalidateQueries({ queryKey: ["automations"] });
2743
2742
  queryClient.invalidateQueries({
2744
2743
  queryKey: ["automations", automationId]
2745
2744
  });
@@ -13209,6 +13208,310 @@ const toShadcnFormat = (color2) => {
13209
13208
  return color2;
13210
13209
  }
13211
13210
  };
13211
+ const tailwindToHsl = (tailwindClass) => {
13212
+ if (tailwindClass === "bg-inherit") return "inherit";
13213
+ if (tailwindClass === "bg-current") return "currentColor";
13214
+ if (tailwindClass === "bg-transparent") return "transparent";
13215
+ if (tailwindClass === "bg-black") return "0 0% 0%";
13216
+ if (tailwindClass === "bg-white") return "0 0% 100%";
13217
+ const match2 = tailwindClass.match(/^bg-([a-z]+)-(\d{2,3})$/);
13218
+ if (!match2) {
13219
+ throw new Error(`Invalid tailwind color class: ${tailwindClass}`);
13220
+ }
13221
+ const [, color2, shade] = match2;
13222
+ const colorMap = {
13223
+ red: {
13224
+ "50": "0 100% 97.1%",
13225
+ "100": "0 100% 93.6%",
13226
+ "200": "0 100% 88.5%",
13227
+ "300": "0 100% 80.8%",
13228
+ "400": "0 100% 70.4%",
13229
+ "500": "0 100% 63.7%",
13230
+ "600": "0 100% 57.7%",
13231
+ "700": "0 100% 50.5%",
13232
+ "800": "0 100% 44.4%",
13233
+ "900": "0 100% 39.6%",
13234
+ "950": "0 100% 25.8%"
13235
+ },
13236
+ orange: {
13237
+ "50": "98% 0.016 73.684",
13238
+ "100": "95.4% 0.038 75.164",
13239
+ "200": "90.1% 0.076 70.697",
13240
+ "300": "83.7% 0.128 66.29",
13241
+ "400": "75% 0.183 55.934",
13242
+ "500": "70.5% 0.213 47.604",
13243
+ "600": "64.6% 0.222 41.116",
13244
+ "700": "55.3% 0.195 38.402",
13245
+ "800": "47% 0.157 37.304",
13246
+ "900": "40.8% 0.123 38.172",
13247
+ "950": "26.6% 0.079 36.259"
13248
+ },
13249
+ amber: {
13250
+ "50": "98.7% 0.022 95.277",
13251
+ "100": "96.2% 0.059 95.617",
13252
+ "200": "92.4% 0.12 95.746",
13253
+ "300": "87.9% 0.169 91.605",
13254
+ "400": "82.8% 0.189 84.429",
13255
+ "500": "76.9% 0.188 70.08",
13256
+ "600": "66.6% 0.179 58.318",
13257
+ "700": "55.5% 0.163 48.998",
13258
+ "800": "47.3% 0.137 46.201",
13259
+ "900": "41.4% 0.112 45.904",
13260
+ "950": "27.9% 0.077 45.635"
13261
+ },
13262
+ yellow: {
13263
+ "50": "98.7% 0.026 102.212",
13264
+ "100": "97.3% 0.071 103.193",
13265
+ "200": "94.5% 0.129 101.54",
13266
+ "300": "90.5% 0.182 98.111",
13267
+ "400": "85.2% 0.199 91.936",
13268
+ "500": "79.5% 0.184 86.047",
13269
+ "600": "68.1% 0.162 75.834",
13270
+ "700": "55.4% 0.135 66.442",
13271
+ "800": "47.6% 0.114 61.907",
13272
+ "900": "42.1% 0.095 57.708",
13273
+ "950": "28.6% 0.066 53.813"
13274
+ },
13275
+ lime: {
13276
+ "50": "98.6% 0.031 120.757",
13277
+ "100": "96.7% 0.067 122.328",
13278
+ "200": "93.8% 0.127 124.321",
13279
+ "300": "89.7% 0.196 126.665",
13280
+ "400": "84.1% 0.238 128.85",
13281
+ "500": "76.8% 0.233 130.85",
13282
+ "600": "64.8% 0.2 131.684",
13283
+ "700": "53.2% 0.157 131.589",
13284
+ "800": "45.3% 0.124 130.933",
13285
+ "900": "40.5% 0.101 131.063",
13286
+ "950": "27.4% 0.072 132.109"
13287
+ },
13288
+ green: {
13289
+ "50": "98.2% 0.018 155.826",
13290
+ "100": "96.2% 0.044 156.743",
13291
+ "200": "92.5% 0.084 155.995",
13292
+ "300": "87.1% 0.15 154.449",
13293
+ "400": "79.2% 0.209 151.711",
13294
+ "500": "72.3% 0.219 149.579",
13295
+ "600": "62.7% 0.194 149.214",
13296
+ "700": "52.7% 0.154 150.069",
13297
+ "800": "44.8% 0.119 151.328",
13298
+ "900": "39.3% 0.095 152.535",
13299
+ "950": "26.6% 0.065 152.934"
13300
+ },
13301
+ emerald: {
13302
+ "50": "97.9% 0.021 166.113",
13303
+ "100": "95% 0.052 163.051",
13304
+ "200": "90.5% 0.093 164.15",
13305
+ "300": "84.5% 0.143 164.978",
13306
+ "400": "76.5% 0.177 163.223",
13307
+ "500": "69.6% 0.17 162.48",
13308
+ "600": "59.6% 0.145 163.225",
13309
+ "700": "50.8% 0.118 165.612",
13310
+ "800": "43.2% 0.095 166.913",
13311
+ "900": "37.8% 0.077 168.94",
13312
+ "950": "26.2% 0.051 172.552"
13313
+ },
13314
+ teal: {
13315
+ "50": "98.4% 0.014 180.72",
13316
+ "100": "95.3% 0.051 180.801",
13317
+ "200": "91% 0.096 180.426",
13318
+ "300": "85.5% 0.138 181.071",
13319
+ "400": "77.7% 0.152 181.912",
13320
+ "500": "70.4% 0.14 182.503",
13321
+ "600": "60% 0.118 184.704",
13322
+ "700": "51.1% 0.096 186.391",
13323
+ "800": "43.7% 0.078 188.216",
13324
+ "900": "38.6% 0.063 188.416",
13325
+ "950": "27.7% 0.046 192.524"
13326
+ },
13327
+ cyan: {
13328
+ "50": "98.4% 0.019 200.873",
13329
+ "100": "95.6% 0.045 203.388",
13330
+ "200": "91.7% 0.08 205.041",
13331
+ "300": "86.5% 0.127 207.078",
13332
+ "400": "78.9% 0.154 211.53",
13333
+ "500": "71.5% 0.143 215.221",
13334
+ "600": "60.9% 0.126 221.723",
13335
+ "700": "52% 0.105 223.128",
13336
+ "800": "45% 0.085 224.283",
13337
+ "900": "39.8% 0.07 227.392",
13338
+ "950": "30.2% 0.056 229.695"
13339
+ },
13340
+ sky: {
13341
+ "50": "97.7% 0.013 236.62",
13342
+ "100": "95.1% 0.026 236.824",
13343
+ "200": "90.1% 0.058 230.902",
13344
+ "300": "82.8% 0.111 230.318",
13345
+ "400": "74.6% 0.16 232.661",
13346
+ "500": "68.5% 0.169 237.323",
13347
+ "600": "58.8% 0.158 241.966",
13348
+ "700": "50% 0.134 242.749",
13349
+ "800": "44.3% 0.11 240.79",
13350
+ "900": "39.1% 0.09 240.876",
13351
+ "950": "29.3% 0.066 243.157"
13352
+ },
13353
+ blue: {
13354
+ "50": "97% 0.014 254.604",
13355
+ "100": "93.2% 0.032 255.585",
13356
+ "200": "88.2% 0.059 254.128",
13357
+ "300": "80.9% 0.105 251.813",
13358
+ "400": "70.7% 0.165 254.624",
13359
+ "500": "62.3% 0.214 259.815",
13360
+ "600": "54.6% 0.245 262.881",
13361
+ "700": "48.8% 0.243 264.376",
13362
+ "800": "42.4% 0.199 265.638",
13363
+ "900": "37.9% 0.146 265.522",
13364
+ "950": "28.2% 0.091 267.935"
13365
+ },
13366
+ indigo: {
13367
+ "50": "96.2% 0.018 272.314",
13368
+ "100": "93% 0.034 272.788",
13369
+ "200": "87% 0.065 274.039",
13370
+ "300": "78.5% 0.115 274.713",
13371
+ "400": "67.3% 0.182 276.935",
13372
+ "500": "58.5% 0.233 277.117",
13373
+ "600": "51.1% 0.262 276.966",
13374
+ "700": "45.7% 0.24 277.023",
13375
+ "800": "39.8% 0.195 277.366",
13376
+ "900": "35.9% 0.144 278.697",
13377
+ "950": "25.7% 0.09 281.288"
13378
+ },
13379
+ violet: {
13380
+ "50": "96.9% 0.016 293.756",
13381
+ "100": "94.3% 0.029 294.588",
13382
+ "200": "89.4% 0.057 293.283",
13383
+ "300": "81.1% 0.111 293.571",
13384
+ "400": "70.2% 0.183 293.541",
13385
+ "500": "60.6% 0.25 292.717",
13386
+ "600": "54.1% 0.281 293.009",
13387
+ "700": "49.1% 0.27 292.581",
13388
+ "800": "43.2% 0.232 292.759",
13389
+ "900": "38% 0.189 293.745",
13390
+ "950": "28.3% 0.141 291.089"
13391
+ },
13392
+ purple: {
13393
+ "50": "97.7% 0.014 308.299",
13394
+ "100": "94.6% 0.033 307.174",
13395
+ "200": "90.2% 0.063 306.703",
13396
+ "300": "82.7% 0.119 306.383",
13397
+ "400": "71.4% 0.203 305.504",
13398
+ "500": "62.7% 0.265 303.9",
13399
+ "600": "55.8% 0.288 302.321",
13400
+ "700": "49.6% 0.265 301.924",
13401
+ "800": "43.8% 0.218 303.724",
13402
+ "900": "38.1% 0.176 304.987",
13403
+ "950": "29.1% 0.149 302.717"
13404
+ },
13405
+ fuchsia: {
13406
+ "50": "97.7% 0.017 320.058",
13407
+ "100": "95.2% 0.037 318.852",
13408
+ "200": "90.3% 0.076 319.62",
13409
+ "300": "83.3% 0.145 321.434",
13410
+ "400": "74% 0.238 322.16",
13411
+ "500": "66.7% 0.295 322.15",
13412
+ "600": "59.1% 0.293 322.896",
13413
+ "700": "51.8% 0.253 323.949",
13414
+ "800": "45.2% 0.211 324.591",
13415
+ "900": "40.1% 0.17 325.612",
13416
+ "950": "29.3% 0.136 325.661"
13417
+ },
13418
+ pink: {
13419
+ "50": "97.1% 0.014 343.198",
13420
+ "100": "94.8% 0.028 342.258",
13421
+ "200": "89.9% 0.061 343.231",
13422
+ "300": "82.3% 0.12 346.018",
13423
+ "400": "71.8% 0.202 349.761",
13424
+ "500": "65.6% 0.241 354.308",
13425
+ "600": "59.2% 0.249 0.584",
13426
+ "700": "52.5% 0.223 3.958",
13427
+ "800": "45.9% 0.187 3.815",
13428
+ "900": "40.8% 0.153 2.432",
13429
+ "950": "28.4% 0.109 3.907"
13430
+ },
13431
+ rose: {
13432
+ "50": "96.9% 0.015 12.422",
13433
+ "100": "94.1% 0.03 12.58",
13434
+ "200": "89.2% 0.058 10.001",
13435
+ "300": "81% 0.117 11.638",
13436
+ "400": "71.2% 0.194 13.428",
13437
+ "500": "64.5% 0.246 16.439",
13438
+ "600": "58.6% 0.253 17.585",
13439
+ "700": "51.4% 0.222 16.935",
13440
+ "800": "45.5% 0.188 13.697",
13441
+ "900": "41% 0.159 10.272",
13442
+ "950": "27.1% 0.105 12.094"
13443
+ },
13444
+ slate: {
13445
+ "50": "98.4% 0.003 247.858",
13446
+ "100": "96.8% 0.007 247.896",
13447
+ "200": "92.9% 0.013 255.508",
13448
+ "300": "86.9% 0.022 252.894",
13449
+ "400": "70.4% 0.04 256.788",
13450
+ "500": "55.4% 0.046 257.417",
13451
+ "600": "44.6% 0.043 257.281",
13452
+ "700": "37.2% 0.044 257.287",
13453
+ "800": "27.9% 0.041 260.031",
13454
+ "900": "20.8% 0.042 265.755",
13455
+ "950": "12.9% 0.042 264.695"
13456
+ },
13457
+ gray: {
13458
+ "50": "98.5% 0.002 247.839",
13459
+ "100": "96.7% 0.003 264.542",
13460
+ "200": "92.8% 0.006 264.531",
13461
+ "300": "87.2% 0.01 258.338",
13462
+ "400": "70.7% 0.022 261.325",
13463
+ "500": "55.1% 0.027 264.364",
13464
+ "600": "44.6% 0.03 256.802",
13465
+ "700": "37.3% 0.034 259.733",
13466
+ "800": "27.8% 0.033 256.848",
13467
+ "900": "21% 0.034 264.665",
13468
+ "950": "13% 0.028 261.692"
13469
+ },
13470
+ zinc: {
13471
+ "50": "98.5% 0 0",
13472
+ "100": "96.7% 0.001 286.375",
13473
+ "200": "92% 0.004 286.32",
13474
+ "300": "87.1% 0.006 286.286",
13475
+ "400": "70.5% 0.015 286.067",
13476
+ "500": "55.2% 0.016 285.938",
13477
+ "600": "44.2% 0.017 285.786",
13478
+ "700": "37% 0.013 285.805",
13479
+ "800": "27.4% 0.006 286.033",
13480
+ "900": "21% 0.006 285.885",
13481
+ "950": "14.1% 0.005 285.823"
13482
+ },
13483
+ neutral: {
13484
+ "50": "98.5% 0 0",
13485
+ "100": "97% 0 0",
13486
+ "200": "92.2% 0 0",
13487
+ "300": "87% 0 0",
13488
+ "400": "70.8% 0 0",
13489
+ "500": "55.6% 0 0",
13490
+ "600": "43.9% 0 0",
13491
+ "700": "37.1% 0 0",
13492
+ "800": "26.9% 0 0",
13493
+ "900": "20.5% 0 0",
13494
+ "950": "14.5% 0 0"
13495
+ },
13496
+ stone: {
13497
+ "50": "98.5% 0.001 106.423",
13498
+ "100": "97% 0.001 106.424",
13499
+ "200": "92.3% 0.003 48.717",
13500
+ "300": "86.9% 0.005 56.366",
13501
+ "400": "70.9% 0.01 56.259",
13502
+ "500": "55.3% 0.013 58.071",
13503
+ "600": "44.4% 0.011 73.639",
13504
+ "700": "37.4% 0.01 67.558",
13505
+ "800": "26.8% 0.007 34.298",
13506
+ "900": "21.6% 0.006 56.043",
13507
+ "950": "14.7% 0.004 49.25"
13508
+ }
13509
+ };
13510
+ if (!colorMap[color2] || !colorMap[color2][shade]) {
13511
+ throw new Error(`Unsupported color or shade: ${tailwindClass}`);
13512
+ }
13513
+ return colorMap[color2][shade];
13514
+ };
13212
13515
  const applyThemeStyles = (styles2) => {
13213
13516
  const existingStyles = document.getElementById("reach-theme-styles");
13214
13517
  if (existingStyles) {
@@ -13225,15 +13528,9 @@ const applyThemeStyles = (styles2) => {
13225
13528
  if (key === "radius" || key === "font-body" || key === "font-heading") {
13226
13529
  finalValue = userValue;
13227
13530
  } else if (isValidColor(userValue)) {
13228
- const isTailwindClass = /^(bg|text|border|ring|shadow|from|via|to|divide|placeholder|caret|accent|outline|decoration|fill|stroke)-/.test(
13229
- userValue.trim()
13230
- );
13531
+ const isTailwindClass = /^bg-/.test(userValue.trim());
13231
13532
  if (isTailwindClass) {
13232
- const rootElement = document.querySelector("[data-reach-root]");
13233
- if (rootElement) {
13234
- rootElement.classList.add(userValue.trim());
13235
- }
13236
- finalValue = defaultValue;
13533
+ finalValue = tailwindToHsl(userValue);
13237
13534
  } else {
13238
13535
  try {
13239
13536
  finalValue = toShadcnFormat(userValue);
@@ -15952,8 +16249,6 @@ const date$2 = "Date";
15952
16249
  const close$1 = "Close";
15953
16250
  const connected$1 = "Connected";
15954
16251
  const connecting$1 = "Connecting...";
15955
- const reauth_required$1 = "Re-authentication required";
15956
- const reauth_required_description$1 = "Re-authentication required for one of your ad accounts";
15957
16252
  const reauthenticate$1 = "Reauthenticate";
15958
16253
  const account_settings$1 = "Account Settings";
15959
16254
  const manage_account_settings$1 = "Manage your account settings";
@@ -15978,6 +16273,10 @@ const measure$1 = {
15978
16273
  dashboard: {
15979
16274
  title: "Marketing ROI Dashboard",
15980
16275
  subtitle: "Track and analyze how your marketing efforts are driving sales",
16276
+ application_status_banner_title: "We are experiencing some issues",
16277
+ application_status_banner_description: "We are aware of an issue affecting the dashboard. We are working on it and will have it resolved soon.",
16278
+ no_metrics_banner_title: "We are unable to display any metrics for this date range",
16279
+ no_metrics_banner_description: "If you have just connected your ad accounts, your metrics should begin populating within the next 24 hours. Please check back soon.",
15981
16280
  reach_managed_campaign_banner: "Your ads are being managed by Reach. We’ll automatically optimize them to drive the best results."
15982
16281
  }
15983
16282
  };
@@ -16359,8 +16658,6 @@ const enCommon = {
16359
16658
  "continue": "Continue",
16360
16659
  connected: connected$1,
16361
16660
  connecting: connecting$1,
16362
- reauth_required: reauth_required$1,
16363
- reauth_required_description: reauth_required_description$1,
16364
16661
  reauthenticate: reauthenticate$1,
16365
16662
  account_settings: account_settings$1,
16366
16663
  manage_account_settings: manage_account_settings$1,
@@ -16416,8 +16713,6 @@ const date$1 = "Fecha";
16416
16713
  const close = "Cerrar";
16417
16714
  const connected = "Conectado";
16418
16715
  const connecting = "Conectando...";
16419
- const reauth_required = "Re-autenticación requerida";
16420
- const reauth_required_description = "Re-autenticación requerida para una de tus cuentas de anuncios";
16421
16716
  const reauthenticate = "Reautenticar";
16422
16717
  const account_settings = "Configuración de cuenta";
16423
16718
  const manage_account_settings = "Configuración de tu cuenta";
@@ -16442,6 +16737,10 @@ const measure = {
16442
16737
  dashboard: {
16443
16738
  title: "Panel de ingresos de marketing",
16444
16739
  subtitle: "Rastrea y analiza cómo tus esfuerzos de marketing están generando ventas",
16740
+ application_status_banner_title: "Estamos experimentando algunos problemas",
16741
+ application_status_banner_description: "Estamos al tanto de un problema que está afectando al panel. Estamos trabajando en ello y lo resolveremos pronto.",
16742
+ no_metrics_banner_title: "No podemos mostrar ninguna métrica para este rango de fechas",
16743
+ no_metrics_banner_description: "Si has conectado tus cuentas de anuncios recientemente, tus métricas deberían comenzar a poblarse en las próximas 24 horas. Por favor, vuelve pronto.",
16445
16744
  reach_managed_campaign_banner: "Tus anuncios están siendo gestionados por Reach. Automáticamente los optimizaremos para obtener los mejores resultados."
16446
16745
  }
16447
16746
  };
@@ -16823,8 +17122,6 @@ const esCommon = {
16823
17122
  "continue": "Continuar",
16824
17123
  connected,
16825
17124
  connecting,
16826
- reauth_required,
16827
- reauth_required_description,
16828
17125
  reauthenticate,
16829
17126
  account_settings,
16830
17127
  manage_account_settings,
@@ -16955,6 +17252,10 @@ const defaultTranslations = {
16955
17252
  dashboard: {
16956
17253
  title: "Marketing ROI Dashboard",
16957
17254
  subtitle: "Track and analyze how your marketing efforts are driving sales",
17255
+ application_status_banner_title: "We are experiencing some issues",
17256
+ application_status_banner_description: "We are aware of an issue affecting the dashboard. We are working on it and will have it resolved soon.",
17257
+ no_metrics_banner_title: "We are unable to display any metrics for this date range",
17258
+ no_metrics_banner_description: "If you have just connected your ad accounts, your metrics should begin populating within the next 24 hours. Please check back soon.",
16958
17259
  reach_managed_campaign_banner: "Your ads are being managed by Reach. We’ll automatically optimize them to drive the best results."
16959
17260
  }
16960
17261
  },
@@ -45297,6 +45598,11 @@ class BufferedCryptoRandom {
45297
45598
  let defaultGenerator;
45298
45599
  const uuidv7 = () => uuidv7obj().toString();
45299
45600
  const uuidv7obj = () => (defaultGenerator || (defaultGenerator = new V7Generator())).generate();
45601
+ function UnreachableCaseStatement$1(x3, enumObj) {
45602
+ throw new Error(
45603
+ `Unreachable case statement: ${JSON.stringify(x3)}. Valid values are: ${Object.values(enumObj).join(", ")}`
45604
+ );
45605
+ }
45300
45606
  const createCommunicationGroup = async (params) => {
45301
45607
  const response = await baseRequest(
45302
45608
  `${COMMUNICATION_GROUP_PATH}`,
@@ -45760,7 +46066,10 @@ const SetAutomationNameAndDescription = ({
45760
46066
  }
45761
46067
  };
45762
46068
  return /* @__PURE__ */ jsxs("div", { className: "flex flex-col items-center justify-center p-8 max-w-lg mx-auto", children: [
45763
- /* @__PURE__ */ jsx("h2", { className: "text-2xl font-semibold mb-8 text-center", children: "Name Your Automation" }),
46069
+ /* @__PURE__ */ jsxs("h2", { className: "text-2xl font-semibold mb-8 text-center", children: [
46070
+ "Name Your ",
46071
+ t("engage:automation")
46072
+ ] }),
45764
46073
  /* @__PURE__ */ jsxs("div", { className: "w-full space-y-6", children: [
45765
46074
  /* @__PURE__ */ jsx("div", { className: "bg-gray-50 p-6 rounded-xl items-center justify-center text-center", children: getAutomationComponent() }),
45766
46075
  /* @__PURE__ */ jsxs("div", { className: "space-y-6", children: [
@@ -45808,7 +46117,7 @@ const SetAutomationNameAndDescription = ({
45808
46117
  value: automationDescription,
45809
46118
  onChange: (e4) => setAutomationDescription(e4.target.value),
45810
46119
  className: "w-full min-h-[80px] resize-none",
45811
- placeholder: "Add any helpful context for your team..."
46120
+ placeholder: `Add any helpful context for your team. If left blank, we'll generate one for you when you start the ${t("engage:automation")}`
45812
46121
  }
45813
46122
  )
45814
46123
  ] })
@@ -45857,7 +46166,7 @@ const CreateAutomationModal = ({
45857
46166
  day: "numeric"
45858
46167
  });
45859
46168
  const autoName = `${t("engage:automation")} ${formattedDate} ${formattedTime}`;
45860
- const autoDescription = `${t("engage:automation_other")} ${formattedDate} ${formattedTime}`;
46169
+ const autoDescription = "";
45861
46170
  setAutomationState((prevState) => ({
45862
46171
  ...prevState,
45863
46172
  name: autoName,
@@ -45920,40 +46229,50 @@ const CreateAutomationModal = ({
45920
46229
  if (isCreating || startedCreating) {
45921
46230
  return /* @__PURE__ */ jsx("div", { className: styles$3.container, children: /* @__PURE__ */ jsx(BasicLoader, { text: ["Creating Automation", "Finishing up"] }) });
45922
46231
  }
45923
- return /* @__PURE__ */ jsxs("div", { className: "relative overflow-y-auto h-full p-8", children: [
45924
- /* @__PURE__ */ jsxs(AnimatePresence, { children: [
45925
- currentStep === CreateAutomationModalStep.ChooseAutomationType && /* @__PURE__ */ jsx(BlurDiv, { children: /* @__PURE__ */ jsx(
45926
- ChooseAutomationType,
45927
- {
45928
- onNext: (selectedType) => {
45929
- setAutomationState({ ...automationState, type: selectedType });
45930
- setCurrentStep(CreateAutomationModalStep.SetAutomationName);
45931
- },
45932
- iconDefinitions: finalIconDefinitions
45933
- }
45934
- ) }, "choose-automation-type"),
45935
- currentStep === CreateAutomationModalStep.SetAutomationName && automationState.type && /* @__PURE__ */ jsx(BlurDiv, { children: /* @__PURE__ */ jsx(
45936
- SetAutomationNameAndDescription,
45937
- {
45938
- iconDefinitions: finalIconDefinitions,
45939
- selectedType: automationState.type,
45940
- setAutomationName: (name) => {
45941
- setAutomationState({
45942
- ...automationState,
45943
- name
45944
- });
45945
- },
45946
- automationName: automationState.name ?? "",
45947
- setAutomationDescription: (description2) => {
45948
- setAutomationState({
45949
- ...automationState,
45950
- description: description2
45951
- });
45952
- },
45953
- automationDescription: automationState.description ?? ""
46232
+ const renderContent = () => {
46233
+ switch (currentStep) {
46234
+ case CreateAutomationModalStep.ChooseAutomationType:
46235
+ return /* @__PURE__ */ jsx(
46236
+ ChooseAutomationType,
46237
+ {
46238
+ onNext: (selectedType) => {
46239
+ setAutomationState({ ...automationState, type: selectedType });
46240
+ setCurrentStep(CreateAutomationModalStep.SetAutomationName);
46241
+ },
46242
+ iconDefinitions: finalIconDefinitions
46243
+ }
46244
+ );
46245
+ case CreateAutomationModalStep.SetAutomationName:
46246
+ if (!automationState.type) {
46247
+ return null;
45954
46248
  }
45955
- ) }, "set-automation-name")
45956
- ] }),
46249
+ return /* @__PURE__ */ jsx(
46250
+ SetAutomationNameAndDescription,
46251
+ {
46252
+ iconDefinitions: finalIconDefinitions,
46253
+ selectedType: automationState.type,
46254
+ setAutomationName: (name) => {
46255
+ setAutomationState({
46256
+ ...automationState,
46257
+ name
46258
+ });
46259
+ },
46260
+ automationName: automationState.name ?? "",
46261
+ setAutomationDescription: (description2) => {
46262
+ setAutomationState({
46263
+ ...automationState,
46264
+ description: description2
46265
+ });
46266
+ },
46267
+ automationDescription: automationState.description ?? ""
46268
+ }
46269
+ );
46270
+ default:
46271
+ throw UnreachableCaseStatement$1(currentStep, CreateAutomationModalStep);
46272
+ }
46273
+ };
46274
+ return /* @__PURE__ */ jsxs("div", { className: "relative overflow-y-auto h-full p-8", children: [
46275
+ /* @__PURE__ */ jsx(AnimatePresence, { mode: "wait", children: /* @__PURE__ */ jsx(BlurDiv, { children: renderContent() }, currentStep) }),
45957
46276
  /* @__PURE__ */ jsx("div", { className: "pt-2", children: /* @__PURE__ */ jsx(
45958
46277
  ActionButtons,
45959
46278
  {
@@ -46147,7 +46466,7 @@ function isDate$2(val) {
46147
46466
  return __toString.call(val) === "[object Date]";
46148
46467
  }
46149
46468
  /**
46150
- * react-router v7.1.0
46469
+ * react-router v7.5.2
46151
46470
  *
46152
46471
  * Copyright (c) Remix Software Inc.
46153
46472
  *
@@ -46558,7 +46877,7 @@ function decodePath(value) {
46558
46877
  } catch (error2) {
46559
46878
  warning(
46560
46879
  false,
46561
- `The URL path "${value}" could not be decoded because it is is a malformed URL segment. This is probably due to a bad percent encoding (${error2}).`
46880
+ `The URL path "${value}" could not be decoded because it is a malformed URL segment. This is probably due to a bad percent encoding (${error2}).`
46562
46881
  );
46563
46882
  return value;
46564
46883
  }
@@ -46825,7 +47144,7 @@ function useRoutesImpl(routes, locationArg, dataRouterState, future) {
46825
47144
  // router loaded. We can help them understand how to avoid that.
46826
47145
  `useRoutes() may be used only in the context of a <Router> component.`
46827
47146
  );
46828
- let { navigator: navigator2 } = React.useContext(NavigationContext$1);
47147
+ let { navigator: navigator2, static: isStatic } = React.useContext(NavigationContext$1);
46829
47148
  let { matches: parentMatches } = React.useContext(RouteContext);
46830
47149
  let routeMatch = parentMatches[parentMatches.length - 1];
46831
47150
  let parentParams = routeMatch ? routeMatch.params : {};
@@ -46854,7 +47173,7 @@ Please change the parent <Route path="${parentPath}"> to <Route path="${parentPa
46854
47173
  let segments = pathname.replace(/^\//, "").split("/");
46855
47174
  remainingPathname = "/" + segments.slice(parentSegments.length).join("/");
46856
47175
  }
46857
- let matches = matchRoutes(routes, { pathname: remainingPathname });
47176
+ let matches = !isStatic && dataRouterState && dataRouterState.matches && dataRouterState.matches.length > 0 ? dataRouterState.matches : matchRoutes(routes, { pathname: remainingPathname });
46858
47177
  {
46859
47178
  warning(
46860
47179
  parentRoute || matches != null,
@@ -47483,12 +47802,21 @@ function getNewMatchesForLinks(page, nextMatches, currentMatches, manifest, loca
47483
47802
  }
47484
47803
  return [];
47485
47804
  }
47486
- function getModuleLinkHrefs(matches, manifestPatch) {
47805
+ function getModuleLinkHrefs(matches, manifest, { includeHydrateFallback } = {}) {
47487
47806
  return dedupeHrefs(
47488
47807
  matches.map((match2) => {
47489
- let route = manifestPatch.routes[match2.route.id];
47808
+ let route = manifest.routes[match2.route.id];
47490
47809
  if (!route) return [];
47491
47810
  let hrefs = [route.module];
47811
+ if (route.clientActionModule) {
47812
+ hrefs = hrefs.concat(route.clientActionModule);
47813
+ }
47814
+ if (route.clientLoaderModule) {
47815
+ hrefs = hrefs.concat(route.clientLoaderModule);
47816
+ }
47817
+ if (includeHydrateFallback && route.hydrateFallbackModule) {
47818
+ hrefs = hrefs.concat(route.hydrateFallbackModule);
47819
+ }
47492
47820
  if (route.imports) {
47493
47821
  hrefs = hrefs.concat(route.imports);
47494
47822
  }
@@ -47519,7 +47847,8 @@ function dedupeLinkDescriptors(descriptors, preloads) {
47519
47847
  return deduped;
47520
47848
  }, []);
47521
47849
  }
47522
- function singleFetchUrl(reqUrl) {
47850
+ var NO_BODY_STATUS_CODES = /* @__PURE__ */ new Set([100, 101, 204, 205]);
47851
+ function singleFetchUrl(reqUrl, basename) {
47523
47852
  let url = typeof reqUrl === "string" ? new URL(
47524
47853
  reqUrl,
47525
47854
  // This can be called during the SSR flow via PrefetchPageLinksImpl so
@@ -47528,6 +47857,8 @@ function singleFetchUrl(reqUrl) {
47528
47857
  ) : reqUrl;
47529
47858
  if (url.pathname === "/") {
47530
47859
  url.pathname = "_root.data";
47860
+ } else if (basename && stripBasename(url.pathname, basename) === "/") {
47861
+ url.pathname = `${basename.replace(/\/$/, "")}/_root.data`;
47531
47862
  } else {
47532
47863
  url.pathname = `${url.pathname.replace(/\/$/, "")}.data`;
47533
47864
  }
@@ -47664,6 +47995,7 @@ function PrefetchPageLinksImpl({
47664
47995
  }) {
47665
47996
  let location2 = useLocation();
47666
47997
  let { manifest, routeModules } = useFrameworkContext();
47998
+ let { basename } = useDataRouterContext2();
47667
47999
  let { loaderData, matches } = useDataRouterStateContext();
47668
48000
  let newMatchesForData = React.useMemo(
47669
48001
  () => getNewMatchesForLinks(
@@ -47709,7 +48041,7 @@ function PrefetchPageLinksImpl({
47709
48041
  if (routesParams.size === 0) {
47710
48042
  return [];
47711
48043
  }
47712
- let url = singleFetchUrl(page);
48044
+ let url = singleFetchUrl(page, basename);
47713
48045
  if (foundOptOutRoute && routesParams.size > 0) {
47714
48046
  url.searchParams.set(
47715
48047
  "_routes",
@@ -47718,6 +48050,7 @@ function PrefetchPageLinksImpl({
47718
48050
  }
47719
48051
  return [url.pathname + url.search];
47720
48052
  }, [
48053
+ basename,
47721
48054
  loaderData,
47722
48055
  location2,
47723
48056
  manifest,
@@ -47731,7 +48064,7 @@ function PrefetchPageLinksImpl({
47731
48064
  [newMatchesForAssets, manifest]
47732
48065
  );
47733
48066
  let keyedPrefetchLinks = useKeyedPrefetchLinks(newMatchesForAssets);
47734
- return /* @__PURE__ */ React.createElement(React.Fragment, null, dataHrefs.map((href) => /* @__PURE__ */ React.createElement("link", { key: href, rel: "prefetch", as: "fetch", href, ...linkProps })), moduleHrefs.map((href) => /* @__PURE__ */ React.createElement("link", { key: href, rel: "modulepreload", href, ...linkProps })), keyedPrefetchLinks.map(({ key, link: link2 }) => (
48067
+ return /* @__PURE__ */ React.createElement(React.Fragment, null, dataHrefs.map((href2) => /* @__PURE__ */ React.createElement("link", { key: href2, rel: "prefetch", as: "fetch", href: href2, ...linkProps })), moduleHrefs.map((href2) => /* @__PURE__ */ React.createElement("link", { key: href2, rel: "modulepreload", href: href2, ...linkProps })), keyedPrefetchLinks.map(({ key, link: link2 }) => (
47735
48068
  // these don't spread `linkProps` because they are full link descriptors
47736
48069
  // already with their own props
47737
48070
  /* @__PURE__ */ React.createElement("link", { key, ...link2 })
@@ -47751,7 +48084,7 @@ function mergeRefs(...refs) {
47751
48084
  var isBrowser = typeof window !== "undefined" && typeof window.document !== "undefined" && typeof window.document.createElement !== "undefined";
47752
48085
  try {
47753
48086
  if (isBrowser) {
47754
- window.__reactRouterVersion = "7.1.0";
48087
+ window.__reactRouterVersion = "7.5.2";
47755
48088
  }
47756
48089
  } catch (e4) {
47757
48090
  }
@@ -47795,7 +48128,7 @@ var Link = React.forwardRef(
47795
48128
  }
47796
48129
  }
47797
48130
  }
47798
- let href = useHref(to, { relative });
48131
+ let href2 = useHref(to, { relative });
47799
48132
  let [shouldPrefetch, prefetchRef, prefetchHandlers] = usePrefetchBehavior(
47800
48133
  prefetch,
47801
48134
  rest
@@ -47821,7 +48154,7 @@ var Link = React.forwardRef(
47821
48154
  {
47822
48155
  ...rest,
47823
48156
  ...prefetchHandlers,
47824
- href: absoluteHref || href,
48157
+ href: absoluteHref || href2,
47825
48158
  onClick: isExternal || reloadDocument ? onClick : handleClick,
47826
48159
  ref: mergeRefs(forwardedRef, prefetchRef),
47827
48160
  target,
@@ -47829,7 +48162,7 @@ var Link = React.forwardRef(
47829
48162
  }
47830
48163
  )
47831
48164
  );
47832
- return shouldPrefetch && !isAbsolute ? /* @__PURE__ */ React.createElement(React.Fragment, null, link2, /* @__PURE__ */ React.createElement(PrefetchPageLinks, { page: href })) : link2;
48165
+ return shouldPrefetch && !isAbsolute ? /* @__PURE__ */ React.createElement(React.Fragment, null, link2, /* @__PURE__ */ React.createElement(PrefetchPageLinks, { page: href2 })) : link2;
47833
48166
  }
47834
48167
  );
47835
48168
  Link.displayName = "Link";
@@ -48120,6 +48453,10 @@ function useViewTransitionState(to, opts = {}) {
48120
48453
  return matchPath(path2.pathname, nextPath) != null || matchPath(path2.pathname, currentPath) != null;
48121
48454
  }
48122
48455
  new TextEncoder();
48456
+ /* @__PURE__ */ new Set([
48457
+ ...NO_BODY_STATUS_CODES,
48458
+ 304
48459
+ ]);
48123
48460
  const AnimatedTabs = ({
48124
48461
  tabs,
48125
48462
  activeTab,
@@ -52550,12 +52887,10 @@ const BrandLoader = ({
52550
52887
  ] })
52551
52888
  ] }) : null });
52552
52889
  };
52553
- const AutoParseConfirmWebsite = ({ setAutoParse, onBrandSettingsGenerated }) => {
52890
+ const AutoParseConfirmWebsite = ({ setAutoParse, onBrandSettingsGenerated, onForceRefresh }) => {
52554
52891
  const [websiteUrl, setWebsiteUrl] = useState("");
52555
52892
  const [isEditing, setIsEditing] = useState(false);
52556
- const [brandSettings, setBrandSettings] = useState(
52557
- null
52558
- );
52893
+ const [brandSettings, setBrandSettings] = useState(null);
52559
52894
  const [isAnalyzing, setIsAnalyzing] = useState(false);
52560
52895
  const [showBrandResults, setShowBrandResults] = useState(false);
52561
52896
  const [isInitialFetch, setIsInitialFetch] = useState(true);
@@ -52618,8 +52953,7 @@ const AutoParseConfirmWebsite = ({ setAutoParse, onBrandSettingsGenerated }) =>
52618
52953
  const handleUpdateBrandSettings = () => {
52619
52954
  if (brandSettings) {
52620
52955
  updateBrandSettings({
52621
- // TODO: Add logo_base64 back in once we are able to compress the image
52622
- // logo_base64: brandSettings.logo_base64,
52956
+ logoBase64: brandSettings.logo_base64,
52623
52957
  primaryColor: brandSettings.primaryColor,
52624
52958
  secondaryColors: brandSettings.secondaryColors,
52625
52959
  brandTagline: brandSettings.brandTagline,
@@ -52627,6 +52961,9 @@ const AutoParseConfirmWebsite = ({ setAutoParse, onBrandSettingsGenerated }) =>
52627
52961
  brandPersonality: brandSettings.brandPersonality,
52628
52962
  colorPalette: brandSettings.colorPalette
52629
52963
  });
52964
+ if (onForceRefresh) {
52965
+ onForceRefresh();
52966
+ }
52630
52967
  toast({
52631
52968
  title: "Brand settings saved successfully 🚀",
52632
52969
  description: "Your brand identity has been updated."
@@ -52864,6 +53201,7 @@ const BrandSettingsModal = () => {
52864
53201
  const [autoParse, setAutoParse] = useState(false);
52865
53202
  const [logoUrl, setLogoUrl] = useState(void 0);
52866
53203
  const [hexInput, setHexInput] = useState("");
53204
+ const [imageTimestamp, setImageTimestamp] = useState(Date.now());
52867
53205
  const fileInputRef = useRef(null);
52868
53206
  const { toast: toast2 } = useToast();
52869
53207
  useEffect(() => {
@@ -52874,6 +53212,7 @@ const BrandSettingsModal = () => {
52874
53212
  }
52875
53213
  if (meResponse?.branding?.logoUrl) {
52876
53214
  setLogoUrl(meResponse.branding.logoUrl);
53215
+ setImageTimestamp(Date.now());
52877
53216
  }
52878
53217
  }, [meResponse]);
52879
53218
  const handleColorChange = (color2) => {
@@ -52895,7 +53234,7 @@ const BrandSettingsModal = () => {
52895
53234
  const base64String = reader.result;
52896
53235
  setLogoUrl(base64String);
52897
53236
  updateBrandSettings({
52898
- logoUrl: base64String
53237
+ logoBase64: base64String
52899
53238
  });
52900
53239
  };
52901
53240
  reader.readAsDataURL(file);
@@ -52924,7 +53263,13 @@ const BrandSettingsModal = () => {
52924
53263
  title: "Brand settings saved 🚀"
52925
53264
  });
52926
53265
  };
52927
- return /* @__PURE__ */ jsx("div", { className: "w-full bg-white rounded-lg shadow-sm min-h-[500px]", children: autoParse ? /* @__PURE__ */ jsx(AutoParseConfirmWebsite, { setAutoParse }) : /* @__PURE__ */ jsxs(Fragment, { children: [
53266
+ return /* @__PURE__ */ jsx("div", { className: "w-full bg-white rounded-lg shadow-sm min-h-[500px]", children: autoParse ? /* @__PURE__ */ jsx(
53267
+ AutoParseConfirmWebsite,
53268
+ {
53269
+ setAutoParse,
53270
+ onForceRefresh: () => setImageTimestamp(Date.now())
53271
+ }
53272
+ ) : /* @__PURE__ */ jsxs(Fragment, { children: [
52928
53273
  /* @__PURE__ */ jsxs("div", { className: "relative", children: [
52929
53274
  /* @__PURE__ */ jsx(
52930
53275
  "div",
@@ -52950,10 +53295,11 @@ const BrandSettingsModal = () => {
52950
53295
  /* @__PURE__ */ jsx("div", { className: "w-20 h-20 rounded-md border border-gray-200 overflow-hidden bg-gray-50 flex items-center justify-center", children: logoUrl ? /* @__PURE__ */ jsx(
52951
53296
  "img",
52952
53297
  {
52953
- src: logoUrl,
53298
+ src: `${logoUrl}?${imageTimestamp}`,
52954
53299
  alt: "Brand logo",
52955
53300
  className: "w-full h-full object-cover"
52956
- }
53301
+ },
53302
+ imageTimestamp
52957
53303
  ) : /* @__PURE__ */ jsx(Image, { className: "h-6 w-6 text-gray-300" }) }),
52958
53304
  /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-1", children: [
52959
53305
  /* @__PURE__ */ jsx(
@@ -64647,8 +64993,8 @@ const useCommunicationUpdateTracking = () => {
64647
64993
  };
64648
64994
  const useRecipientStats = (automation2) => {
64649
64995
  const { data: estimatedMatches } = useGetCountOfBusinessAutomationRecipients({
64650
- include_segments: automation2?.includeSegmentIds ?? [],
64651
- exclude_segments: automation2?.excludeSegmentIds ?? []
64996
+ includeSegments: automation2?.includeSegmentIds ?? [],
64997
+ excludeSegments: automation2?.excludeSegmentIds ?? []
64652
64998
  });
64653
64999
  const estimatedMatchesStats = useMemo(() => {
64654
65000
  if (!estimatedMatches?.recipients) return { emails: 0, phones: 0 };
@@ -64874,12 +65220,16 @@ const EmailPreview$1 = ({
64874
65220
  ] });
64875
65221
  };
64876
65222
  const SMSPreview$1 = ({ fromPhone, body }) => {
64877
- return /* @__PURE__ */ jsxs("div", { className: "max-w-sm mx-auto min-h-[400px] flex flex-col justify-center flex-1", children: [
64878
- /* @__PURE__ */ jsx("div", { className: "bg-gray-50 p-5 rounded-lg border border-gray-100 mb-6", children: /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-3", children: [
64879
- /* @__PURE__ */ jsx("span", { className: "font-medium text-gray-700", children: "From:" }),
64880
- /* @__PURE__ */ jsx("span", { className: "text-gray-800", children: fromPhone })
64881
- ] }) }),
64882
- /* @__PURE__ */ jsx("div", { className: "border-4 border-gray-800 rounded-3xl p-1 bg-gray-800 shadow-xl mx-auto max-w-xs transform scale-[0.8] origin-top", children: /* @__PURE__ */ jsx("div", { className: "bg-gray-100 rounded-2xl p-4 h-[500px] w-[280px] aspect-[9/16] overflow-y-auto", children: /* @__PURE__ */ jsx("div", { className: "flex justify-end mb-4", children: /* @__PURE__ */ jsx("div", { className: "bg-green-500 text-white rounded-2xl rounded-tr-sm py-3 px-4 max-w-[80%] shadow-sm whitespace-pre-wrap text-[1.5rem]", children: body }) }) }) })
65223
+ return /* @__PURE__ */ jsxs("div", { className: "sms-preview-outer @container", children: [
65224
+ /* @__PURE__ */ jsxs("div", { className: "sms-preview-header", children: [
65225
+ /* @__PURE__ */ jsx("span", { className: "sms-preview-header-label", children: "From:" }),
65226
+ /* @__PURE__ */ jsx("span", { className: "sms-preview-header-phone", children: fromPhone })
65227
+ ] }),
65228
+ /* @__PURE__ */ jsxs("div", { className: "sms-phone-mockup", children: [
65229
+ /* @__PURE__ */ jsx("div", { className: "sms-phone-notch" }),
65230
+ /* @__PURE__ */ jsx("div", { className: "sms-phone-inner", children: /* @__PURE__ */ jsx("div", { className: "sms-message-row", children: /* @__PURE__ */ jsx("div", { className: "sms-message-bubble", children: body }) }) }),
65231
+ /* @__PURE__ */ jsx("div", { className: "sms-phone-home-indicator" })
65232
+ ] })
64883
65233
  ] });
64884
65234
  };
64885
65235
  const PreviewPanel = ({ emailPreview, smsPreview, iconDefinitions }) => {
@@ -64899,7 +65249,7 @@ const PreviewPanel = ({ emailPreview, smsPreview, iconDefinitions }) => {
64899
65249
  initial: { opacity: 0, y: -20 },
64900
65250
  animate: { opacity: 1, y: 0 },
64901
65251
  transition: { duration: 0.5, delay: 0.1 },
64902
- className: "w-full flex flex-col h-full flex-1 min-h-0",
65252
+ className: "w-full flex flex-col h-full flex-1 min-h-0 relative",
64903
65253
  children: /* @__PURE__ */ jsxs("div", { className: "bg-gray-200 rounded-xl shadow-lg border border-gray-100 overflow-hidden flex-1 min-h-0 flex flex-col", children: [
64904
65254
  /* @__PURE__ */ jsxs("div", { className: "flex border-b border-border bg-background", children: [
64905
65255
  emailPreview && /* @__PURE__ */ jsxs(
@@ -65016,7 +65366,7 @@ ${smsPreview.body}` : smsPreview.body
65016
65366
  ] })
65017
65367
  }
65018
65368
  ),
65019
- /* @__PURE__ */ jsx(Dialog, { open: isExpanded, onOpenChange: setIsExpanded, children: /* @__PURE__ */ jsx(DialogContent, { className: "w-[80vw] h-[80vh] max-w-none max-h-none", children: /* @__PURE__ */ jsxs("div", { className: "h-full flex flex-col", children: [
65369
+ /* @__PURE__ */ jsx(Dialog, { open: isExpanded, onOpenChange: setIsExpanded, children: /* @__PURE__ */ jsx(DialogContent, { className: "w-[80vw] h-[80vh] max-w-none max-h-none", children: /* @__PURE__ */ jsxs("div", { className: "h-full flex flex-col overflow-hidden rounded-xl", children: [
65020
65370
  selectedTab === "email" && emailPreview && /* @__PURE__ */ jsx(
65021
65371
  EmailPreview$1,
65022
65372
  {
@@ -65186,12 +65536,12 @@ const AutomationRecipients = ({
65186
65536
  {
65187
65537
  className: "hover:bg-gray-50/50 transition-colors",
65188
65538
  children: [
65189
- /* @__PURE__ */ jsx(TableCell, { style: { width: COLUMN_WIDTHS.name }, children: recipient.first_name || recipient.last_name ? `${recipient.first_name || ""} ${recipient.last_name || ""}`.trim() : /* @__PURE__ */ jsx("span", { className: "text-gray-400", children: "Not provided" }) }),
65539
+ /* @__PURE__ */ jsx(TableCell, { style: { width: COLUMN_WIDTHS.name }, children: recipient.firstName || recipient.lastName ? `${recipient.firstName || ""} ${recipient.lastName || ""}`.trim() : /* @__PURE__ */ jsx("span", { className: "text-gray-400", children: "Not provided" }) }),
65190
65540
  /* @__PURE__ */ jsx(TableCell, { style: { width: COLUMN_WIDTHS.email }, children: recipient.email || /* @__PURE__ */ jsx("span", { className: "text-gray-400", children: "Not provided" }) }),
65191
65541
  /* @__PURE__ */ jsx(TableCell, { style: { width: COLUMN_WIDTHS.phone }, children: recipient.phone || /* @__PURE__ */ jsx("span", { className: "text-gray-400", children: "Not provided" }) })
65192
65542
  ]
65193
65543
  },
65194
- recipient.reach_id
65544
+ recipient.reachId
65195
65545
  )) })
65196
65546
  ] })
65197
65547
  ] });
@@ -66866,54 +67216,97 @@ var AutomationSteps = /* @__PURE__ */ ((AutomationSteps2) => {
66866
67216
  })(AutomationSteps || {});
66867
67217
  const validateAutomationStep = async (args) => {
66868
67218
  const { currentStep, automation: automation2, communicationGroup } = args;
66869
- if (currentStep === 0) {
66870
- return {
66871
- canMove: true,
66872
- errorMessage: null
66873
- };
66874
- }
66875
- if (currentStep === 1) {
66876
- return {
66877
- canMove: automation2.includeSegmentIds.length > 0,
66878
- errorMessage: "Please ensure you have selected at least one segment"
66879
- };
66880
- }
66881
- if (currentStep === 2) {
66882
- const actionDataCommunication = automation2.actionData?.find(
66883
- (action) => action.actionType === "send_communication"
66884
- );
66885
- if (!actionDataCommunication) {
67219
+ switch (currentStep) {
67220
+ case 0:
66886
67221
  return {
66887
- canMove: false,
66888
- errorMessage: "Please ensure you have selected either a email communication or text communication"
67222
+ canMove: true,
67223
+ errorMessage: null
66889
67224
  };
66890
- }
66891
- if (!communicationGroup || !communicationGroup.smsChannelSenderId && !communicationGroup.emailChannelSenderId) {
67225
+ case 1:
66892
67226
  return {
66893
- canMove: false,
66894
- errorMessage: "Please ensure you have selected either a email communication or text communication"
67227
+ canMove: automation2.includeSegmentIds.length > 0,
67228
+ errorMessage: "Please ensure you have selected at least one segment"
66895
67229
  };
66896
- }
66897
- if (communicationGroup.emailChannelSenderId) {
66898
- if (!communicationGroup.emailHtmlBody || !communicationGroup.emailSubject) {
67230
+ case 2: {
67231
+ const actionDataCommunication = automation2.actionData?.find(
67232
+ (action) => action.actionType === "send_communication"
67233
+ );
67234
+ if (!actionDataCommunication) {
66899
67235
  return {
66900
67236
  canMove: false,
66901
- errorMessage: "Please ensure you have a email body and subject"
67237
+ errorMessage: "Please ensure you have selected either a email communication or text communication"
66902
67238
  };
66903
67239
  }
66904
- }
66905
- if (communicationGroup.smsChannelSenderId) {
66906
- if (!communicationGroup.smsMessageBody) {
67240
+ if (!communicationGroup || !communicationGroup.smsChannelSenderId && !communicationGroup.emailChannelSenderId) {
66907
67241
  return {
66908
67242
  canMove: false,
66909
- errorMessage: "Please ensure you have a sms message body"
67243
+ errorMessage: "Please ensure you have selected either a email communication or text communication"
66910
67244
  };
66911
67245
  }
67246
+ if (communicationGroup.emailChannelSenderId) {
67247
+ if (!communicationGroup.emailHtmlBody || !communicationGroup.emailSubject) {
67248
+ return {
67249
+ canMove: false,
67250
+ errorMessage: "Please ensure you have a email body and subject"
67251
+ };
67252
+ }
67253
+ }
67254
+ if (communicationGroup.smsChannelSenderId) {
67255
+ if (!communicationGroup.smsMessageBody) {
67256
+ return {
67257
+ canMove: false,
67258
+ errorMessage: "Please ensure you have a sms message body"
67259
+ };
67260
+ }
67261
+ }
67262
+ return {
67263
+ canMove: true,
67264
+ errorMessage: null
67265
+ };
66912
67266
  }
66913
- }
66914
- if (currentStep === 3) {
66915
- const isOneTime = isOneTimeTriggerMetadata(automation2.triggerMetadata);
66916
- if (isOneTime) {
67267
+ case 3: {
67268
+ if (!automation2.triggerMetadata) {
67269
+ return {
67270
+ canMove: false,
67271
+ errorMessage: "Please make sure to select a time to send before starting!"
67272
+ };
67273
+ }
67274
+ if (automation2.triggerMetadata.triggerType !== AutomationTriggerType.ONE_TIME) {
67275
+ return {
67276
+ canMove: Boolean(
67277
+ automation2.actionData?.some(
67278
+ (action) => action.actionType === "send_communication" && action.actionMetadata.communicationGroupId
67279
+ )
67280
+ ),
67281
+ errorMessage: null
67282
+ };
67283
+ }
67284
+ if (!automation2.triggerMetadata?.scheduledAt) {
67285
+ return {
67286
+ canMove: false,
67287
+ errorMessage: `Please ensure you have set a valid future date for your ${t("engage:one_time")}`
67288
+ };
67289
+ }
67290
+ const hasValidSchedule = Boolean(
67291
+ automation2.triggerMetadata?.scheduledAt && new Date(automation2.triggerMetadata.scheduledAt) > /* @__PURE__ */ new Date()
67292
+ );
67293
+ if (!hasValidSchedule) {
67294
+ return {
67295
+ canMove: false,
67296
+ errorMessage: `Please ensure you have set a valid future date for your ${t("engage:one_time")}`
67297
+ };
67298
+ }
67299
+ const hasValidCommunicationGroup = Boolean(
67300
+ automation2.actionData?.some(
67301
+ (action) => action.actionType === "send_communication" && action.actionMetadata.communicationGroupId
67302
+ )
67303
+ );
67304
+ if (!hasValidCommunicationGroup) {
67305
+ return {
67306
+ canMove: false,
67307
+ errorMessage: "Please ensure you have set a valid email or sms communication"
67308
+ };
67309
+ }
66917
67310
  const oneTimeMetadata = automation2.triggerMetadata;
66918
67311
  return {
66919
67312
  canMove: Boolean(
@@ -66924,33 +67317,9 @@ const validateAutomationStep = async (args) => {
66924
67317
  errorMessage: `Please ensure you have set a valid future date for your ${t("engage:one_time")} automation`
66925
67318
  };
66926
67319
  }
66927
- return {
66928
- canMove: Boolean(
66929
- automation2.actionData?.some(
66930
- (action) => action.actionType === "send_communication" && action.actionMetadata.communicationGroupId
66931
- )
66932
- ),
66933
- errorMessage: null
66934
- };
67320
+ default:
67321
+ UnreachableCaseStatement(currentStep, AutomationSteps);
66935
67322
  }
66936
- return {
66937
- canMove: true,
66938
- errorMessage: null
66939
- };
66940
- };
66941
- const mergeFieldTemplateCreator = (args) => {
66942
- const { mergeFieldName } = args;
66943
- return `{{${mergeFieldName}}}`;
66944
- };
66945
- const useDebounce = (value, delay2) => {
66946
- const [debouncedValue, setDebouncedValue] = useState(value);
66947
- useEffect(() => {
66948
- const timer = setTimeout(() => {
66949
- setDebouncedValue(value);
66950
- }, delay2);
66951
- return () => clearTimeout(timer);
66952
- }, [value, delay2]);
66953
- return debouncedValue;
66954
67323
  };
66955
67324
  const getChannelAccounts = async () => {
66956
67325
  const response = await baseRequest(
@@ -66980,6 +67349,20 @@ var ChannelAccountTypeEnum = /* @__PURE__ */ ((ChannelAccountTypeEnum2) => {
66980
67349
  ChannelAccountTypeEnum2["TWILLIO"] = "twillio";
66981
67350
  return ChannelAccountTypeEnum2;
66982
67351
  })(ChannelAccountTypeEnum || {});
67352
+ const mergeFieldTemplateCreator = (args) => {
67353
+ const { mergeFieldName } = args;
67354
+ return `{{${mergeFieldName}}}`;
67355
+ };
67356
+ const useDebounce = (value, delay2) => {
67357
+ const [debouncedValue, setDebouncedValue] = useState(value);
67358
+ useEffect(() => {
67359
+ const timer = setTimeout(() => {
67360
+ setDebouncedValue(value);
67361
+ }, delay2);
67362
+ return () => clearTimeout(timer);
67363
+ }, [value, delay2]);
67364
+ return debouncedValue;
67365
+ };
66983
67366
  const EmailPreviewHelpDialog = () => {
66984
67367
  return /* @__PURE__ */ jsxs("div", { className: "p-6 overflow-y-auto", children: [
66985
67368
  /* @__PURE__ */ jsxs("div", { className: "mb-8 text-center", children: [
@@ -67460,9 +67843,14 @@ const EmailPreview = ({ mergeFieldsResponse }) => {
67460
67843
  if (debouncedReplyToEmail) {
67461
67844
  const emailRegex = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
67462
67845
  const isValidEmail = emailRegex.test(debouncedReplyToEmail);
67463
- setReplyToEmailError(
67464
- isValidEmail ? null : "Please enter a valid email address"
67465
- );
67846
+ const hasEmoji = /\p{Emoji}/u.test(debouncedReplyToEmail);
67847
+ if (hasEmoji) {
67848
+ setReplyToEmailError("Emojis are not allowed in email addresses");
67849
+ } else if (!isValidEmail) {
67850
+ setReplyToEmailError("Please enter a valid email address");
67851
+ } else {
67852
+ setReplyToEmailError(null);
67853
+ }
67466
67854
  } else {
67467
67855
  setReplyToEmailError(null);
67468
67856
  }
@@ -67474,7 +67862,6 @@ const EmailPreview = ({ mergeFieldsResponse }) => {
67474
67862
  (sender) => sender.id === args.fromEmail
67475
67863
  );
67476
67864
  if (channelSender) {
67477
- console.log("Updating reply-to email:", args.debouncedReplyToEmail);
67478
67865
  updateChannelSender2({
67479
67866
  id: args.fromEmail,
67480
67867
  toUpdate: {
@@ -67528,60 +67915,70 @@ const EmailPreview = ({ mergeFieldsResponse }) => {
67528
67915
  ] }),
67529
67916
  /* @__PURE__ */ jsx(EmailPreviewHelpDialog, {})
67530
67917
  ] }) }),
67531
- /* @__PURE__ */ jsx(Dialog, { open: showStripoEditor, onOpenChange: setShowStripoEditor, children: /* @__PURE__ */ jsxs(DialogContent, { className: "min-w-[100vw] min-h-[100vh]", hideCloseButton: true, children: [
67532
- /* @__PURE__ */ jsxs(VisuallyHidden$2, { children: [
67533
- /* @__PURE__ */ jsx(DialogTitle, { children: "Email Editor" }),
67534
- /* @__PURE__ */ jsx(DialogDescription, { children: "Learn more about the email editor and how to use it to create your email." })
67535
- ] }),
67536
- /* @__PURE__ */ jsxs("div", { className: "w-full h-full", children: [
67537
- /* @__PURE__ */ jsxs("div", { className: "flex justify-between items-center p-1 border-b", children: [
67538
- /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
67539
- /* @__PURE__ */ jsx("h2", { className: "text-lg font-medium", children: "Email Editor" }),
67540
- /* @__PURE__ */ jsx(
67541
- InfoTooltip,
67542
- {
67543
- title: "Click to learn more about email template ",
67544
- onClick: () => setShowHelpDialog(true)
67545
- }
67546
- )
67918
+ /* @__PURE__ */ jsx(Dialog, { open: showStripoEditor, onOpenChange: setShowStripoEditor, children: /* @__PURE__ */ jsxs(
67919
+ DialogContent,
67920
+ {
67921
+ className: "min-w-[100vw] min-h-[100vh]",
67922
+ hideCloseButton: true,
67923
+ onEscapeKeyDown: (e4) => {
67924
+ e4.preventDefault();
67925
+ },
67926
+ children: [
67927
+ /* @__PURE__ */ jsxs(VisuallyHidden$2, { children: [
67928
+ /* @__PURE__ */ jsx(DialogTitle, { children: "Email Editor" }),
67929
+ /* @__PURE__ */ jsx(DialogDescription, { children: "Learn more about the email editor and how to use it to create your email." })
67547
67930
  ] }),
67548
- /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
67549
- /* @__PURE__ */ jsx(
67550
- Button$1,
67551
- {
67552
- onClick: () => {
67553
- setCancelClicked(true);
67554
- },
67555
- className: "text-sm px-3 py-1 rounded",
67556
- children: "Cancel"
67557
- }
67558
- ),
67559
- /* @__PURE__ */ jsx(
67560
- Button$1,
67931
+ /* @__PURE__ */ jsxs("div", { className: "w-full h-full", children: [
67932
+ /* @__PURE__ */ jsxs("div", { className: "flex justify-between items-center p-1 border-b", children: [
67933
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
67934
+ /* @__PURE__ */ jsx("h2", { className: "text-lg font-medium", children: "Email Editor" }),
67935
+ /* @__PURE__ */ jsx(
67936
+ InfoTooltip,
67937
+ {
67938
+ title: "Click to learn more about email template ",
67939
+ onClick: () => setShowHelpDialog(true)
67940
+ }
67941
+ )
67942
+ ] }),
67943
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
67944
+ /* @__PURE__ */ jsx(
67945
+ Button$1,
67946
+ {
67947
+ onClick: () => {
67948
+ setCancelClicked(true);
67949
+ },
67950
+ className: "text-sm px-3 py-1 rounded",
67951
+ children: "Cancel"
67952
+ }
67953
+ ),
67954
+ /* @__PURE__ */ jsx(
67955
+ Button$1,
67956
+ {
67957
+ onClick: () => setSaveClicked(true),
67958
+ className: "text-sm px-3 py-1 rounded",
67959
+ children: "Save"
67960
+ }
67961
+ )
67962
+ ] })
67963
+ ] }),
67964
+ /* @__PURE__ */ jsx("div", { className: " w-full", children: automation2 && /* @__PURE__ */ jsx(
67965
+ StripoWrapper,
67561
67966
  {
67562
- onClick: () => setSaveClicked(true),
67563
- className: "text-sm px-3 py-1 rounded",
67564
- children: "Save"
67967
+ cancelClicked,
67968
+ setCancelClicked,
67969
+ showStripoEditor,
67970
+ automation: automation2,
67971
+ setShowStripoEditor,
67972
+ saveClicked,
67973
+ setSaveClicked,
67974
+ stripoDialogDimensions,
67975
+ mergeFieldsResponse
67565
67976
  }
67566
- )
67977
+ ) })
67567
67978
  ] })
67568
- ] }),
67569
- /* @__PURE__ */ jsx("div", { className: " w-full", children: automation2 && /* @__PURE__ */ jsx(
67570
- StripoWrapper,
67571
- {
67572
- cancelClicked,
67573
- setCancelClicked,
67574
- showStripoEditor,
67575
- automation: automation2,
67576
- setShowStripoEditor,
67577
- saveClicked,
67578
- setSaveClicked,
67579
- stripoDialogDimensions,
67580
- mergeFieldsResponse
67581
- }
67582
- ) })
67583
- ] })
67584
- ] }) }),
67979
+ ]
67980
+ }
67981
+ ) }),
67585
67982
  /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-2 gap-6", children: [
67586
67983
  /* @__PURE__ */ jsxs("div", { className: "space-y-4", children: [
67587
67984
  /* @__PURE__ */ jsxs("div", { children: [
@@ -67872,7 +68269,9 @@ var Indicator = CheckboxIndicator;
67872
68269
  const SelectEmailOrSMS = ({
67873
68270
  selectedChannels,
67874
68271
  setSelectedChannels,
67875
- iconDefinitions
68272
+ iconDefinitions,
68273
+ hasEmailChannelSenders,
68274
+ hasSmsChannelSenders
67876
68275
  }) => {
67877
68276
  const { toast: toast2 } = useToast();
67878
68277
  const toggleEmail = () => {
@@ -67906,18 +68305,22 @@ const SelectEmailOrSMS = ({
67906
68305
  setSelectedChannels([...selectedChannels, "sms"]);
67907
68306
  };
67908
68307
  const channelOptions = [
67909
- {
67910
- label: "Email",
67911
- value: "email",
67912
- icon: iconDefinitions.EmailIcon,
67913
- checked: selectedChannels.includes("email")
67914
- },
67915
- {
67916
- label: "SMS",
67917
- value: "sms",
67918
- icon: iconDefinitions.SmsIcon,
67919
- checked: selectedChannels.includes("sms")
67920
- }
68308
+ ...hasEmailChannelSenders ? [
68309
+ {
68310
+ label: "Email",
68311
+ value: "email",
68312
+ icon: iconDefinitions.EmailIcon,
68313
+ checked: selectedChannels.includes("email")
68314
+ }
68315
+ ] : [],
68316
+ ...hasSmsChannelSenders ? [
68317
+ {
68318
+ label: "SMS",
68319
+ value: "sms",
68320
+ icon: iconDefinitions.SmsIcon,
68321
+ checked: selectedChannels.includes("sms")
68322
+ }
68323
+ ] : []
67921
68324
  ];
67922
68325
  return /* @__PURE__ */ jsxs("div", { className: "space-y-4", children: [
67923
68326
  /* @__PURE__ */ jsxs("div", { children: [
@@ -67946,7 +68349,7 @@ const SelectEmailOrSMS = ({
67946
68349
  )) })
67947
68350
  ] });
67948
68351
  };
67949
- const SMSPreview = ({ iconDefinitions, mergeFieldsResponse }) => {
68352
+ const SMSPreview = ({ iconDefinitions, mergeFieldsResponse, smsChannelSenders }) => {
67950
68353
  const automation2 = useAutomation();
67951
68354
  const _getCommunicationGroupFromAutomation = useCallback(() => {
67952
68355
  const actionGroup = automation2?.actionData?.find(
@@ -68046,9 +68449,6 @@ const SMSPreview = ({ iconDefinitions, mergeFieldsResponse }) => {
68046
68449
  if (!channelAccounts || !channelSenders || isMeLoading) {
68047
68450
  return /* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsx(BasicLoader, { text: ["Loading..."] }) });
68048
68451
  }
68049
- const smsChannelSenders = channelSenders.results.filter(
68050
- (sender) => sender.channelSenderMetadata.from || sender.channelSenderMetadata.messageServiceSid
68051
- );
68052
68452
  return /* @__PURE__ */ jsxs("div", { children: [
68053
68453
  /* @__PURE__ */ jsx(Dialog, { open: showSmsEditor, onOpenChange: setShowSmsEditor, children: /* @__PURE__ */ jsxs(DialogContent, { children: [
68054
68454
  /* @__PURE__ */ jsxs(VisuallyHidden$2, { children: [
@@ -68185,6 +68585,8 @@ const EditCampaignContent = ({
68185
68585
  const emailContainerRef = useRef(null);
68186
68586
  const { toast: toast2 } = useToast();
68187
68587
  const communicationGroup = useCommunicationGroup();
68588
+ const { channelSenders } = useChannelSender();
68589
+ const { channelAccounts } = useChannelAccount();
68188
68590
  const { updateCommunicationGroup: updateCommunicationGroup2 } = useUpdateCommunicationGroup();
68189
68591
  const automation2 = useAutomation();
68190
68592
  const { getMergeFields: getMergeFields2, isGetting: isGetMergeFieldsLoading } = useGetMergeFields(communicationGroup?.id ?? void 0);
@@ -68367,16 +68769,44 @@ const EditCampaignContent = ({
68367
68769
  mergeFieldsResponse,
68368
68770
  setSelectedChannelsBasedOnCommunicationGroup
68369
68771
  ]);
68370
- if (!selectedChannels || isGetMergeFieldsLoading || !mergeFieldsResponse) {
68772
+ const emailChannelSendersWithChannelAccounts = useMemo(
68773
+ () => channelSenders?.results?.filter((sender) => sender.channelSenderMetadata.userPart)?.flatMap((sender) => {
68774
+ const channelAccount = channelAccounts?.results?.find(
68775
+ (account) => account.id === sender.channelAccountId
68776
+ );
68777
+ if (!channelAccount) return [];
68778
+ if (channelAccount.channelAccountMetadata.type === ChannelAccountTypeEnum.REACH_MANAGED) {
68779
+ return [
68780
+ {
68781
+ channelSenderId: sender.id,
68782
+ fullDomain: `${sender.channelSenderMetadata.userPart}@${sender.channelSenderMetadata.baseDomain}`
68783
+ }
68784
+ ];
68785
+ }
68786
+ return [];
68787
+ }) || [],
68788
+ [channelSenders?.results, channelAccounts?.results]
68789
+ );
68790
+ const smsChannelSenders = useMemo(
68791
+ () => channelSenders?.results.filter(
68792
+ (sender) => sender.channelSenderMetadata.from || sender.channelSenderMetadata.messageServiceSid
68793
+ ),
68794
+ [channelSenders?.results]
68795
+ );
68796
+ if (!selectedChannels || isGetMergeFieldsLoading || !mergeFieldsResponse || !emailChannelSendersWithChannelAccounts || !smsChannelSenders) {
68371
68797
  return /* @__PURE__ */ jsx("div", { className: "flex justify-center items-center flex-1 h-full bg-white rounded-2xl w-full border border-gray-200 p-6 space-y-4 relative", children: /* @__PURE__ */ jsx(BasicLoader, { text: ["Fetching Content..."] }) });
68372
68798
  }
68799
+ const hasEmailChannelSenders = emailChannelSendersWithChannelAccounts.length > 0;
68800
+ const hasSmsChannelSenders = smsChannelSenders.length > 0;
68373
68801
  return /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-4 flex-shrink-0", children: [
68374
68802
  /* @__PURE__ */ jsx("div", { className: "bg-white rounded-2xl w-full border border-gray-200 p-6 space-y-4 relative", children: /* @__PURE__ */ jsx(
68375
68803
  SelectEmailOrSMS,
68376
68804
  {
68377
68805
  selectedChannels,
68378
68806
  setSelectedChannels,
68379
- iconDefinitions
68807
+ iconDefinitions,
68808
+ hasEmailChannelSenders,
68809
+ hasSmsChannelSenders
68380
68810
  }
68381
68811
  ) }),
68382
68812
  selectedChannels.includes("email") && /* @__PURE__ */ jsxs(
@@ -68390,7 +68820,8 @@ const EditCampaignContent = ({
68390
68820
  EmailPreview,
68391
68821
  {
68392
68822
  iconDefinitions,
68393
- mergeFieldsResponse
68823
+ mergeFieldsResponse,
68824
+ emailChannelSendersWithChannelAccounts
68394
68825
  }
68395
68826
  )
68396
68827
  ]
@@ -68402,7 +68833,8 @@ const EditCampaignContent = ({
68402
68833
  SMSPreview,
68403
68834
  {
68404
68835
  iconDefinitions,
68405
- mergeFieldsResponse
68836
+ mergeFieldsResponse,
68837
+ smsChannelSenders
68406
68838
  }
68407
68839
  )
68408
68840
  ] })
@@ -68477,8 +68909,8 @@ const EstimatedMatchesView = ({
68477
68909
  isLoading: isCountLoading,
68478
68910
  refetchCount
68479
68911
  } = useGetCountOfBusinessAutomationRecipients({
68480
- include_segments: includeSegments,
68481
- exclude_segments: excludeSegments
68912
+ includeSegments,
68913
+ excludeSegments
68482
68914
  });
68483
68915
  useEffect(() => {
68484
68916
  refetchCount();
@@ -68802,8 +69234,9 @@ const OneTimeBroadcastMetadata = ({ automation: automation2 }) => {
68802
69234
  ] })
68803
69235
  ] });
68804
69236
  };
68805
- const SelectTime = ({ iconDefinitions, automation: automation2, updateAutomation: updateAutomation2 }) => {
69237
+ const SelectTime = ({ iconDefinitions, automation: automation2 }) => {
68806
69238
  const [deliveryOption, setDeliveryOption] = useState(null);
69239
+ const { updateAutomation: businessUpdateAutomation } = useUpdateBusinessAutomation(automation2?.id || "");
68807
69240
  return /* @__PURE__ */ jsx("div", { className: "@container", children: /* @__PURE__ */ jsx(
68808
69241
  motion.div,
68809
69242
  {
@@ -68823,7 +69256,7 @@ const SelectTime = ({ iconDefinitions, automation: automation2, updateAutomation
68823
69256
  icon: /* @__PURE__ */ jsx(iconDefinitions.SendButton, {}),
68824
69257
  onClick: () => {
68825
69258
  setDeliveryOption("sendNow");
68826
- updateAutomation2({
69259
+ businessUpdateAutomation({
68827
69260
  trigger: {
68828
69261
  triggerType: AutomationTriggerType.ONE_TIME,
68829
69262
  scheduledAt: new Date(
@@ -68909,15 +69342,12 @@ const SelectTime = ({ iconDefinitions, automation: automation2, updateAutomation
68909
69342
  ) });
68910
69343
  };
68911
69344
  const PreviewAndSchedule = ({
68912
- iconDefinitions,
68913
- updateAutomation: externalUpdateAutomation
69345
+ iconDefinitions
68914
69346
  }) => {
68915
69347
  const automation2 = useAutomation();
68916
69348
  const communicationGroup = useCommunicationGroup();
68917
- const { updateAutomation: businessUpdateAutomation } = useUpdateBusinessAutomation(automation2?.id || "");
68918
69349
  const { channelSenders } = useChannelSender();
68919
69350
  const { channelAccounts } = useChannelAccount();
68920
- const updateAutomation2 = externalUpdateAutomation || ((params) => businessUpdateAutomation(params));
68921
69351
  const [emailPreview, setEmailPreview] = useState(null);
68922
69352
  const [smsPreview, setSmsPreview] = useState(null);
68923
69353
  const [channelSenderData, setChannelSenderData] = useState(null);
@@ -68986,6 +69416,13 @@ const PreviewAndSchedule = ({
68986
69416
  return /* @__PURE__ */ jsx("div", { className: "flex justify-center items-center h-full", children: /* @__PURE__ */ jsx("div", { children: "No preview data Please complete previous steps" }) });
68987
69417
  }
68988
69418
  return /* @__PURE__ */ jsxs("div", { className: "w-full", children: [
69419
+ automation2.triggerType === AutomationTriggerType.ONE_TIME && /* @__PURE__ */ jsx(Card, { className: "p-4 shadow-sm border-none mt-4", children: /* @__PURE__ */ jsx(
69420
+ SelectTime,
69421
+ {
69422
+ automation: automation2,
69423
+ iconDefinitions
69424
+ }
69425
+ ) }),
68989
69426
  /* @__PURE__ */ jsxs("div", { className: "flex gap-4 w-full", children: [
68990
69427
  /* @__PURE__ */ jsx(
68991
69428
  PreviewPanel,
@@ -69004,15 +69441,7 @@ const PreviewAndSchedule = ({
69004
69441
  excludeSegments: automation2.excludeSegmentIds || []
69005
69442
  }
69006
69443
  )
69007
- ] }),
69008
- automation2.triggerType === AutomationTriggerType.ONE_TIME && /* @__PURE__ */ jsx(Card, { className: "p-4 shadow-sm border-none mt-4", children: /* @__PURE__ */ jsx(
69009
- SelectTime,
69010
- {
69011
- automation: automation2,
69012
- iconDefinitions,
69013
- updateAutomation: updateAutomation2
69014
- }
69015
- ) })
69444
+ ] })
69016
69445
  ] });
69017
69446
  };
69018
69447
  const AllOrSelectSegmentPicker = ({ iconDefinitions, onSelectionChange, defaultValue = "all" }) => {
@@ -69576,26 +70005,7 @@ const getAutomationSteps = ({
69576
70005
  nextText: automation2.triggerMetadata?.triggerType === AutomationTriggerType.ONE_TIME ? "Schedule" : "Start",
69577
70006
  hideBack: false,
69578
70007
  backDisabled: false,
69579
- nextDisabled: () => {
69580
- if (!automation2.triggerMetadata) {
69581
- return true;
69582
- }
69583
- if (automation2.triggerMetadata?.triggerType !== AutomationTriggerType.ONE_TIME) {
69584
- return false;
69585
- }
69586
- if (!automation2.triggerMetadata?.scheduledAt) {
69587
- return true;
69588
- }
69589
- const hasValidSchedule = Boolean(
69590
- automation2.triggerMetadata?.scheduledAt && new Date(automation2.triggerMetadata.scheduledAt) > /* @__PURE__ */ new Date()
69591
- );
69592
- const hasValidCommunicationGroup = Boolean(
69593
- automation2.actionData?.some(
69594
- (action) => action.actionType === "send_communication" && action.actionMetadata.communicationGroupId
69595
- )
69596
- );
69597
- return !(hasValidSchedule && hasValidCommunicationGroup);
69598
- },
70008
+ nextDisabled: () => false,
69599
70009
  thirdOptionText: "Save as Draft",
69600
70010
  thirdOptionOnClick: handleSaveAsDraft
69601
70011
  }
@@ -69699,11 +70109,13 @@ const EditAutomation = ({
69699
70109
  const { updateAutomation: updateAutomation2 } = useUpdateBusinessAutomation(
69700
70110
  automation2?.id || ""
69701
70111
  );
70112
+ const initialStepSet = useRef(false);
69702
70113
  useEffect(() => {
69703
- if (automation2) {
70114
+ if (automation2 && !initialStepSet.current) {
69704
70115
  setCurrentStep(
69705
70116
  automation2.triggerType === AutomationTriggerType.TRIGGER_BASED ? AutomationSteps.SelectTrigger : AutomationSteps.SelectAudience
69706
70117
  );
70118
+ initialStepSet.current = true;
69707
70119
  }
69708
70120
  }, [automation2]);
69709
70121
  if (!automation2 || !currentStep || !communicationGroup) {