@embedreach/components 0.2.8 → 0.2.10

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.
@@ -6230,21 +6230,21 @@ function H$1(e4, t3) {
6230
6230
  var n2 = (65535 & e4) + (65535 & t3);
6231
6231
  return (e4 >> 16) + (t3 >> 16) + (n2 >> 16) << 16 | 65535 & n2;
6232
6232
  }
6233
- function z(e4, t3, n2, r2, o2, i3) {
6233
+ function z$1(e4, t3, n2, r2, o2, i3) {
6234
6234
  return H$1((a4 = H$1(H$1(t3, e4), H$1(r2, i3))) << (s4 = o2) | a4 >>> 32 - s4, n2);
6235
6235
  var a4, s4;
6236
6236
  }
6237
6237
  function K$2(e4, t3, n2, r2, o2, i3, a4) {
6238
- return z(t3 & n2 | ~t3 & r2, e4, t3, o2, i3, a4);
6238
+ return z$1(t3 & n2 | ~t3 & r2, e4, t3, o2, i3, a4);
6239
6239
  }
6240
6240
  function _(e4, t3, n2, r2, o2, i3, a4) {
6241
- return z(t3 & r2 | n2 & ~r2, e4, t3, o2, i3, a4);
6241
+ return z$1(t3 & r2 | n2 & ~r2, e4, t3, o2, i3, a4);
6242
6242
  }
6243
6243
  function J$1(e4, t3, n2, r2, o2, i3, a4) {
6244
- return z(t3 ^ n2 ^ r2, e4, t3, o2, i3, a4);
6244
+ return z$1(t3 ^ n2 ^ r2, e4, t3, o2, i3, a4);
6245
6245
  }
6246
6246
  function B$1(e4, t3, n2, r2, o2, i3, a4) {
6247
- return z(n2 ^ (t3 | ~r2), e4, t3, o2, i3, a4);
6247
+ return z$1(n2 ^ (t3 | ~r2), e4, t3, o2, i3, a4);
6248
6248
  }
6249
6249
  var G$2 = M$1("v3", 48, function(e4) {
6250
6250
  if ("string" == typeof e4) {
@@ -6337,7 +6337,7 @@ var ee$1 = Object.freeze({ __proto__: null, v1: function(e4, t3, n2) {
6337
6337
  return parseInt(e4.substr(14, 1), 16);
6338
6338
  }, validate: L, stringify: F$1, parse: V });
6339
6339
  const te = ["debug", "info", "warn", "error", "none"];
6340
- var ne = { commonBasicLogger: function(e4, t3) {
6340
+ var ne$1 = { commonBasicLogger: function(e4, t3) {
6341
6341
  if (e4 && e4.destination && "function" != typeof e4.destination) throw new Error("destination for basicLogger was set to a non-function");
6342
6342
  function n2(e5) {
6343
6343
  return function(t4) {
@@ -6450,7 +6450,7 @@ var ie = { bootstrapInvalid: function() {
6450
6450
  }, unknownOption: (e4) => 'Ignoring unknown config option "' + e4 + '"', contextNotSpecified: function() {
6451
6451
  return "No context specified." + oe$1;
6452
6452
  }, unrecoverableStreamError: (e4) => `Error on stream connection ${re$1(e4)}, giving up permanently`, wrongOptionType: (e4, t3, n2) => 'Config option "' + e4 + '" should be of type ' + t3 + ", got " + n2 + ", using default value", wrongOptionTypeBoolean: (e4, t3) => 'Config option "' + e4 + '" should be a boolean, got ' + t3 + ", converting to boolean" };
6453
- const { validateLogger: ae } = ne, se = { baseUrl: { default: "https://app.launchdarkly.com" }, streamUrl: { default: "https://clientstream.launchdarkly.com" }, eventsUrl: { default: "https://events.launchdarkly.com" }, sendEvents: { default: true }, streaming: { type: "boolean" }, sendLDHeaders: { default: true }, requestHeaderTransform: { type: "function" }, sendEventsOnlyForVariation: { default: false }, useReport: { default: false }, evaluationReasons: { default: false }, eventCapacity: { default: 100, minimum: 1 }, flushInterval: { default: 2e3, minimum: 2e3 }, samplingInterval: { default: 0, minimum: 0 }, streamReconnectDelay: { default: 1e3, minimum: 0 }, allAttributesPrivate: { default: false }, privateAttributes: { default: [] }, bootstrap: { type: "string|object" }, diagnosticRecordingInterval: { default: 9e5, minimum: 2e3 }, diagnosticOptOut: { default: false }, wrapperName: { type: "string" }, wrapperVersion: { type: "string" }, stateProvider: { type: "object" }, application: { validator: function(e4, t3, n2) {
6453
+ const { validateLogger: ae } = ne$1, se = { baseUrl: { default: "https://app.launchdarkly.com" }, streamUrl: { default: "https://clientstream.launchdarkly.com" }, eventsUrl: { default: "https://events.launchdarkly.com" }, sendEvents: { default: true }, streaming: { type: "boolean" }, sendLDHeaders: { default: true }, requestHeaderTransform: { type: "function" }, sendEventsOnlyForVariation: { default: false }, useReport: { default: false }, evaluationReasons: { default: false }, eventCapacity: { default: 100, minimum: 1 }, flushInterval: { default: 2e3, minimum: 2e3 }, samplingInterval: { default: 0, minimum: 0 }, streamReconnectDelay: { default: 1e3, minimum: 0 }, allAttributesPrivate: { default: false }, privateAttributes: { default: [] }, bootstrap: { type: "string|object" }, diagnosticRecordingInterval: { default: 9e5, minimum: 2e3 }, diagnosticOptOut: { default: false }, wrapperName: { type: "string" }, wrapperVersion: { type: "string" }, stateProvider: { type: "object" }, application: { validator: function(e4, t3, n2) {
6454
6454
  const r2 = {};
6455
6455
  t3.id && (r2.id = le$1(`${e4}.id`, t3.id, n2));
6456
6456
  t3.version && (r2.version = le$1(`${e4}.version`, t3.version, n2));
@@ -6548,7 +6548,7 @@ var he$1 = function(e4, t3, n2) {
6548
6548
  });
6549
6549
  }, o2;
6550
6550
  };
6551
- const { commonBasicLogger: ye$1 } = ne;
6551
+ const { commonBasicLogger: ye$1 } = ne$1;
6552
6552
  function we$1(e4) {
6553
6553
  return "string" == typeof e4 && "kind" !== e4 && e4.match(/^(\w|\.|-)+$/);
6554
6554
  }
@@ -7065,7 +7065,7 @@ var dt = function(e4, t3) {
7065
7065
  }, 1e3 * e4);
7066
7066
  });
7067
7067
  };
7068
- const { commonBasicLogger: ft } = ne, { checkContext: gt } = ke$1, { InspectorTypes: pt, InspectorManager: mt } = ut, ht = "change", yt = "internal-change";
7068
+ const { commonBasicLogger: ft } = ne$1, { checkContext: gt } = ke$1, { InspectorTypes: pt, InspectorManager: mt } = ut, ht = "change", yt = "internal-change";
7069
7069
  var wt = { initialize: function(e4, t3, n2, r2, o2) {
7070
7070
  const i3 = function() {
7071
7071
  if (n2 && n2.logger) return n2.logger;
@@ -8255,7 +8255,10 @@ let D$1 = class D extends Component {
8255
8255
  return React__default.createElement(a4.Provider, { value: { flags: e4, flagKeyMap: r2, ldClient: n2, error: o2 } }, this.props.children);
8256
8256
  }
8257
8257
  };
8258
- const oe = (e4) => {
8258
+ const ne = (e4) => {
8259
+ const { flags: t3 } = useContext$1(u$1.reactContext);
8260
+ return t3;
8261
+ }, oe = (e4) => {
8259
8262
  const { ldClient: t3 } = useContext$1(u$1.reactContext);
8260
8263
  return t3;
8261
8264
  };
@@ -13020,7 +13023,7 @@ const ToastClose = React.forwardRef(({ className: className2, ...props2 }, ref)
13020
13023
  {
13021
13024
  ref,
13022
13025
  className: cn$1(
13023
- "absolute right-1 top-1 rounded-md p-1 text-foreground/50 opacity-0 transition-opacity hover:text-foreground focus:opacity-100 focus:outline-none focus:ring-1 group-hover:opacity-100 group-[.destructive]:text-red-300 group-[.destructive]:hover:text-red-50 group-[.destructive]:focus:ring-red-400 group-[.destructive]:focus:ring-offset-red-600",
13026
+ "absolute right-1 top-1 rounded-md p-1 text-foreground/50 opacity-0 transition-opacity hover:text-foreground focus:opacity-100 focus:outline-none focus:ring-1 group-hover:opacity-100 group-[.destructive]:opacity-100 group-[.destructive]:text-red-300 group-[.destructive]:hover:text-red-50 group-[.destructive]:focus:ring-red-400 group-[.destructive]:focus:ring-offset-red-600",
13024
13027
  className2
13025
13028
  ),
13026
13029
  "toast-close": "",
@@ -16421,7 +16424,7 @@ const account_settings$1 = "Account Settings";
16421
16424
  const manage_account_settings$1 = "Manage your account settings";
16422
16425
  const copy$1 = "Copy";
16423
16426
  const copied$1 = "Copied";
16424
- const error$1 = "An error occurred";
16427
+ const error$2 = "An error occurred";
16425
16428
  const filter$2 = "Filter";
16426
16429
  const finishingUp$1 = "Finishing up...";
16427
16430
  const loading$1 = "Loading...";
@@ -16830,7 +16833,7 @@ const enCommon = {
16830
16833
  manage_account_settings: manage_account_settings$1,
16831
16834
  copy: copy$1,
16832
16835
  copied: copied$1,
16833
- error: error$1,
16836
+ error: error$2,
16834
16837
  filter: filter$2,
16835
16838
  finishingUp: finishingUp$1,
16836
16839
  loading: loading$1,
@@ -16889,7 +16892,7 @@ const account_settings = "Configuración de cuenta";
16889
16892
  const manage_account_settings = "Configuración de tu cuenta";
16890
16893
  const copy = "Copiar";
16891
16894
  const copied = "Copiado";
16892
- const error = "Se produjo un error";
16895
+ const error$1 = "Se produjo un error";
16893
16896
  const filter$1 = "Filtrar";
16894
16897
  const finishingUp = "Finalizando...";
16895
16898
  const loading = "Cargando...";
@@ -17298,7 +17301,7 @@ const esCommon = {
17298
17301
  manage_account_settings,
17299
17302
  copy,
17300
17303
  copied,
17301
- error,
17304
+ error: error$1,
17302
17305
  filter: filter$1,
17303
17306
  finishingUp,
17304
17307
  loading,
@@ -19048,11 +19051,11 @@ var TraceAPI = (
19048
19051
  return this._instance;
19049
19052
  };
19050
19053
  TraceAPI2.prototype.setGlobalTracerProvider = function(provider) {
19051
- var success = registerGlobal(API_NAME, this._proxyTracerProvider, DiagAPI.instance());
19052
- if (success) {
19054
+ var success2 = registerGlobal(API_NAME, this._proxyTracerProvider, DiagAPI.instance());
19055
+ if (success2) {
19053
19056
  this._proxyTracerProvider.setDelegate(provider);
19054
19057
  }
19055
- return success;
19058
+ return success2;
19056
19059
  };
19057
19060
  TraceAPI2.prototype.getTracerProvider = function() {
19058
19061
  return getGlobal(API_NAME) || this._proxyTracerProvider;
@@ -38205,7 +38208,7 @@ function PopChild({ children: children2, isPresent, anchorX }) {
38205
38208
  }, [isPresent]);
38206
38209
  return jsx(PopChildMeasure, { isPresent, childRef: ref, sizeRef: size2, children: React.cloneElement(children2, { ref }) });
38207
38210
  }
38208
- const PresenceChild = ({ children: children2, initial, isPresent, onExitComplete, custom, presenceAffectsLayout, mode, anchorX }) => {
38211
+ const PresenceChild = ({ children: children2, initial, isPresent, onExitComplete, custom: custom2, presenceAffectsLayout, mode, anchorX }) => {
38209
38212
  const presenceChildren = useConstant(newChildrenMap);
38210
38213
  const id2 = useId$6();
38211
38214
  const memoizedOnExitComplete = useCallback((childId) => {
@@ -38221,7 +38224,7 @@ const PresenceChild = ({ children: children2, initial, isPresent, onExitComplete
38221
38224
  id: id2,
38222
38225
  initial,
38223
38226
  isPresent,
38224
- custom,
38227
+ custom: custom2,
38225
38228
  onExitComplete: memoizedOnExitComplete,
38226
38229
  register: (childId) => {
38227
38230
  presenceChildren.set(childId, false);
@@ -38273,7 +38276,7 @@ function onlyElements(children2) {
38273
38276
  }
38274
38277
  const isBrowser$1 = typeof window !== "undefined";
38275
38278
  const useIsomorphicLayoutEffect$4 = isBrowser$1 ? useLayoutEffect : useEffect;
38276
- const AnimatePresence = ({ children: children2, custom, initial = true, onExitComplete, presenceAffectsLayout = true, mode = "sync", propagate = false, anchorX = "left" }) => {
38279
+ const AnimatePresence = ({ children: children2, custom: custom2, initial = true, onExitComplete, presenceAffectsLayout = true, mode = "sync", propagate = false, anchorX = "left" }) => {
38277
38280
  const [isParentPresent, safeToRemove] = usePresence$2(propagate);
38278
38281
  const presentChildren = useMemo(() => onlyElements(children2), [children2]);
38279
38282
  const presentKeys = propagate && !isParentPresent ? [] : presentChildren.map(getChildKey);
@@ -38339,14 +38342,14 @@ const AnimatePresence = ({ children: children2, custom, initial = true, onExitCo
38339
38342
  onExitComplete && onExitComplete();
38340
38343
  }
38341
38344
  };
38342
- return jsx(PresenceChild, { isPresent, initial: !isInitialRender.current || initial ? void 0 : false, custom, presenceAffectsLayout, mode, onExitComplete: isPresent ? void 0 : onExit, anchorX, children: child }, key);
38345
+ return jsx(PresenceChild, { isPresent, initial: !isInitialRender.current || initial ? void 0 : false, custom: custom2, presenceAffectsLayout, mode, onExitComplete: isPresent ? void 0 : onExit, anchorX, children: child }, key);
38343
38346
  }) });
38344
38347
  };
38345
38348
  const noop = /* @__NO_SIDE_EFFECTS__ */ (any) => any;
38346
- let warning$1 = noop;
38349
+ let warning$2 = noop;
38347
38350
  let invariant$1 = noop;
38348
38351
  if (process.env.NODE_ENV !== "production") {
38349
- warning$1 = (check, message2) => {
38352
+ warning$2 = (check, message2) => {
38350
38353
  if (!check && typeof console !== "undefined") {
38351
38354
  console.warn(message2);
38352
38355
  }
@@ -38839,7 +38842,7 @@ function useStrictMode(configAndProps, preloadedFeatures) {
38839
38842
  const isStrict = useContext$1(LazyContext).strict;
38840
38843
  if (process.env.NODE_ENV !== "production" && preloadedFeatures && isStrict) {
38841
38844
  const strictMessage = "You have rendered a `motion` component within a `LazyMotion` component. This will break tree shaking. Import and render a `m` component instead.";
38842
- configAndProps.ignoreStrict ? warning$1(false, strictMessage) : invariant$1(false, strictMessage);
38845
+ configAndProps.ignoreStrict ? warning$2(false, strictMessage) : invariant$1(false, strictMessage);
38843
38846
  }
38844
38847
  }
38845
38848
  function getProjectionFunctionality(props2) {
@@ -39286,17 +39289,17 @@ function getValueState(visualElement) {
39286
39289
  });
39287
39290
  return state;
39288
39291
  }
39289
- function resolveVariantFromProps(props2, definition, custom, visualElement) {
39292
+ function resolveVariantFromProps(props2, definition, custom2, visualElement) {
39290
39293
  if (typeof definition === "function") {
39291
39294
  const [current, velocity] = getValueState(visualElement);
39292
- definition = definition(custom !== void 0 ? custom : props2.custom, current, velocity);
39295
+ definition = definition(custom2 !== void 0 ? custom2 : props2.custom, current, velocity);
39293
39296
  }
39294
39297
  if (typeof definition === "string") {
39295
39298
  definition = props2.variants && props2.variants[definition];
39296
39299
  }
39297
39300
  if (typeof definition === "function") {
39298
39301
  const [current, velocity] = getValueState(visualElement);
39299
- definition = definition(custom !== void 0 ? custom : props2.custom, current, velocity);
39302
+ definition = definition(custom2 !== void 0 ? custom2 : props2.custom, current, velocity);
39300
39303
  }
39301
39304
  return definition;
39302
39305
  }
@@ -39501,9 +39504,9 @@ function createMotionComponentFactory(preloadedFeatures, createVisualElement) {
39501
39504
  return createRendererMotionComponent(config);
39502
39505
  };
39503
39506
  }
39504
- function resolveVariant(visualElement, definition, custom) {
39507
+ function resolveVariant(visualElement, definition, custom2) {
39505
39508
  const props2 = visualElement.getProps();
39506
- return resolveVariantFromProps(props2, definition, custom !== void 0 ? custom : props2.custom, visualElement);
39509
+ return resolveVariantFromProps(props2, definition, custom2 !== void 0 ? custom2 : props2.custom, visualElement);
39507
39510
  }
39508
39511
  const supportsScrollTimeline = /* @__PURE__ */ memo$1(() => window.ScrollTimeline !== void 0);
39509
39512
  class BaseGroupPlaybackControls {
@@ -39782,7 +39785,7 @@ function press(elementOrSelector, onPressStart, options = {}) {
39782
39785
  return;
39783
39786
  isPressing.add(element);
39784
39787
  const onPressEnd = onPressStart(element, startEvent);
39785
- const onPointerEnd = (endEvent, success) => {
39788
+ const onPointerEnd = (endEvent, success2) => {
39786
39789
  window.removeEventListener("pointerup", onPointerUp);
39787
39790
  window.removeEventListener("pointercancel", onPointerCancel);
39788
39791
  if (!isValidPressEvent(endEvent) || !isPressing.has(element)) {
@@ -39790,7 +39793,7 @@ function press(elementOrSelector, onPressStart, options = {}) {
39790
39793
  }
39791
39794
  isPressing.delete(element);
39792
39795
  if (typeof onPressEnd === "function") {
39793
- onPressEnd(endEvent, { success });
39796
+ onPressEnd(endEvent, { success: success2 });
39794
39797
  }
39795
39798
  };
39796
39799
  const onPointerUp = (upEvent) => {
@@ -40784,7 +40787,7 @@ function canAnimate(keyframes2, name, type, velocity) {
40784
40787
  const targetKeyframe = keyframes2[keyframes2.length - 1];
40785
40788
  const isOriginAnimatable = isAnimatable(originKeyframe, name);
40786
40789
  const isTargetAnimatable = isAnimatable(targetKeyframe, name);
40787
- warning$1(isOriginAnimatable === isTargetAnimatable, `You are trying to animate ${name} from "${originKeyframe}" to "${targetKeyframe}". ${originKeyframe} is not an animatable value - to enable this animation set ${originKeyframe} to a value animatable to ${targetKeyframe} via the \`style\` property.`);
40790
+ warning$2(isOriginAnimatable === isTargetAnimatable, `You are trying to animate ${name} from "${originKeyframe}" to "${targetKeyframe}". ${originKeyframe} is not an animatable value - to enable this animation set ${originKeyframe} to a value animatable to ${targetKeyframe} via the \`style\` property.`);
40788
40791
  if (!isOriginAnimatable || !isTargetAnimatable) {
40789
40792
  return false;
40790
40793
  }
@@ -40939,7 +40942,7 @@ const colorTypes = [hex, rgba, hsla];
40939
40942
  const getColorType = (v2) => colorTypes.find((type) => type.test(v2));
40940
40943
  function asRGBA(color2) {
40941
40944
  const type = getColorType(color2);
40942
- warning$1(Boolean(type), `'${color2}' is not an animatable color. Use the equivalent color code instead.`);
40945
+ warning$2(Boolean(type), `'${color2}' is not an animatable color. Use the equivalent color code instead.`);
40943
40946
  if (!Boolean(type))
40944
40947
  return false;
40945
40948
  let model = type.parse(color2);
@@ -41038,7 +41041,7 @@ const mixComplex = (origin, target) => {
41038
41041
  }
41039
41042
  return pipe(mixArray(matchOrder(originStats, targetStats), targetStats.values), template2);
41040
41043
  } else {
41041
- warning$1(true, `Complex values '${origin}' and '${target}' too different to mix. Ensure all colors are of the same type, and that each contains the same quantity of number and color values. Falling back to instant transition.`);
41044
+ warning$2(true, `Complex values '${origin}' and '${target}' too different to mix. Ensure all colors are of the same type, and that each contains the same quantity of number and color values. Falling back to instant transition.`);
41042
41045
  return mixImmediate(origin, target);
41043
41046
  }
41044
41047
  };
@@ -41087,7 +41090,7 @@ const safeMin = 1e-3;
41087
41090
  function findSpring({ duration = springDefaults.duration, bounce = springDefaults.bounce, velocity = springDefaults.velocity, mass = springDefaults.mass }) {
41088
41091
  let envelope;
41089
41092
  let derivative;
41090
- warning$1(duration <= /* @__PURE__ */ secondsToMilliseconds(springDefaults.maxDuration), "Spring duration must be 10 seconds or less");
41093
+ warning$2(duration <= /* @__PURE__ */ secondsToMilliseconds(springDefaults.maxDuration), "Spring duration must be 10 seconds or less");
41091
41094
  let dampingRatio = 1 - bounce;
41092
41095
  dampingRatio = clamp$2(springDefaults.minDamping, springDefaults.maxDamping, dampingRatio);
41093
41096
  duration = clamp$2(springDefaults.minDuration, springDefaults.maxDuration, /* @__PURE__ */ millisecondsToSeconds(duration));
@@ -44852,7 +44855,7 @@ class PressGesture extends Feature {
44852
44855
  return;
44853
44856
  this.unmount = press(current, (_element, startEvent) => {
44854
44857
  handlePressEvent(this.node, startEvent, "Start");
44855
- return (endEvent, { success }) => handlePressEvent(this.node, endEvent, success ? "End" : "Cancel");
44858
+ return (endEvent, { success: success2 }) => handlePressEvent(this.node, endEvent, success2 ? "End" : "Cancel");
44856
44859
  }, { useGlobalTarget: this.node.props.globalTapTarget });
44857
44860
  }
44858
44861
  unmount() {
@@ -46491,44 +46494,44 @@ const BlurDiv = ({ children: children2, className: className2 }) => {
46491
46494
  }
46492
46495
  );
46493
46496
  };
46494
- const base$2 = "reach-styles-module__base___gfFyc";
46497
+ const base$3 = "reach-styles-module__base___gfFyc";
46495
46498
  const destructive$2 = "reach-styles-module__destructive___XjBvS";
46496
46499
  const outline$2 = "reach-styles-module__outline___gFp3i";
46497
46500
  const secondary$2 = "reach-styles-module__secondary___Pd-e3";
46498
46501
  const ghost = "reach-styles-module__ghost___GcnJq";
46499
46502
  const link = "reach-styles-module__link___EgS2H";
46500
- const sizeDefault$1 = "reach-styles-module__sizeDefault___8kU5A";
46501
- const sizeSm$1 = "reach-styles-module__sizeSm___zPIEh";
46502
- const sizeLg = "reach-styles-module__sizeLg___D2G8z";
46503
+ const sizeDefault$2 = "reach-styles-module__sizeDefault___8kU5A";
46504
+ const sizeSm$2 = "reach-styles-module__sizeSm___zPIEh";
46505
+ const sizeLg$1 = "reach-styles-module__sizeLg___D2G8z";
46503
46506
  const sizeIcon = "reach-styles-module__sizeIcon___5XkYW";
46504
- const styles$5 = {
46505
- base: base$2,
46507
+ const styles$6 = {
46508
+ base: base$3,
46506
46509
  "default": "reach-styles-module__default___ny1h7",
46507
46510
  destructive: destructive$2,
46508
46511
  outline: outline$2,
46509
46512
  secondary: secondary$2,
46510
46513
  ghost,
46511
46514
  link,
46512
- sizeDefault: sizeDefault$1,
46513
- sizeSm: sizeSm$1,
46514
- sizeLg,
46515
+ sizeDefault: sizeDefault$2,
46516
+ sizeSm: sizeSm$2,
46517
+ sizeLg: sizeLg$1,
46515
46518
  sizeIcon
46516
46519
  };
46517
- const buttonVariants = cva([styles$5.base], {
46520
+ const buttonVariants = cva([styles$6.base], {
46518
46521
  variants: {
46519
46522
  variant: {
46520
- default: styles$5.default,
46521
- destructive: styles$5.destructive,
46522
- outline: styles$5.outline,
46523
- secondary: styles$5.secondary,
46524
- ghost: styles$5.ghost,
46525
- link: styles$5.link
46523
+ default: styles$6.default,
46524
+ destructive: styles$6.destructive,
46525
+ outline: styles$6.outline,
46526
+ secondary: styles$6.secondary,
46527
+ ghost: styles$6.ghost,
46528
+ link: styles$6.link
46526
46529
  },
46527
46530
  size: {
46528
- default: styles$5.sizeDefault,
46529
- sm: styles$5.sizeSm,
46530
- lg: styles$5.sizeLg,
46531
- icon: styles$5.sizeIcon
46531
+ default: styles$6.sizeDefault,
46532
+ sm: styles$6.sizeSm,
46533
+ lg: styles$6.sizeLg,
46534
+ icon: styles$6.sizeIcon
46532
46535
  }
46533
46536
  },
46534
46537
  defaultVariants: {
@@ -46671,7 +46674,7 @@ const IconDefinitions = {
46671
46674
  CommunicationIcon: Mail,
46672
46675
  WaitUntilNextFixedTimeIcon: Timer
46673
46676
  };
46674
- const styles$4 = {
46677
+ const styles$5 = {
46675
46678
  title: "text-3xl mb-8",
46676
46679
  grid: "grid grid-cols-2 gap-6",
46677
46680
  container: "relative p-6 rounded-lg",
@@ -46684,9 +46687,9 @@ const ChooseAutomationType = ({ onNext }) => {
46684
46687
  const onClick = (type) => {
46685
46688
  onNext(type);
46686
46689
  };
46687
- return /* @__PURE__ */ jsxs("div", { className: styles$4.container, children: [
46688
- /* @__PURE__ */ jsx("h1", { className: styles$4.title, children: "Choose Your Automation Type" }),
46689
- /* @__PURE__ */ jsxs("div", { className: styles$4.grid, children: [
46690
+ return /* @__PURE__ */ jsxs("div", { className: styles$5.container, children: [
46691
+ /* @__PURE__ */ jsx("h1", { className: styles$5.title, children: "Choose Your Automation Type" }),
46692
+ /* @__PURE__ */ jsxs("div", { className: styles$5.grid, children: [
46690
46693
  /* @__PURE__ */ jsx(
46691
46694
  BigSelector,
46692
46695
  {
@@ -46736,14 +46739,14 @@ const ChooseAutomationType = ({ onNext }) => {
46736
46739
  ] })
46737
46740
  ] });
46738
46741
  };
46739
- const base$1 = "reach-styles-module__base___WFahB";
46742
+ const base$2 = "reach-styles-module__base___WFahB";
46740
46743
  const secondary$1 = "reach-styles-module__secondary___VQ4iH";
46741
46744
  const destructive$1 = "reach-styles-module__destructive___RLaRD";
46742
46745
  const outline$1 = "reach-styles-module__outline___L2VtW";
46743
46746
  const google = "reach-styles-module__google___HcEij";
46744
46747
  const date = "reach-styles-module__date___-6BC4";
46745
- const sizeDefault = "reach-styles-module__sizeDefault___iGTp4";
46746
- const sizeSm = "reach-styles-module__sizeSm___6T2oK";
46748
+ const sizeDefault$1 = "reach-styles-module__sizeDefault___iGTp4";
46749
+ const sizeSm$1 = "reach-styles-module__sizeSm___6T2oK";
46747
46750
  const iconOnly = "reach-styles-module__iconOnly___8vUSp";
46748
46751
  const iconOnlySm = "reach-styles-module__iconOnlySm___9ZKv9";
46749
46752
  const container = "reach-styles-module__container___6PQqs";
@@ -46756,16 +46759,16 @@ const statusRunning = "reach-styles-module__statusRunning___1iEjx";
46756
46759
  const segmentAllUsers = "reach-styles-module__segmentAllUsers___1aXpc";
46757
46760
  const segmentManaged = "reach-styles-module__segmentManaged___o0gOu";
46758
46761
  const segmentCustom = "reach-styles-module__segmentCustom___xc3lG";
46759
- const styles$3 = {
46760
- base: base$1,
46762
+ const styles$4 = {
46763
+ base: base$2,
46761
46764
  "default": "reach-styles-module__default___zeGU1",
46762
46765
  secondary: secondary$1,
46763
46766
  destructive: destructive$1,
46764
46767
  outline: outline$1,
46765
46768
  google,
46766
46769
  date,
46767
- sizeDefault,
46768
- sizeSm,
46770
+ sizeDefault: sizeDefault$1,
46771
+ sizeSm: sizeSm$1,
46769
46772
  iconOnly,
46770
46773
  iconOnlySm,
46771
46774
  container,
@@ -46779,31 +46782,31 @@ const styles$3 = {
46779
46782
  segmentManaged,
46780
46783
  segmentCustom
46781
46784
  };
46782
- const badgeVariants = cva([styles$3.base], {
46785
+ const badgeVariants = cva([styles$4.base], {
46783
46786
  variants: {
46784
46787
  variant: {
46785
- default: styles$3.default,
46786
- secondary: styles$3.secondary,
46787
- destructive: styles$3.destructive,
46788
- outline: styles$3.outline,
46789
- google: styles$3.google,
46790
- date: styles$3.date,
46791
- statusActive: styles$3.statusActive,
46792
- statusCompleted: styles$3.statusCompleted,
46793
- statusDraft: styles$3.statusDraft,
46794
- statusDeactivated: styles$3.statusDeactivated,
46795
- statusFailed: styles$3.statusFailed,
46796
- statusRunning: styles$3.statusRunning,
46797
- segmentAllUsers: styles$3.segmentAllUsers,
46798
- segmentManaged: styles$3.segmentManaged,
46799
- segmentCustom: styles$3.segmentCustom
46788
+ default: styles$4.default,
46789
+ secondary: styles$4.secondary,
46790
+ destructive: styles$4.destructive,
46791
+ outline: styles$4.outline,
46792
+ google: styles$4.google,
46793
+ date: styles$4.date,
46794
+ statusActive: styles$4.statusActive,
46795
+ statusCompleted: styles$4.statusCompleted,
46796
+ statusDraft: styles$4.statusDraft,
46797
+ statusDeactivated: styles$4.statusDeactivated,
46798
+ statusFailed: styles$4.statusFailed,
46799
+ statusRunning: styles$4.statusRunning,
46800
+ segmentAllUsers: styles$4.segmentAllUsers,
46801
+ segmentManaged: styles$4.segmentManaged,
46802
+ segmentCustom: styles$4.segmentCustom
46800
46803
  },
46801
46804
  size: {
46802
- default: styles$3.sizeDefault,
46803
- sm: styles$3.sizeSm
46805
+ default: styles$4.sizeDefault,
46806
+ sm: styles$4.sizeSm
46804
46807
  },
46805
46808
  iconOnly: {
46806
- true: styles$3.iconOnly,
46809
+ true: styles$4.iconOnly,
46807
46810
  false: ""
46808
46811
  }
46809
46812
  },
@@ -46811,7 +46814,7 @@ const badgeVariants = cva([styles$3.base], {
46811
46814
  {
46812
46815
  iconOnly: true,
46813
46816
  size: "sm",
46814
- class: styles$3.iconOnlySm
46817
+ class: styles$4.iconOnlySm
46815
46818
  }
46816
46819
  ],
46817
46820
  defaultVariants: {
@@ -46838,7 +46841,7 @@ const Badge = React.forwardRef(
46838
46841
  );
46839
46842
  Badge.displayName = "Badge";
46840
46843
  const BadgeContainer = React.forwardRef(({ className: className2, ...props2 }, ref) => {
46841
- return /* @__PURE__ */ jsx("div", { ref, className: cn$1(styles$3.container, className2), ...props2 });
46844
+ return /* @__PURE__ */ jsx("div", { ref, className: cn$1(styles$4.container, className2), ...props2 });
46842
46845
  });
46843
46846
  BadgeContainer.displayName = "BadgeContainer";
46844
46847
  const stepIndicatorContainer = "reach-styles-module__stepIndicatorContainer___FoKXB";
@@ -46850,7 +46853,7 @@ const minusIconInactive = "reach-styles-module__minusIconInactive___JtvVB";
46850
46853
  const label = "reach-styles-module__label___tiCMA";
46851
46854
  const labelActive = "reach-styles-module__labelActive___EXydD";
46852
46855
  const labelInactive = "reach-styles-module__labelInactive___g-J3r";
46853
- const styles$2 = {
46856
+ const styles$3 = {
46854
46857
  stepIndicatorContainer,
46855
46858
  iconContainer,
46856
46859
  checkIcon,
@@ -46868,13 +46871,13 @@ const StepIndicator = ({
46868
46871
  onClick
46869
46872
  }) => {
46870
46873
  const Container = onClick ? "button" : "div";
46871
- return /* @__PURE__ */ jsxs(Container, { className: styles$2.stepIndicatorContainer, onClick, children: [
46872
- isCompleted ? /* @__PURE__ */ jsx("div", { className: styles$2.iconContainer, children: /* @__PURE__ */ jsx(Check, { className: styles$2.checkIcon }) }) : /* @__PURE__ */ jsx("div", { className: styles$2.iconContainer, children: /* @__PURE__ */ jsx(
46874
+ return /* @__PURE__ */ jsxs(Container, { className: styles$3.stepIndicatorContainer, onClick, children: [
46875
+ isCompleted ? /* @__PURE__ */ jsx("div", { className: styles$3.iconContainer, children: /* @__PURE__ */ jsx(Check, { className: styles$3.checkIcon }) }) : /* @__PURE__ */ jsx("div", { className: styles$3.iconContainer, children: /* @__PURE__ */ jsx(
46873
46876
  Minus,
46874
46877
  {
46875
46878
  className: cn$1(
46876
- styles$2.minusIcon,
46877
- isActive ? styles$2.minusIconActive : styles$2.minusIconInactive
46879
+ styles$3.minusIcon,
46880
+ isActive ? styles$3.minusIconActive : styles$3.minusIconInactive
46878
46881
  )
46879
46882
  }
46880
46883
  ) }),
@@ -46882,8 +46885,8 @@ const StepIndicator = ({
46882
46885
  "span",
46883
46886
  {
46884
46887
  className: cn$1(
46885
- styles$2.label,
46886
- isActive ? styles$2.labelActive : styles$2.labelInactive
46888
+ styles$3.label,
46889
+ isActive ? styles$3.labelActive : styles$3.labelInactive
46887
46890
  ),
46888
46891
  children: label2
46889
46892
  }
@@ -54546,7 +54549,7 @@ function TanstackTable({
54546
54549
  )) : /* @__PURE__ */ jsx(TableRow, { children: /* @__PURE__ */ jsx(TableCell, { colSpan: columns.length, className: "h-24 text-center", children: "No results found" }) }) })
54547
54550
  ] });
54548
54551
  const TableSkeleton = () => /* @__PURE__ */ jsx("div", { className: "h-full w-full flex items-center justify-center", children: /* @__PURE__ */ jsx(BasicLoader, {}) });
54549
- return /* @__PURE__ */ jsxs("div", { className: "flex flex-col h-full border rounded-lg shadow-sm hover:shadow-md transition-shadow duration-300", children: [
54552
+ return /* @__PURE__ */ jsxs("div", { className: "flex flex-col h-full border rounded-lg shadow-sm hover:shadow-md transition-shadow duration-300 overflow-hidden", children: [
54550
54553
  /* @__PURE__ */ jsxs("div", { className: "flex flex-col items-start gap-3 py-4 px-2 sticky top-0 z-20 bg-primary/5 border-b rounded-t-md md:flex-row md:items-center md:justify-between", children: [
54551
54554
  /* @__PURE__ */ jsx("div", { className: "w-full md:w-1/4", children: /* @__PURE__ */ jsx(
54552
54555
  Input,
@@ -54773,7 +54776,7 @@ function createMemoryHistory(options = {}) {
54773
54776
  state,
54774
54777
  key
54775
54778
  );
54776
- warning(
54779
+ warning$1(
54777
54780
  location2.pathname.charAt(0) === "/",
54778
54781
  `relative pathnames are not supported in memory history: ${JSON.stringify(
54779
54782
  to
@@ -54846,7 +54849,7 @@ function invariant(value, message2) {
54846
54849
  throw new Error(message2);
54847
54850
  }
54848
54851
  }
54849
- function warning(cond, message2) {
54852
+ function warning$1(cond, message2) {
54850
54853
  if (!cond) {
54851
54854
  if (typeof console !== "undefined") console.warn(message2);
54852
54855
  try {
@@ -55118,7 +55121,7 @@ function matchPath(pattern, pathname) {
55118
55121
  };
55119
55122
  }
55120
55123
  function compilePath(path2, caseSensitive = false, end = true) {
55121
- warning(
55124
+ warning$1(
55122
55125
  path2 === "*" || !path2.endsWith("*") || path2.endsWith("/*"),
55123
55126
  `Route path "${path2}" will be treated as if it were "${path2.replace(/\*$/, "/*")}" because the \`*\` character must always follow a \`/\` in the pattern. To get rid of this warning, please change the route path to "${path2.replace(/\*$/, "/*")}".`
55124
55127
  );
@@ -55145,7 +55148,7 @@ function decodePath(value) {
55145
55148
  try {
55146
55149
  return value.split("/").map((v2) => decodeURIComponent(v2).replace(/\//g, "%2F")).join("/");
55147
55150
  } catch (error2) {
55148
- warning(
55151
+ warning$1(
55149
55152
  false,
55150
55153
  `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}).`
55151
55154
  );
@@ -55356,7 +55359,7 @@ function useNavigateUnstable() {
55356
55359
  });
55357
55360
  let navigate = React.useCallback(
55358
55361
  (to, options = {}) => {
55359
- warning(activeRef.current, navigateEffectWarning);
55362
+ warning$1(activeRef.current, navigateEffectWarning);
55360
55363
  if (!activeRef.current) return;
55361
55364
  if (typeof to === "number") {
55362
55365
  navigator2.go(to);
@@ -55445,11 +55448,11 @@ Please change the parent <Route path="${parentPath}"> to <Route path="${parentPa
55445
55448
  }
55446
55449
  let matches = !isStatic && dataRouterState && dataRouterState.matches && dataRouterState.matches.length > 0 ? dataRouterState.matches : matchRoutes(routes, { pathname: remainingPathname });
55447
55450
  {
55448
- warning(
55451
+ warning$1(
55449
55452
  parentRoute || matches != null,
55450
55453
  `No routes matched location "${location2.pathname}${location2.search}${location2.hash}" `
55451
55454
  );
55452
- warning(
55455
+ warning$1(
55453
55456
  matches == null || matches[matches.length - 1].route.element !== void 0 || matches[matches.length - 1].route.Component !== void 0 || matches[matches.length - 1].route.lazy !== void 0,
55454
55457
  `Matched leaf route at location "${location2.pathname}${location2.search}${location2.hash}" does not have an element or Component. This means it will render an <Outlet /> with a null value by default resulting in an "empty" page.`
55455
55458
  );
@@ -55723,7 +55726,7 @@ function useNavigateStable() {
55723
55726
  });
55724
55727
  let navigate = React.useCallback(
55725
55728
  async (to, options = {}) => {
55726
- warning(activeRef.current, navigateEffectWarning);
55729
+ warning$1(activeRef.current, navigateEffectWarning);
55727
55730
  if (!activeRef.current) return;
55728
55731
  if (typeof to === "number") {
55729
55732
  router.navigate(to);
@@ -55739,7 +55742,7 @@ var alreadyWarned = {};
55739
55742
  function warningOnce(key, cond, message2) {
55740
55743
  if (!cond && !alreadyWarned[key]) {
55741
55744
  alreadyWarned[key] = true;
55742
- warning(false, message2);
55745
+ warning$1(false, message2);
55743
55746
  }
55744
55747
  }
55745
55748
  React.memo(DataRoutes);
@@ -55835,7 +55838,7 @@ function Router({
55835
55838
  navigationType
55836
55839
  };
55837
55840
  }, [basename, pathname, search, hash, state, key, navigationType]);
55838
- warning(
55841
+ warning$1(
55839
55842
  locationContext != null,
55840
55843
  `<Router basename="${basename}"> is not able to match the URL "${pathname}${search}${hash}" because it does not start with the basename, so the <Router> won't render anything.`
55841
55844
  );
@@ -55912,7 +55915,7 @@ var supportedFormEncTypes = /* @__PURE__ */ new Set([
55912
55915
  ]);
55913
55916
  function getFormEncType(encType) {
55914
55917
  if (encType != null && !supportedFormEncTypes.has(encType)) {
55915
- warning(
55918
+ warning$1(
55916
55919
  false,
55917
55920
  `"${encType}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${defaultEncType}"`
55918
55921
  );
@@ -56391,7 +56394,7 @@ var Link = React.forwardRef(
56391
56394
  isExternal = true;
56392
56395
  }
56393
56396
  } catch (e4) {
56394
- warning(
56397
+ warning$1(
56395
56398
  false,
56396
56399
  `<Link to="${to}"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`
56397
56400
  );
@@ -56602,7 +56605,7 @@ function useLinkClickHandler(to, {
56602
56605
  );
56603
56606
  }
56604
56607
  function useSearchParams(defaultInit) {
56605
- warning(
56608
+ warning$1(
56606
56609
  typeof URLSearchParams !== "undefined",
56607
56610
  `You cannot use the \`useSearchParams\` hook in a browser that does not support the URLSearchParams API. If you need to support Internet Explorer 11, we recommend you load a polyfill such as https://github.com/ungap/url-search-params.`
56608
56611
  );
@@ -57979,20 +57982,20 @@ const STATUS_DISPLAY = {
57979
57982
  [AutomationStatus.DEACTIVATED]: "Deactivated"
57980
57983
  };
57981
57984
  const STATUS_COLORS = {
57982
- [AutomationStatus.DRAFT]: "bg-gray-400",
57983
- [AutomationStatus.ACTIVE]: "bg-green-500",
57984
- [AutomationStatus.RUNNING]: "bg-blue-500",
57985
- [AutomationStatus.COMPLETED]: "bg-purple-500",
57985
+ [AutomationStatus.DRAFT]: "bg-gray-500",
57986
+ [AutomationStatus.ACTIVE]: "bg-blue-500",
57987
+ [AutomationStatus.RUNNING]: "bg-yellow-500",
57988
+ [AutomationStatus.COMPLETED]: "bg-green-500",
57986
57989
  [AutomationStatus.FAILED]: "bg-red-500",
57987
- [AutomationStatus.DEACTIVATED]: "bg-gray-500"
57990
+ [AutomationStatus.DEACTIVATED]: "bg-red-500"
57988
57991
  };
57989
57992
  const STATUS_BG_COLORS = {
57990
- [AutomationStatus.DRAFT]: "bg-gray-100 text-gray-900 hover:bg-gray-200",
57991
- [AutomationStatus.ACTIVE]: "bg-green-100 text-green-900 hover:bg-green-200",
57992
- [AutomationStatus.RUNNING]: "bg-blue-100 text-blue-900 hover:bg-blue-200",
57993
- [AutomationStatus.COMPLETED]: "bg-purple-100 text-purple-900 hover:bg-purple-200",
57994
- [AutomationStatus.FAILED]: "bg-red-100 text-red-900 hover:bg-red-200",
57995
- [AutomationStatus.DEACTIVATED]: "bg-gray-100 text-gray-700 hover:bg-gray-200"
57993
+ [AutomationStatus.DRAFT]: "bg-gray-100 text-gray-700 px-2 py-1",
57994
+ [AutomationStatus.ACTIVE]: "bg-blue-100 text-blue-700 px-2 py-1",
57995
+ [AutomationStatus.RUNNING]: "bg-yellow-100 text-yellow-700 px-2 py-1",
57996
+ [AutomationStatus.COMPLETED]: "bg-green-100 text-green-700 px-2 py-1",
57997
+ [AutomationStatus.FAILED]: "bg-red-100 text-red-700 px-2 py-1",
57998
+ [AutomationStatus.DEACTIVATED]: "bg-red-100 text-red-700 px-2 py-1"
57996
57999
  };
57997
58000
  const STATUS_EXPLANATIONS = {
57998
58001
  [AutomationStatus.DRAFT]: `Draft ${t$1("engage:automation")?.toLowerCase()} can be activated or deactivated`,
@@ -60341,17 +60344,15 @@ const InfoTooltip = ({ title: title2, alertText, Icon: Icon2 = Info, onClick, as
60341
60344
  const [isOpen, setIsOpen] = useState(false);
60342
60345
  const handleClick = (e4) => {
60343
60346
  e4.stopPropagation();
60344
- setIsOpen(!isOpen);
60345
- onClick?.();
60347
+ if (onClick) {
60348
+ onClick();
60349
+ setIsOpen(false);
60350
+ } else {
60351
+ setIsOpen(!isOpen);
60352
+ }
60346
60353
  };
60347
60354
  return /* @__PURE__ */ jsx(TooltipProvider, { children: /* @__PURE__ */ jsxs(Tooltip, { open: isOpen, onOpenChange: setIsOpen, children: [
60348
- /* @__PURE__ */ jsx(TooltipTrigger, { asChild, children: /* @__PURE__ */ jsx(
60349
- Icon2,
60350
- {
60351
- className: "h-3.5 w-3.5 cursor-pointer transition-colors",
60352
- onClick: handleClick
60353
- }
60354
- ) }),
60355
+ /* @__PURE__ */ jsx(TooltipTrigger, { asChild, onClick: handleClick, children: /* @__PURE__ */ jsx(Icon2, { className: "h-3.5 w-3.5 cursor-pointer transition-colors" }) }),
60355
60356
  /* @__PURE__ */ jsx(TooltipContent, { className: "text-left", children: /* @__PURE__ */ jsxs("div", { className: "flex flex-col items-start gap-2 max-w-[300px]", children: [
60356
60357
  alertText && /* @__PURE__ */ jsxs(Fragment, { children: [
60357
60358
  /* @__PURE__ */ jsx(AlertIcon, {}),
@@ -65445,9 +65446,9 @@ const EditCampaignContentDialog = ({ open, onOpenChange }) => {
65445
65446
  };
65446
65447
  const MacOSWindowButtons = () => {
65447
65448
  return /* @__PURE__ */ jsxs("div", { className: "flex items-center space-x-2", children: [
65448
- /* @__PURE__ */ jsx("span", { className: "w-3 h-3 rounded-full bg-[#FF605C] border border-zinc-300 shadow-sm" }),
65449
- /* @__PURE__ */ jsx("span", { className: "w-3 h-3 rounded-full bg-[#FFBD44] border border-zinc-300 shadow-sm" }),
65450
- /* @__PURE__ */ jsx("span", { className: "w-3 h-3 rounded-full bg-[#00CA4E] border border-zinc-300 shadow-sm" })
65449
+ /* @__PURE__ */ jsx("span", { className: "w-3 h-3 rounded-full bg-zinc-300 border border-zinc-300 shadow-sm" }),
65450
+ /* @__PURE__ */ jsx("span", { className: "w-3 h-3 rounded-full bg-zinc-300 border border-zinc-300 shadow-sm" }),
65451
+ /* @__PURE__ */ jsx("span", { className: "w-3 h-3 rounded-full bg-zinc-300 border border-zinc-300 shadow-sm" })
65451
65452
  ] });
65452
65453
  };
65453
65454
  const AutomationEditorPreviewContainer = ({ children: children2, actionButtons }) => {
@@ -65505,7 +65506,7 @@ const EmailDetailsPreview = () => {
65505
65506
  const subject = communicationGroup.emailSubject;
65506
65507
  const previewText = communicationGroup.emailPreviewText;
65507
65508
  const fromName = emailChannelSender?.channelSenderMetadata.emailFromName;
65508
- return /* @__PURE__ */ jsxs("div", { className: "space-y-4", children: [
65509
+ return /* @__PURE__ */ jsxs("div", { className: "space-y-1 overflow-hidden", children: [
65509
65510
  /* @__PURE__ */ jsxs("div", { className: "space-y-1", children: [
65510
65511
  /* @__PURE__ */ jsx("div", { className: "text-xs text-muted-foreground leading-none", children: "From" }),
65511
65512
  /* @__PURE__ */ jsxs("div", { className: "text-base font-medium", children: [
@@ -66063,7 +66064,8 @@ const AutomationEditorSMSPreview = ({
66063
66064
  const AutomationEditorTabs = ({
66064
66065
  disablePreview = false,
66065
66066
  disableEditContent = false,
66066
- disablePreviewSubtext = false
66067
+ disablePreviewSubtext = false,
66068
+ hideSms = false
66067
66069
  }) => {
66068
66070
  const [activeTab, setActiveTab] = useState("email");
66069
66071
  const [initialLoad, setInitialLoad] = useState(false);
@@ -66094,46 +66096,52 @@ const AutomationEditorTabs = ({
66094
66096
  defaultValue: "email",
66095
66097
  className: "flex flex-col gap-4 pt-4 flex-1 bg-muted rounded-md",
66096
66098
  children: [
66097
- /* @__PURE__ */ jsx("div", { className: "max-w-[640px] mx-auto w-full", children: /* @__PURE__ */ jsxs(TabsList, { className: "grid w-full grid-cols-2", children: [
66098
- /* @__PURE__ */ jsx(TabsTrigger, { value: "email", className: "group", children: /* @__PURE__ */ jsxs("div", { className: "flex items-center", children: [
66099
- /* @__PURE__ */ jsx(
66100
- "img",
66101
- {
66102
- src: emailActiveIcon,
66103
- alt: "Email",
66104
- className: "w-4 h-4 mr-2 hidden group-data-[state=active]:block"
66105
- }
66106
- ),
66107
- /* @__PURE__ */ jsx(
66108
- "img",
66109
- {
66110
- src: emailInactiveIcon,
66111
- alt: "Email",
66112
- className: "w-4 h-4 mr-2 block group-data-[state=active]:hidden"
66113
- }
66114
- ),
66115
- "Email"
66116
- ] }) }),
66117
- /* @__PURE__ */ jsx(TabsTrigger, { value: "sms", className: "group", children: /* @__PURE__ */ jsxs("div", { className: "flex items-center", children: [
66118
- /* @__PURE__ */ jsx(
66119
- "img",
66120
- {
66121
- src: smsActiveIcon,
66122
- alt: "SMS",
66123
- className: "w-4 h-4 mr-2 hidden group-data-[state=active]:block"
66124
- }
66125
- ),
66126
- /* @__PURE__ */ jsx(
66127
- "img",
66128
- {
66129
- src: smsInactiveIcon,
66130
- alt: "SMS",
66131
- className: "w-4 h-4 mr-2 block group-data-[state=active]:hidden"
66132
- }
66133
- ),
66134
- "SMS"
66135
- ] }) })
66136
- ] }) }),
66099
+ /* @__PURE__ */ jsx("div", { className: "max-w-[640px] mx-auto w-full", children: /* @__PURE__ */ jsxs(
66100
+ TabsList,
66101
+ {
66102
+ className: `grid w-full ${hideSms ? "grid-cols-1" : "grid-cols-2"}`,
66103
+ children: [
66104
+ /* @__PURE__ */ jsx(TabsTrigger, { value: "email", className: "group", children: /* @__PURE__ */ jsxs("div", { className: "flex items-center", children: [
66105
+ /* @__PURE__ */ jsx(
66106
+ "img",
66107
+ {
66108
+ src: emailActiveIcon,
66109
+ alt: "Email",
66110
+ className: "w-4 h-4 mr-2 hidden group-data-[state=active]:block"
66111
+ }
66112
+ ),
66113
+ /* @__PURE__ */ jsx(
66114
+ "img",
66115
+ {
66116
+ src: emailInactiveIcon,
66117
+ alt: "Email",
66118
+ className: "w-4 h-4 mr-2 block group-data-[state=active]:hidden"
66119
+ }
66120
+ ),
66121
+ "Email"
66122
+ ] }) }),
66123
+ !hideSms && /* @__PURE__ */ jsx(TabsTrigger, { value: "sms", className: "group", children: /* @__PURE__ */ jsxs("div", { className: "flex items-center", children: [
66124
+ /* @__PURE__ */ jsx(
66125
+ "img",
66126
+ {
66127
+ src: smsActiveIcon,
66128
+ alt: "SMS",
66129
+ className: "w-4 h-4 mr-2 hidden group-data-[state=active]:block"
66130
+ }
66131
+ ),
66132
+ /* @__PURE__ */ jsx(
66133
+ "img",
66134
+ {
66135
+ src: smsInactiveIcon,
66136
+ alt: "SMS",
66137
+ className: "w-4 h-4 mr-2 block group-data-[state=active]:hidden"
66138
+ }
66139
+ ),
66140
+ "SMS"
66141
+ ] }) })
66142
+ ]
66143
+ }
66144
+ ) }),
66137
66145
  /* @__PURE__ */ jsxs("div", { className: "max-w-[1000px] mx-auto w-full flex-1", children: [
66138
66146
  /* @__PURE__ */ jsx(TabsContent, { value: "sms", children: /* @__PURE__ */ jsx(
66139
66147
  AutomationEditorSMSPreview,
@@ -66158,15 +66166,15 @@ const AutomationEditorTabs = ({
66158
66166
  };
66159
66167
  const h2 = "reach-styles-module__h2___J-48W";
66160
66168
  const minorText = "reach-styles-module__minorText___1TEN6";
66161
- const styles$1 = {
66169
+ const styles$2 = {
66162
66170
  h2,
66163
66171
  minorText
66164
66172
  };
66165
66173
  const H2 = ({ children: children2, className: className2 }) => {
66166
- return /* @__PURE__ */ jsx("h2", { className: cn$1(styles$1.h2, className2), children: children2 });
66174
+ return /* @__PURE__ */ jsx("h2", { className: cn$1(styles$2.h2, className2), children: children2 });
66167
66175
  };
66168
66176
  const MinorText = ({ children: children2, className: className2 }) => {
66169
- return /* @__PURE__ */ jsx("p", { className: cn$1(styles$1.minorText, className2), children: children2 });
66177
+ return /* @__PURE__ */ jsx("p", { className: cn$1(styles$2.minorText, className2), children: children2 });
66170
66178
  };
66171
66179
  const MainPageWrapper = ({ title: title2, children: children2, headerActions }) => {
66172
66180
  return /* @__PURE__ */ jsxs("div", { className: "max-w-[1000px] mx-auto w-full flex-1 flex flex-col gap-4 pt-4", children: [
@@ -67308,7 +67316,7 @@ var formatters$1 = {
67308
67316
  }
67309
67317
  },
67310
67318
  // Timezone (specific non-location)
67311
- z: function z2(date2, token, _localize, options) {
67319
+ z: function z(date2, token, _localize, options) {
67312
67320
  var originalDate = options._originalDate || date2;
67313
67321
  var timezoneOffset = originalDate.getTimezoneOffset();
67314
67322
  switch (token) {
@@ -73457,22 +73465,29 @@ const OneTimeWizardMain = ({ onFinish, getExtraMergeFields, onBeforeSchedule })
73457
73465
  renderFooter()
73458
73466
  ] });
73459
73467
  };
73468
+ const OneTimeWizardWrapper = ({ children: children2, actionId }) => {
73469
+ const { setActionId: setActionId2 } = useContext$1(Context);
73470
+ useEffect(() => {
73471
+ setActionId2(actionId);
73472
+ }, [actionId, setActionId2]);
73473
+ return /* @__PURE__ */ jsx("div", { children: children2 });
73474
+ };
73460
73475
  const OneTimeBroadcast = () => {
73461
73476
  return /* @__PURE__ */ jsxs("div", { children: [
73462
- /* @__PURE__ */ jsx("div", { className: styles$4.iconWrapper, children: /* @__PURE__ */ jsx(IconDefinitions.OneTimeBroadcast, {}) }),
73463
- /* @__PURE__ */ jsxs("h3", { className: styles$4.cardTitle, children: [
73477
+ /* @__PURE__ */ jsx("div", { className: styles$5.iconWrapper, children: /* @__PURE__ */ jsx(IconDefinitions.OneTimeBroadcast, {}) }),
73478
+ /* @__PURE__ */ jsxs("h3", { className: styles$5.cardTitle, children: [
73464
73479
  t$1("engage:one_time"),
73465
73480
  " Broadcast"
73466
73481
  ] }),
73467
- /* @__PURE__ */ jsx("p", { className: styles$4.cardDescription, children: "Send a single message to your current list, like announcing a sale or newsletter." })
73482
+ /* @__PURE__ */ jsx("p", { className: styles$5.cardDescription, children: "Send a single message to your current list, like announcing a sale or newsletter." })
73468
73483
  ] });
73469
73484
  };
73470
73485
  const RealtimeActivity = () => {
73471
73486
  return /* @__PURE__ */ jsxs("div", { children: [
73472
- /* @__PURE__ */ jsx("div", { className: styles$4.comingSoonBadge, children: "Coming Soon" }),
73473
- /* @__PURE__ */ jsx("div", { className: styles$4.iconWrapper, children: /* @__PURE__ */ jsx(IconDefinitions.RealtimeActivity, {}) }),
73474
- /* @__PURE__ */ jsx("h3", { className: styles$4.cardTitle, children: "Realtime Activity" }),
73475
- /* @__PURE__ */ jsx("p", { className: styles$4.cardDescription, children: "Responds to immediate actions your contacts take, like abandoned carts, form submissions, or appointment bookings." })
73487
+ /* @__PURE__ */ jsx("div", { className: styles$5.comingSoonBadge, children: "Coming Soon" }),
73488
+ /* @__PURE__ */ jsx("div", { className: styles$5.iconWrapper, children: /* @__PURE__ */ jsx(IconDefinitions.RealtimeActivity, {}) }),
73489
+ /* @__PURE__ */ jsx("h3", { className: styles$5.cardTitle, children: "Realtime Activity" }),
73490
+ /* @__PURE__ */ jsx("p", { className: styles$5.cardDescription, children: "Responds to immediate actions your contacts take, like abandoned carts, form submissions, or appointment bookings." })
73476
73491
  ] });
73477
73492
  };
73478
73493
  const SetAutomationNameAndDescription = ({
@@ -73569,6 +73584,7 @@ const CreateAutomationModal = ({
73569
73584
  const [automationId, setAutomationId] = useState(
73570
73585
  void 0
73571
73586
  );
73587
+ const [communicationActionId, setCommunicationActionId] = useState(void 0);
73572
73588
  const [initalStateSet, setInitalStateSet] = useState(false);
73573
73589
  const [automationState, setAutomationState] = useState(
73574
73590
  /**
@@ -73643,6 +73659,7 @@ const CreateAutomationModal = ({
73643
73659
  });
73644
73660
  if (automationType === AutomationTriggerType.ONE_TIME) {
73645
73661
  setCurrentStep(CreateAutomationModalStep.OneTimeWizard);
73662
+ setCommunicationActionId(actionId);
73646
73663
  setStartedCreating(false);
73647
73664
  } else {
73648
73665
  onClose?.(response.id);
@@ -73665,7 +73682,7 @@ const CreateAutomationModal = ({
73665
73682
  });
73666
73683
  };
73667
73684
  if (isCreating || startedCreating) {
73668
- return /* @__PURE__ */ jsx("div", { className: styles$4.container, children: /* @__PURE__ */ jsx(
73685
+ return /* @__PURE__ */ jsx("div", { className: styles$5.container, children: /* @__PURE__ */ jsx(
73669
73686
  BasicLoader,
73670
73687
  {
73671
73688
  text: [`Creating ${t$1("engage:one_time")}`, "Finishing up"]
@@ -73709,10 +73726,10 @@ const CreateAutomationModal = ({
73709
73726
  }
73710
73727
  );
73711
73728
  case CreateAutomationModalStep.OneTimeWizard:
73712
- if (!automationId) {
73729
+ if (!automationId || !communicationActionId) {
73713
73730
  return null;
73714
73731
  }
73715
- return /* @__PURE__ */ jsx(ViewAutomationProvider, { automationId, children: /* @__PURE__ */ jsx(
73732
+ return /* @__PURE__ */ jsx(ViewAutomationProvider, { automationId, children: /* @__PURE__ */ jsx(OneTimeWizardWrapper, { actionId: communicationActionId, children: /* @__PURE__ */ jsx(
73716
73733
  OneTimeWizardMain,
73717
73734
  {
73718
73735
  onFinish: () => {
@@ -73721,7 +73738,7 @@ const CreateAutomationModal = ({
73721
73738
  getExtraMergeFields,
73722
73739
  onBeforeSchedule
73723
73740
  }
73724
- ) });
73741
+ ) }) });
73725
73742
  default:
73726
73743
  throw UnreachableCaseStatement$1(currentStep, CreateAutomationModalStep);
73727
73744
  }
@@ -73867,7 +73884,7 @@ const formatCurrency = (amount) => {
73867
73884
  maximumFractionDigits: 2
73868
73885
  }).format(num);
73869
73886
  };
73870
- const base = "reach-styles-module__base___zJcoE";
73887
+ const base$1 = "reach-styles-module__base___zJcoE";
73871
73888
  const destructive = "reach-styles-module__destructive___5EWhN";
73872
73889
  const outline = "reach-styles-module__outline___gj9sC";
73873
73890
  const secondary = "reach-styles-module__secondary___cN5Wj";
@@ -73876,8 +73893,8 @@ const title = "reach-styles-module__title___n1hA9";
73876
73893
  const description = "reach-styles-module__description___EvXM-";
73877
73894
  const content = "reach-styles-module__content___okv68";
73878
73895
  const footer = "reach-styles-module__footer___YA4U4";
73879
- const styles = {
73880
- base,
73896
+ const styles$1 = {
73897
+ base: base$1,
73881
73898
  "default": "reach-styles-module__default___88Q0d",
73882
73899
  destructive,
73883
73900
  outline,
@@ -73888,13 +73905,13 @@ const styles = {
73888
73905
  content,
73889
73906
  footer
73890
73907
  };
73891
- const cardVariants = cva(styles.base, {
73908
+ const cardVariants = cva(styles$1.base, {
73892
73909
  variants: {
73893
73910
  variant: {
73894
- default: styles.default,
73895
- destructive: styles.destructive,
73896
- outline: styles.outline,
73897
- secondary: styles.secondary
73911
+ default: styles$1.default,
73912
+ destructive: styles$1.destructive,
73913
+ outline: styles$1.outline,
73914
+ secondary: styles$1.secondary
73898
73915
  }
73899
73916
  },
73900
73917
  defaultVariants: {
@@ -73914,15 +73931,15 @@ const Card = React.forwardRef(
73914
73931
  }
73915
73932
  );
73916
73933
  Card.displayName = "Card";
73917
- const CardHeader = React.forwardRef(({ className: className2, ...props2 }, ref) => /* @__PURE__ */ jsx("div", { ref, className: cn$1(styles.header, className2), ...props2 }));
73934
+ const CardHeader = React.forwardRef(({ className: className2, ...props2 }, ref) => /* @__PURE__ */ jsx("div", { ref, className: cn$1(styles$1.header, className2), ...props2 }));
73918
73935
  CardHeader.displayName = "CardHeader";
73919
- const CardTitle = React.forwardRef(({ className: className2, ...props2 }, ref) => /* @__PURE__ */ jsx("div", { ref, className: cn$1(styles.title, className2), ...props2 }));
73936
+ const CardTitle = React.forwardRef(({ className: className2, ...props2 }, ref) => /* @__PURE__ */ jsx("div", { ref, className: cn$1(styles$1.title, className2), ...props2 }));
73920
73937
  CardTitle.displayName = "CardTitle";
73921
- const CardDescription = React.forwardRef(({ className: className2, ...props2 }, ref) => /* @__PURE__ */ jsx("div", { ref, className: cn$1(styles.description, className2), ...props2 }));
73938
+ const CardDescription = React.forwardRef(({ className: className2, ...props2 }, ref) => /* @__PURE__ */ jsx("div", { ref, className: cn$1(styles$1.description, className2), ...props2 }));
73922
73939
  CardDescription.displayName = "CardDescription";
73923
- const CardContent = React.forwardRef(({ className: className2, ...props2 }, ref) => /* @__PURE__ */ jsx("div", { ref, className: cn$1(styles.content, className2), ...props2 }));
73940
+ const CardContent = React.forwardRef(({ className: className2, ...props2 }, ref) => /* @__PURE__ */ jsx("div", { ref, className: cn$1(styles$1.content, className2), ...props2 }));
73924
73941
  CardContent.displayName = "CardContent";
73925
- const CardFooter = React.forwardRef(({ className: className2, ...props2 }, ref) => /* @__PURE__ */ jsx("div", { ref, className: cn$1(styles.footer, className2), ...props2 }));
73942
+ const CardFooter = React.forwardRef(({ className: className2, ...props2 }, ref) => /* @__PURE__ */ jsx("div", { ref, className: cn$1(styles$1.footer, className2), ...props2 }));
73926
73943
  CardFooter.displayName = "CardFooter";
73927
73944
  const StatCard = ({
73928
73945
  Icon: Icon2,
@@ -74041,6 +74058,7 @@ const StatsGrid = ({
74041
74058
  const AutomationStatistics = ({
74042
74059
  automationId,
74043
74060
  includeSales = false,
74061
+ includeSms = false,
74044
74062
  automation: automation2
74045
74063
  }) => {
74046
74064
  const [activeTab, setActiveTab] = useState("email");
@@ -74062,11 +74080,13 @@ const AutomationStatistics = ({
74062
74080
  label: `Email ${t$1("engage:insight", { count: 2 })}`,
74063
74081
  content: /* @__PURE__ */ jsx(StatsGrid, { activeTab: "email", statistics })
74064
74082
  },
74065
- {
74066
- id: "sms",
74067
- label: `SMS ${t$1("engage:insight", { count: 2 })}`,
74068
- content: /* @__PURE__ */ jsx(StatsGrid, { activeTab: "sms", statistics })
74069
- },
74083
+ ...includeSms ? [
74084
+ {
74085
+ id: "sms",
74086
+ label: `SMS ${t$1("engage:insight", { count: 2 })}`,
74087
+ content: /* @__PURE__ */ jsx(StatsGrid, { activeTab: "sms", statistics })
74088
+ }
74089
+ ] : [],
74070
74090
  ...includeSales ? [
74071
74091
  {
74072
74092
  id: "sales",
@@ -74387,7 +74407,7 @@ const AutoParseConfirmWebsite = ({ setAutoParse, onBrandSettingsGenerated, onFor
74387
74407
  exit: { opacity: 0 },
74388
74408
  className: "flex-1 h-full",
74389
74409
  children: /* @__PURE__ */ jsx(
74390
- BrandSettingsModal,
74410
+ BrandSettings,
74391
74411
  {
74392
74412
  initialBrandSettings: brandSettings,
74393
74413
  onSave: handleUpdateBrandSettings,
@@ -74619,7 +74639,7 @@ const AutoParseConfirmWebsite = ({ setAutoParse, onBrandSettingsGenerated, onFor
74619
74639
  ] });
74620
74640
  };
74621
74641
  const DEFAULT_COLORS = ["#a91919", "#2563eb", "#16a34a", "#f59e0b", "#6d28d9"];
74622
- const BrandSettingsModal = ({ initialBrandSettings, onSave, onBack, showAutoParseButton = true }) => {
74642
+ const BrandSettings = ({ initialBrandSettings, onSave, onBack, showAutoParseButton = true }) => {
74623
74643
  const {
74624
74644
  data: meResponse,
74625
74645
  isLoading: isLoadingMe,
@@ -74836,12 +74856,8 @@ const BrandSettingsModal = ({ initialBrandSettings, onSave, onBack, showAutoPars
74836
74856
  }
74837
74857
  );
74838
74858
  }
74839
- return /* @__PURE__ */ jsxs("div", { className: "w-full h-full flex flex-col bg-white rounded-lg overflow-hidden", children: [
74840
- /* @__PURE__ */ jsx("div", { className: "w-full h-16 px-6 flex items-center justify-between", children: /* @__PURE__ */ jsxs("div", { children: [
74841
- /* @__PURE__ */ jsx("h2", { className: "text-xl font-semibold text-gray-800", children: "Brand Settings" }),
74842
- /* @__PURE__ */ jsx("p", { className: "text-gray-500 text-sm", children: initialBrandSettings ? "Review and confirm your extracted brand identity" : "Craft your brand's visual identity" })
74843
- ] }) }),
74844
- /* @__PURE__ */ jsxs("div", { className: "flex-1 overflow-y-auto p-4 space-y-4", children: [
74859
+ return /* @__PURE__ */ jsxs("div", { className: "w-full h-full flex flex-col bg-white rounded-lg overflow-hidden gap-4 pt-16", children: [
74860
+ /* @__PURE__ */ jsxs("div", { className: "flex-1 overflow-y-auto space-y-4 px-6 pt-2", children: [
74845
74861
  /* @__PURE__ */ jsxs("div", { className: "bg-white rounded-xl shadow border border-gray-100 overflow-hidden", children: [
74846
74862
  /* @__PURE__ */ jsxs(
74847
74863
  "div",
@@ -75387,7 +75403,7 @@ const BrandSettingsModal = ({ initialBrandSettings, onSave, onBack, showAutoPars
75387
75403
  Badge,
75388
75404
  {
75389
75405
  variant: "outline",
75390
- className: "px-3 py-1.5 border-2 hover:border-red-100 group transition-colors",
75406
+ className: "px-3 py-1.5 border-2 hover:border-red-100 group transition-colors text-primary",
75391
75407
  style: {
75392
75408
  borderColor: `${brandSettings.primaryColor}30` || "#f3f4f6",
75393
75409
  backgroundColor: `${brandSettings.primaryColor}08` || "#f9fafb"
@@ -75438,7 +75454,7 @@ const BrandSettingsModal = ({ initialBrandSettings, onSave, onBack, showAutoPars
75438
75454
  ] })
75439
75455
  ] })
75440
75456
  ] }),
75441
- /* @__PURE__ */ jsxs(DialogFooter, { className: "p-4 pb-0", children: [
75457
+ /* @__PURE__ */ jsxs(DialogFooter, { className: "pb-4 px-6", children: [
75442
75458
  onBack ? /* @__PURE__ */ jsx(Button$1, { variant: "outline", className: "gap-1.5", onClick: onBack, children: "Go Back" }) : showAutoParseButton && /* @__PURE__ */ jsxs(
75443
75459
  Button$1,
75444
75460
  {
@@ -75464,678 +75480,235 @@ const BrandSettingsModal = ({ initialBrandSettings, onSave, onBack, showAutoPars
75464
75480
  ] })
75465
75481
  ] });
75466
75482
  };
75467
- function BrandSettingsDialog({
75468
- open,
75469
- setOpen
75470
- }) {
75471
- return /* @__PURE__ */ jsx(Dialog, { open, onOpenChange: setOpen, children: /* @__PURE__ */ jsxs(
75472
- DialogContent,
75473
- {
75474
- className: "flex w-[90vw] h-[90vh] flex-col gap-0 overflow-hidden sm:max-w-xl md:max-w-3xl lg:max-w-4xl xl:max-w-5xl",
75475
- hideCloseButton: true,
75476
- children: [
75477
- /* @__PURE__ */ jsxs(VisuallyHidden$2, { children: [
75478
- /* @__PURE__ */ jsx(DialogTitle, { children: "Brand Settings" }),
75479
- /* @__PURE__ */ jsx(DialogDescription, { children: "Edit your business brand settings" })
75480
- ] }),
75481
- /* @__PURE__ */ jsx(BrandSettingsModal, {})
75482
- ]
75483
+ var isCheckBoxInput = (element) => element.type === "checkbox";
75484
+ var isDateObject = (value) => value instanceof Date;
75485
+ var isNullOrUndefined = (value) => value == null;
75486
+ const isObjectType = (value) => typeof value === "object";
75487
+ var isObject = (value) => !isNullOrUndefined(value) && !Array.isArray(value) && isObjectType(value) && !isDateObject(value);
75488
+ var getEventValue = (event) => isObject(event) && event.target ? isCheckBoxInput(event.target) ? event.target.checked : event.target.value : event;
75489
+ var getNodeParentName = (name) => name.substring(0, name.search(/\.\d+(\.|$)/)) || name;
75490
+ var isNameInFieldArray = (names, name) => names.has(getNodeParentName(name));
75491
+ var isPlainObject = (tempObject) => {
75492
+ const prototypeCopy = tempObject.constructor && tempObject.constructor.prototype;
75493
+ return isObject(prototypeCopy) && prototypeCopy.hasOwnProperty("isPrototypeOf");
75494
+ };
75495
+ var isWeb = typeof window !== "undefined" && typeof window.HTMLElement !== "undefined" && typeof document !== "undefined";
75496
+ function cloneObject(data) {
75497
+ let copy2;
75498
+ const isArray3 = Array.isArray(data);
75499
+ const isFileListInstance = typeof FileList !== "undefined" ? data instanceof FileList : false;
75500
+ if (data instanceof Date) {
75501
+ copy2 = new Date(data);
75502
+ } else if (data instanceof Set) {
75503
+ copy2 = new Set(data);
75504
+ } else if (!(isWeb && (data instanceof Blob || isFileListInstance)) && (isArray3 || isObject(data))) {
75505
+ copy2 = isArray3 ? [] : {};
75506
+ if (!isArray3 && !isPlainObject(data)) {
75507
+ copy2 = data;
75508
+ } else {
75509
+ for (const key in data) {
75510
+ if (data.hasOwnProperty(key)) {
75511
+ copy2[key] = cloneObject(data[key]);
75512
+ }
75513
+ }
75483
75514
  }
75484
- ) });
75515
+ } else {
75516
+ return data;
75517
+ }
75518
+ return copy2;
75485
75519
  }
75486
- const useAutomationStatusToggle = (id2) => {
75487
- const { updateAutomation: updateAutomation2, updateError, isUpdateSuccess } = useUpdateBusinessAutomation(id2);
75488
- const { toast: toast2 } = useToast();
75489
- const toggleStatus = async (isActive) => {
75490
- try {
75491
- await updateAutomation2({
75492
- status: isActive ? AutomationStatus.ACTIVE : AutomationStatus.DRAFT
75493
- });
75494
- return true;
75495
- } catch (error2) {
75496
- console.error("Update failed:", error2);
75497
- toast2({
75498
- title: "Error updating status",
75499
- description: "Please try again",
75500
- variant: "destructive"
75501
- });
75502
- return false;
75520
+ var compact = (value) => Array.isArray(value) ? value.filter(Boolean) : [];
75521
+ var isUndefined = (val) => val === void 0;
75522
+ var get = (object, path2, defaultValue) => {
75523
+ if (!path2 || !isObject(object)) {
75524
+ return defaultValue;
75525
+ }
75526
+ const result = compact(path2.split(/[,[\].]+?/)).reduce((result2, key) => isNullOrUndefined(result2) ? result2 : result2[key], object);
75527
+ return isUndefined(result) || result === object ? isUndefined(object[path2]) ? defaultValue : object[path2] : result;
75528
+ };
75529
+ var isBoolean = (value) => typeof value === "boolean";
75530
+ var isKey = (value) => /^\w*$/.test(value);
75531
+ var stringToPath = (input) => compact(input.replace(/["|']|\]/g, "").split(/\.|\[/));
75532
+ var set = (object, path2, value) => {
75533
+ let index2 = -1;
75534
+ const tempPath = isKey(path2) ? [path2] : stringToPath(path2);
75535
+ const length = tempPath.length;
75536
+ const lastIndex = length - 1;
75537
+ while (++index2 < length) {
75538
+ const key = tempPath[index2];
75539
+ let newValue = value;
75540
+ if (index2 !== lastIndex) {
75541
+ const objValue = object[key];
75542
+ newValue = isObject(objValue) || Array.isArray(objValue) ? objValue : !isNaN(+tempPath[index2 + 1]) ? [] : {};
75503
75543
  }
75504
- };
75505
- useEffect(() => {
75506
- if (isUpdateSuccess) {
75507
- toast2({
75508
- title: "Status updated",
75509
- description: "The status has been updated successfully"
75510
- });
75511
- } else if (updateError) {
75512
- toast2({
75513
- title: "Error updating status",
75514
- description: "Please try again",
75515
- variant: "destructive"
75516
- });
75544
+ if (key === "__proto__" || key === "constructor" || key === "prototype") {
75545
+ return;
75517
75546
  }
75518
- }, [isUpdateSuccess, updateError, toast2]);
75519
- return { toggleStatus };
75547
+ object[key] = newValue;
75548
+ object = object[key];
75549
+ }
75520
75550
  };
75521
- const DEFAULT_PAGE_SIZE$2 = 10;
75522
- function AutomationList() {
75523
- const { toast: toast2 } = useToast();
75524
- const [updatingId, setUpdatingId] = useState(null);
75525
- const { toggleStatus } = useAutomationStatusToggle(updatingId || "");
75526
- const navigate = useNavigate();
75527
- const [pageSizeForQuery, setPageSizeForQuery] = useState(DEFAULT_PAGE_SIZE$2);
75528
- const [cursorForQuery, setCursorForQuery] = useState(
75529
- void 0
75530
- );
75531
- const [searchQuery, setSearchQuery] = useState("");
75532
- const {
75533
- automations,
75534
- nextCursor,
75535
- isLoading,
75536
- error: error2,
75537
- isFetching,
75538
- isPlaceholderData
75539
- } = useListBusinessAutomations({
75540
- cursor: cursorForQuery,
75541
- limit: pageSizeForQuery,
75542
- triggerType: AutomationTriggerType.TRIGGER_BASED,
75543
- search: searchQuery || void 0
75544
- });
75545
- useEffect(() => {
75546
- if (error2) {
75547
- toast2({
75548
- title: `Error Fetching ${t$1("engage:automation")}`,
75549
- description: error2?.message || "Please try again.",
75550
- variant: "destructive"
75551
- });
75551
+ const EVENTS = {
75552
+ BLUR: "blur",
75553
+ FOCUS_OUT: "focusout",
75554
+ CHANGE: "change"
75555
+ };
75556
+ const VALIDATION_MODE = {
75557
+ onBlur: "onBlur",
75558
+ onChange: "onChange",
75559
+ onSubmit: "onSubmit",
75560
+ onTouched: "onTouched",
75561
+ all: "all"
75562
+ };
75563
+ const INPUT_VALIDATION_RULES = {
75564
+ max: "max",
75565
+ min: "min",
75566
+ maxLength: "maxLength",
75567
+ minLength: "minLength",
75568
+ pattern: "pattern",
75569
+ required: "required",
75570
+ validate: "validate"
75571
+ };
75572
+ const HookFormContext = React__default.createContext(null);
75573
+ const useFormContext = () => React__default.useContext(HookFormContext);
75574
+ const FormProvider = (props2) => {
75575
+ const { children: children2, ...data } = props2;
75576
+ return React__default.createElement(HookFormContext.Provider, { value: data }, children2);
75577
+ };
75578
+ var getProxyFormState = (formState, control, localProxyFormState, isRoot = true) => {
75579
+ const result = {
75580
+ defaultValues: control._defaultValues
75581
+ };
75582
+ for (const key in formState) {
75583
+ Object.defineProperty(result, key, {
75584
+ get: () => {
75585
+ const _key = key;
75586
+ if (control._proxyFormState[_key] !== VALIDATION_MODE.all) {
75587
+ control._proxyFormState[_key] = !isRoot || VALIDATION_MODE.all;
75588
+ }
75589
+ localProxyFormState && (localProxyFormState[_key] = true);
75590
+ return formState[_key];
75591
+ }
75592
+ });
75593
+ }
75594
+ return result;
75595
+ };
75596
+ var isPrimitive = (value) => isNullOrUndefined(value) || !isObjectType(value);
75597
+ function deepEqual(object1, object2) {
75598
+ if (isPrimitive(object1) || isPrimitive(object2)) {
75599
+ return object1 === object2;
75600
+ }
75601
+ if (isDateObject(object1) && isDateObject(object2)) {
75602
+ return object1.getTime() === object2.getTime();
75603
+ }
75604
+ const keys1 = Object.keys(object1);
75605
+ const keys2 = Object.keys(object2);
75606
+ if (keys1.length !== keys2.length) {
75607
+ return false;
75608
+ }
75609
+ for (const key of keys1) {
75610
+ const val1 = object1[key];
75611
+ if (!keys2.includes(key)) {
75612
+ return false;
75552
75613
  }
75553
- }, [error2, toast2]);
75554
- const mappedItems = useMemo(() => {
75555
- return (automations || []).map((automation2) => ({
75556
- ...automation2,
75557
- emailsSent: 0,
75558
- smsSent: 0,
75559
- updated_at: automation2.updatedAt || automation2.createdAt
75560
- }));
75561
- }, [automations]);
75562
- const handleToggle = useCallback(
75563
- async (id2, newStatus) => {
75564
- try {
75565
- setUpdatingId(id2);
75566
- const shouldBeActive = newStatus === AutomationStatus.ACTIVE;
75567
- await toggleStatus(shouldBeActive);
75568
- } finally {
75569
- setUpdatingId(null);
75614
+ if (key !== "ref") {
75615
+ const val2 = object2[key];
75616
+ if (isDateObject(val1) && isDateObject(val2) || isObject(val1) && isObject(val2) || Array.isArray(val1) && Array.isArray(val2) ? !deepEqual(val1, val2) : val1 !== val2) {
75617
+ return false;
75570
75618
  }
75571
- },
75572
- [toggleStatus, setUpdatingId]
75573
- );
75574
- const handleQueryParametersChange = useCallback(
75575
- (params) => {
75576
- setCursorForQuery(params.cursor);
75577
- setPageSizeForQuery(params.pageSize);
75578
- },
75579
- []
75580
- );
75581
- const setUrl = useCallback(
75582
- (id2) => `/automations/view-modal/${id2}?showBackButton=true`,
75583
- []
75584
- );
75585
- const columns = useMemo(
75586
- () => createColumns({
75587
- automationName: t$1("engage:automation"),
75588
- setUrl,
75589
- onToggle: handleToggle,
75590
- vsaasManaged: true
75591
- }),
75592
- [handleToggle, setUrl]
75593
- );
75594
- return /* @__PURE__ */ jsx("div", { className: "w-full h-[75vh] flex flex-col", children: /* @__PURE__ */ jsx("div", { className: "flex-grow min-h-0 p-2", children: /* @__PURE__ */ jsx(
75595
- TanstackTable,
75596
- {
75597
- data: mappedItems,
75598
- columns,
75599
- paginationMode: "cursor",
75600
- initialPageSize: pageSizeForQuery,
75601
- isLoading: isLoading && !isPlaceholderData,
75602
- onRowClick: (row) => {
75603
- navigate(`/automations/view-modal/${row.id}?showBackButton=true`);
75604
- },
75605
- cursorPaginationQueryResult: {
75606
- nextCursor,
75607
- isLoading,
75608
- isFetching,
75609
- isPlaceholderData
75610
- },
75611
- onQueryParametersChange: handleQueryParametersChange,
75612
- searchValue: searchQuery,
75613
- onSearchChange: setSearchQuery
75614
75619
  }
75615
- ) }) });
75620
+ }
75621
+ return true;
75616
75622
  }
75617
- const DEFAULT_PAGE_SIZE$1 = 10;
75618
- function BroadcastList() {
75619
- const { toast: toast2 } = useToast();
75620
- const [createDialogOpen, setCreateDialogOpen] = useState(false);
75621
- const [updatingId, setUpdatingId] = useState(null);
75622
- const { toggleStatus } = useAutomationStatusToggle(updatingId || "");
75623
- const navigate = useNavigate();
75624
- const [pageSizeForQuery, setPageSizeForQuery] = useState(DEFAULT_PAGE_SIZE$1);
75625
- const [cursorForQuery, setCursorForQuery] = useState(
75626
- void 0
75627
- );
75628
- const [searchQuery, setSearchQuery] = useState("");
75629
- const {
75630
- automations,
75631
- nextCursor,
75632
- isLoading,
75633
- error: error2,
75634
- isFetching,
75635
- isPlaceholderData
75636
- } = useListBusinessAutomations({
75637
- cursor: cursorForQuery,
75638
- limit: pageSizeForQuery,
75639
- triggerType: AutomationTriggerType.ONE_TIME,
75640
- search: searchQuery || void 0
75623
+ const useDeepEqualEffect = (effect, deps) => {
75624
+ const ref = useRef(deps);
75625
+ if (!deepEqual(deps, ref.current)) {
75626
+ ref.current = deps;
75627
+ }
75628
+ useEffect(effect, ref.current);
75629
+ };
75630
+ function useFormState(props2) {
75631
+ const methods = useFormContext();
75632
+ const { control = methods.control, disabled, name, exact } = props2 || {};
75633
+ const [formState, updateFormState] = React__default.useState(control._formState);
75634
+ const _localProxyFormState = React__default.useRef({
75635
+ isDirty: false,
75636
+ isLoading: false,
75637
+ dirtyFields: false,
75638
+ touchedFields: false,
75639
+ validatingFields: false,
75640
+ isValidating: false,
75641
+ isValid: false,
75642
+ errors: false
75641
75643
  });
75642
- useEffect(() => {
75643
- if (error2) {
75644
- toast2({
75645
- title: `Error Fetching ${t$1("engage:one_time")}`,
75646
- description: error2?.message || "Please try again.",
75647
- variant: "destructive"
75644
+ useDeepEqualEffect(() => control._subscribe({
75645
+ name,
75646
+ formState: _localProxyFormState.current,
75647
+ exact,
75648
+ callback: (formState2) => {
75649
+ !disabled && updateFormState({
75650
+ ...control._formState,
75651
+ ...formState2
75648
75652
  });
75649
75653
  }
75650
- }, [error2, toast2]);
75651
- const broadcasts = useMemo(() => {
75652
- return (automations || []).map((automation2) => ({
75653
- ...automation2,
75654
- updated_at: automation2.updatedAt
75655
- }));
75656
- }, [automations]);
75657
- const handleToggle = useCallback(
75658
- async (id2, newStatus) => {
75659
- try {
75660
- setUpdatingId(id2);
75661
- const shouldBeActive = newStatus === AutomationStatus.ACTIVE;
75662
- await toggleStatus(shouldBeActive);
75663
- } finally {
75664
- setUpdatingId(null);
75665
- }
75654
+ }), [name, disabled, exact]);
75655
+ React__default.useEffect(() => {
75656
+ _localProxyFormState.current.isValid && control._setValid(true);
75657
+ }, [control]);
75658
+ return React__default.useMemo(() => getProxyFormState(formState, control, _localProxyFormState.current, false), [formState, control]);
75659
+ }
75660
+ var isString = (value) => typeof value === "string";
75661
+ var generateWatchOutput = (names, _names, formValues, isGlobal, defaultValue) => {
75662
+ if (isString(names)) {
75663
+ isGlobal && _names.watch.add(names);
75664
+ return get(formValues, names, defaultValue);
75665
+ }
75666
+ if (Array.isArray(names)) {
75667
+ return names.map((fieldName) => (isGlobal && _names.watch.add(fieldName), get(formValues, fieldName)));
75668
+ }
75669
+ isGlobal && (_names.watchAll = true);
75670
+ return formValues;
75671
+ };
75672
+ function useWatch(props2) {
75673
+ const methods = useFormContext();
75674
+ const { control = methods.control, name, defaultValue, disabled, exact } = props2 || {};
75675
+ const [value, updateValue] = React__default.useState(control._getWatch(name, defaultValue));
75676
+ useDeepEqualEffect(() => control._subscribe({
75677
+ name,
75678
+ formState: {
75679
+ values: true
75666
75680
  },
75667
- [toggleStatus, setUpdatingId]
75668
- );
75669
- const handleQueryParametersChange = useCallback(
75670
- (params) => {
75671
- setCursorForQuery(params.cursor);
75672
- setPageSizeForQuery(params.pageSize);
75673
- },
75674
- []
75675
- );
75676
- const resetListPagination = () => {
75677
- setCursorForQuery(void 0);
75678
- setPageSizeForQuery(DEFAULT_PAGE_SIZE$1);
75679
- setSearchQuery("");
75680
- };
75681
- const onDialogClose = (result) => {
75682
- console.log("result", result);
75683
- handleDialogClose(
75684
- setCreateDialogOpen,
75685
- toast2,
75686
- result,
75687
- `Error creating ${t$1("engage:one_time")}`,
75688
- "Please try again"
75689
- );
75690
- resetListPagination();
75691
- if (result !== false) {
75692
- navigate(`/automations/view-modal/${result}?showBackButton=true`);
75693
- }
75694
- };
75695
- const setUrl = useCallback(
75696
- (id2) => `/automations/view-modal/${id2}?showBackButton=true`,
75697
- []
75698
- );
75699
- const columns = useMemo(
75700
- () => createColumns({
75701
- automationName: t$1("engage:one_time"),
75702
- setUrl,
75703
- onToggle: handleToggle
75704
- }),
75705
- [handleToggle, setUrl]
75706
- );
75707
- const headerActionsContent = /* @__PURE__ */ jsxs(Button$1, { className: "bg-primary", onClick: () => setCreateDialogOpen(true), children: [
75708
- /* @__PURE__ */ jsx(Plus, { className: "h-4 w-4 mr-1" }),
75709
- "New"
75710
- ] });
75711
- return /* @__PURE__ */ jsxs("div", { className: "w-full h-[75vh] flex flex-col", children: [
75712
- /* @__PURE__ */ jsx("div", { className: "flex-grow min-h-0 p-2", children: /* @__PURE__ */ jsx(
75713
- TanstackTable,
75714
- {
75715
- data: broadcasts,
75716
- columns,
75717
- paginationMode: "cursor",
75718
- initialPageSize: pageSizeForQuery,
75719
- headerActions: headerActionsContent,
75720
- isLoading: isLoading && !isPlaceholderData,
75721
- cursorPaginationQueryResult: {
75722
- nextCursor,
75723
- isLoading,
75724
- isFetching,
75725
- isPlaceholderData
75726
- },
75727
- onRowClick: (row) => {
75728
- navigate(`/automations/view-modal/${row.id}?showBackButton=true`);
75729
- },
75730
- onQueryParametersChange: handleQueryParametersChange,
75731
- searchValue: searchQuery,
75732
- onSearchChange: setSearchQuery
75733
- }
75734
- ) }),
75735
- /* @__PURE__ */ jsx(
75736
- CreateAutomationDialog,
75737
- {
75738
- open: createDialogOpen,
75739
- setOpen: setCreateDialogOpen,
75740
- onClose: onDialogClose,
75741
- automationType: AutomationTriggerType.ONE_TIME
75742
- }
75743
- )
75744
- ] });
75745
- }
75746
- const DEFAULT_PAGE_SIZE = 10;
75747
- function SegmentList() {
75748
- const { toast: toast2 } = useToast();
75749
- const [createDialogOpen, setCreateDialogOpen] = useState(false);
75750
- const [selectedSegment, setSelectedSegment] = useState(null);
75751
- const [pageSizeForQuery, setPageSizeForQuery] = useState(DEFAULT_PAGE_SIZE);
75752
- const [cursorForQuery, setCursorForQuery] = useState(
75753
- void 0
75754
- );
75755
- const [searchQuery, setSearchQuery] = useState("");
75756
- const { segments, isLoading, nextCursor, isFetching, isPlaceholderData } = useListSegments({
75757
- search: searchQuery || void 0,
75758
- cursor: cursorForQuery,
75759
- limit: pageSizeForQuery
75760
- });
75761
- const toggleSelectedSegment = useCallback(
75762
- (id2) => {
75763
- setSelectedSegment(id2);
75764
- setCreateDialogOpen(true);
75765
- },
75766
- [setSelectedSegment]
75767
- );
75768
- const columns = useMemo(
75769
- () => createSegmentColumns(toggleSelectedSegment),
75770
- [toggleSelectedSegment]
75771
- );
75772
- const segmentsMapped = useMemo(
75773
- () => segments ? segments.map((segment2) => ({
75774
- ...segment2,
75775
- updated_at: segment2.createdAt.toString(),
75776
- user_count: segment2.userCount,
75777
- user_count_updated_at: segment2.userCountUpdatedAt
75778
- })) : [],
75779
- [segments]
75780
- );
75781
- const headerActionsContent = useMemo(() => {
75782
- return /* @__PURE__ */ jsxs(
75783
- Button$1,
75784
- {
75785
- onClick: () => {
75786
- setSelectedSegment(null);
75787
- setCreateDialogOpen(true);
75788
- },
75789
- children: [
75790
- /* @__PURE__ */ jsx(Plus, { className: "h-4 w-4" }),
75791
- "New List"
75792
- ]
75793
- }
75794
- );
75795
- }, []);
75796
- const handleQueryParametersChange = useCallback(
75797
- (params) => {
75798
- setCursorForQuery(params.cursor);
75799
- setPageSizeForQuery(params.pageSize);
75800
- },
75801
- []
75802
- );
75803
- const resetListPagination = () => {
75804
- setCursorForQuery(void 0);
75805
- setPageSizeForQuery(DEFAULT_PAGE_SIZE);
75806
- setSearchQuery("");
75807
- };
75808
- const onDialogClose = (result) => {
75809
- handleDialogClose(
75810
- setCreateDialogOpen,
75811
- toast2,
75812
- result,
75813
- `Error creating ${t$1("engage:segment")}`,
75814
- "Please try again"
75815
- );
75816
- resetListPagination();
75817
- };
75818
- return /* @__PURE__ */ jsxs("div", { className: "w-full h-[75vh] flex flex-col", children: [
75819
- /* @__PURE__ */ jsx("div", { className: "flex-grow min-h-0 p-2", children: /* @__PURE__ */ jsx(
75820
- TanstackTable,
75821
- {
75822
- data: segmentsMapped,
75823
- columns,
75824
- paginationMode: "cursor",
75825
- initialPageSize: pageSizeForQuery,
75826
- headerActions: headerActionsContent,
75827
- isLoading: isLoading && !isPlaceholderData,
75828
- cursorPaginationQueryResult: {
75829
- nextCursor,
75830
- isLoading,
75831
- isFetching,
75832
- isPlaceholderData
75833
- },
75834
- onQueryParametersChange: handleQueryParametersChange,
75835
- onRowClick: (row) => {
75836
- setSelectedSegment(row.id);
75837
- setCreateDialogOpen(true);
75838
- },
75839
- searchValue: searchQuery,
75840
- onSearchChange: setSearchQuery
75841
- }
75842
- ) }),
75843
- /* @__PURE__ */ jsx(
75844
- SegmentBuilderDialog,
75845
- {
75846
- open: createDialogOpen,
75847
- setOpen: setCreateDialogOpen,
75848
- segmentId: selectedSegment ?? void 0,
75849
- onSegmentUpdated: onDialogClose
75850
- }
75851
- )
75852
- ] });
75853
- }
75854
- const EngageMain = () => {
75855
- const engageListTabs = [
75856
- {
75857
- id: "broadcasts",
75858
- label: t$1("engage:one_time", { count: 2 }),
75859
- content: /* @__PURE__ */ jsx(BroadcastList, {})
75860
- },
75861
- {
75862
- id: "automations",
75863
- label: t$1("engage:automation", { count: 2 }),
75864
- content: /* @__PURE__ */ jsx(AutomationList, {})
75865
- },
75866
- {
75867
- id: "segments",
75868
- label: t$1("engage:segment", { count: 2 }),
75869
- content: /* @__PURE__ */ jsx(SegmentList, {})
75870
- },
75871
- {
75872
- id: "statistics",
75873
- label: t$1("engage:insight", { count: 2 }),
75874
- content: /* @__PURE__ */ jsx(AutomationStatistics, {})
75875
- }
75876
- ];
75877
- const queryClient = useQueryClient();
75878
- const [engageSettingsOpen, setEngageSettingsOpen] = useState(false);
75879
- const [activeTab, setActiveTab] = useState(engageListTabs[0].id);
75880
- useEffect(() => {
75881
- queryClient.prefetchQuery({
75882
- queryKey: automationKeys.list()
75883
- });
75884
- queryClient.prefetchQuery({
75885
- queryKey: segmentKeys.lists()
75886
- });
75887
- }, [queryClient]);
75888
- return /* @__PURE__ */ jsxs("div", { className: "w-full h-full flex flex-col gap-4", children: [
75889
- /* @__PURE__ */ jsx(
75890
- BrandSettingsDialog,
75891
- {
75892
- open: engageSettingsOpen,
75893
- setOpen: setEngageSettingsOpen
75894
- }
75895
- ),
75896
- /* @__PURE__ */ jsx("div", { className: "flex justify-end", children: /* @__PURE__ */ jsx(Button$1, { variant: "outline", onClick: () => setEngageSettingsOpen(true), children: /* @__PURE__ */ jsx(Settings, { className: "w-4 h-4" }) }) }),
75897
- /* @__PURE__ */ jsx("div", { className: "flex-1 w-full h-full flex flex-col gap-4", children: /* @__PURE__ */ jsx(
75898
- AnimatedTabs,
75899
- {
75900
- activeTab,
75901
- tabs: engageListTabs,
75902
- onTabChange: setActiveTab
75903
- }
75904
- ) })
75905
- ] });
75906
- };
75907
- const Engage = () => {
75908
- return /* @__PURE__ */ jsx(Provider$1, { children: /* @__PURE__ */ jsx(EngageMain, {}) });
75909
- };
75910
- var isCheckBoxInput = (element) => element.type === "checkbox";
75911
- var isDateObject = (value) => value instanceof Date;
75912
- var isNullOrUndefined = (value) => value == null;
75913
- const isObjectType = (value) => typeof value === "object";
75914
- var isObject = (value) => !isNullOrUndefined(value) && !Array.isArray(value) && isObjectType(value) && !isDateObject(value);
75915
- var getEventValue = (event) => isObject(event) && event.target ? isCheckBoxInput(event.target) ? event.target.checked : event.target.value : event;
75916
- var getNodeParentName = (name) => name.substring(0, name.search(/\.\d+(\.|$)/)) || name;
75917
- var isNameInFieldArray = (names, name) => names.has(getNodeParentName(name));
75918
- var isPlainObject = (tempObject) => {
75919
- const prototypeCopy = tempObject.constructor && tempObject.constructor.prototype;
75920
- return isObject(prototypeCopy) && prototypeCopy.hasOwnProperty("isPrototypeOf");
75921
- };
75922
- var isWeb = typeof window !== "undefined" && typeof window.HTMLElement !== "undefined" && typeof document !== "undefined";
75923
- function cloneObject(data) {
75924
- let copy2;
75925
- const isArray3 = Array.isArray(data);
75926
- const isFileListInstance = typeof FileList !== "undefined" ? data instanceof FileList : false;
75927
- if (data instanceof Date) {
75928
- copy2 = new Date(data);
75929
- } else if (data instanceof Set) {
75930
- copy2 = new Set(data);
75931
- } else if (!(isWeb && (data instanceof Blob || isFileListInstance)) && (isArray3 || isObject(data))) {
75932
- copy2 = isArray3 ? [] : {};
75933
- if (!isArray3 && !isPlainObject(data)) {
75934
- copy2 = data;
75935
- } else {
75936
- for (const key in data) {
75937
- if (data.hasOwnProperty(key)) {
75938
- copy2[key] = cloneObject(data[key]);
75939
- }
75940
- }
75941
- }
75942
- } else {
75943
- return data;
75944
- }
75945
- return copy2;
75946
- }
75947
- var compact = (value) => Array.isArray(value) ? value.filter(Boolean) : [];
75948
- var isUndefined = (val) => val === void 0;
75949
- var get = (object, path2, defaultValue) => {
75950
- if (!path2 || !isObject(object)) {
75951
- return defaultValue;
75952
- }
75953
- const result = compact(path2.split(/[,[\].]+?/)).reduce((result2, key) => isNullOrUndefined(result2) ? result2 : result2[key], object);
75954
- return isUndefined(result) || result === object ? isUndefined(object[path2]) ? defaultValue : object[path2] : result;
75955
- };
75956
- var isBoolean = (value) => typeof value === "boolean";
75957
- var isKey = (value) => /^\w*$/.test(value);
75958
- var stringToPath = (input) => compact(input.replace(/["|']|\]/g, "").split(/\.|\[/));
75959
- var set = (object, path2, value) => {
75960
- let index2 = -1;
75961
- const tempPath = isKey(path2) ? [path2] : stringToPath(path2);
75962
- const length = tempPath.length;
75963
- const lastIndex = length - 1;
75964
- while (++index2 < length) {
75965
- const key = tempPath[index2];
75966
- let newValue = value;
75967
- if (index2 !== lastIndex) {
75968
- const objValue = object[key];
75969
- newValue = isObject(objValue) || Array.isArray(objValue) ? objValue : !isNaN(+tempPath[index2 + 1]) ? [] : {};
75970
- }
75971
- if (key === "__proto__" || key === "constructor" || key === "prototype") {
75972
- return;
75973
- }
75974
- object[key] = newValue;
75975
- object = object[key];
75976
- }
75977
- };
75978
- const EVENTS = {
75979
- BLUR: "blur",
75980
- FOCUS_OUT: "focusout",
75981
- CHANGE: "change"
75982
- };
75983
- const VALIDATION_MODE = {
75984
- onBlur: "onBlur",
75985
- onChange: "onChange",
75986
- onSubmit: "onSubmit",
75987
- onTouched: "onTouched",
75988
- all: "all"
75989
- };
75990
- const INPUT_VALIDATION_RULES = {
75991
- max: "max",
75992
- min: "min",
75993
- maxLength: "maxLength",
75994
- minLength: "minLength",
75995
- pattern: "pattern",
75996
- required: "required",
75997
- validate: "validate"
75998
- };
75999
- const HookFormContext = React__default.createContext(null);
76000
- const useFormContext = () => React__default.useContext(HookFormContext);
76001
- const FormProvider = (props2) => {
76002
- const { children: children2, ...data } = props2;
76003
- return React__default.createElement(HookFormContext.Provider, { value: data }, children2);
76004
- };
76005
- var getProxyFormState = (formState, control, localProxyFormState, isRoot = true) => {
76006
- const result = {
76007
- defaultValues: control._defaultValues
76008
- };
76009
- for (const key in formState) {
76010
- Object.defineProperty(result, key, {
76011
- get: () => {
76012
- const _key = key;
76013
- if (control._proxyFormState[_key] !== VALIDATION_MODE.all) {
76014
- control._proxyFormState[_key] = !isRoot || VALIDATION_MODE.all;
76015
- }
76016
- localProxyFormState && (localProxyFormState[_key] = true);
76017
- return formState[_key];
76018
- }
76019
- });
76020
- }
76021
- return result;
76022
- };
76023
- var isPrimitive = (value) => isNullOrUndefined(value) || !isObjectType(value);
76024
- function deepEqual(object1, object2) {
76025
- if (isPrimitive(object1) || isPrimitive(object2)) {
76026
- return object1 === object2;
76027
- }
76028
- if (isDateObject(object1) && isDateObject(object2)) {
76029
- return object1.getTime() === object2.getTime();
76030
- }
76031
- const keys1 = Object.keys(object1);
76032
- const keys2 = Object.keys(object2);
76033
- if (keys1.length !== keys2.length) {
76034
- return false;
76035
- }
76036
- for (const key of keys1) {
76037
- const val1 = object1[key];
76038
- if (!keys2.includes(key)) {
76039
- return false;
76040
- }
76041
- if (key !== "ref") {
76042
- const val2 = object2[key];
76043
- if (isDateObject(val1) && isDateObject(val2) || isObject(val1) && isObject(val2) || Array.isArray(val1) && Array.isArray(val2) ? !deepEqual(val1, val2) : val1 !== val2) {
76044
- return false;
76045
- }
76046
- }
76047
- }
76048
- return true;
76049
- }
76050
- const useDeepEqualEffect = (effect, deps) => {
76051
- const ref = useRef(deps);
76052
- if (!deepEqual(deps, ref.current)) {
76053
- ref.current = deps;
76054
- }
76055
- useEffect(effect, ref.current);
76056
- };
76057
- function useFormState(props2) {
76058
- const methods = useFormContext();
76059
- const { control = methods.control, disabled, name, exact } = props2 || {};
76060
- const [formState, updateFormState] = React__default.useState(control._formState);
76061
- const _localProxyFormState = React__default.useRef({
76062
- isDirty: false,
76063
- isLoading: false,
76064
- dirtyFields: false,
76065
- touchedFields: false,
76066
- validatingFields: false,
76067
- isValidating: false,
76068
- isValid: false,
76069
- errors: false
76070
- });
76071
- useDeepEqualEffect(() => control._subscribe({
76072
- name,
76073
- formState: _localProxyFormState.current,
76074
- exact,
76075
- callback: (formState2) => {
76076
- !disabled && updateFormState({
76077
- ...control._formState,
76078
- ...formState2
76079
- });
76080
- }
76081
- }), [name, disabled, exact]);
76082
- React__default.useEffect(() => {
76083
- _localProxyFormState.current.isValid && control._setValid(true);
76084
- }, [control]);
76085
- return React__default.useMemo(() => getProxyFormState(formState, control, _localProxyFormState.current, false), [formState, control]);
76086
- }
76087
- var isString = (value) => typeof value === "string";
76088
- var generateWatchOutput = (names, _names, formValues, isGlobal, defaultValue) => {
76089
- if (isString(names)) {
76090
- isGlobal && _names.watch.add(names);
76091
- return get(formValues, names, defaultValue);
76092
- }
76093
- if (Array.isArray(names)) {
76094
- return names.map((fieldName) => (isGlobal && _names.watch.add(fieldName), get(formValues, fieldName)));
76095
- }
76096
- isGlobal && (_names.watchAll = true);
76097
- return formValues;
76098
- };
76099
- function useWatch(props2) {
76100
- const methods = useFormContext();
76101
- const { control = methods.control, name, defaultValue, disabled, exact } = props2 || {};
76102
- const [value, updateValue] = React__default.useState(control._getWatch(name, defaultValue));
76103
- useDeepEqualEffect(() => control._subscribe({
76104
- name,
76105
- formState: {
76106
- values: true
76107
- },
76108
- exact,
76109
- callback: (formState) => !disabled && updateValue(generateWatchOutput(name, control._names, formState.values || control._formValues, false, defaultValue))
76110
- }), [name, defaultValue, disabled, exact]);
76111
- React__default.useEffect(() => control._removeUnmounted());
76112
- return value;
76113
- }
76114
- function useController(props2) {
76115
- const methods = useFormContext();
76116
- const { name, disabled, control = methods.control, shouldUnregister } = props2;
76117
- const isArrayField = isNameInFieldArray(control._names.array, name);
76118
- const value = useWatch({
76119
- control,
76120
- name,
76121
- defaultValue: get(control._formValues, name, get(control._defaultValues, name, props2.defaultValue)),
76122
- exact: true
76123
- });
76124
- const formState = useFormState({
76125
- control,
76126
- name,
76127
- exact: true
76128
- });
76129
- const _props = React__default.useRef(props2);
76130
- const _registerProps = React__default.useRef(control.register(name, {
76131
- ...props2.rules,
76132
- value,
76133
- ...isBoolean(props2.disabled) ? { disabled: props2.disabled } : {}
76134
- }));
76135
- const fieldState = React__default.useMemo(() => Object.defineProperties({}, {
76136
- invalid: {
76137
- enumerable: true,
76138
- get: () => !!get(formState.errors, name)
75681
+ exact,
75682
+ callback: (formState) => !disabled && updateValue(generateWatchOutput(name, control._names, formState.values || control._formValues, false, defaultValue))
75683
+ }), [name, defaultValue, disabled, exact]);
75684
+ React__default.useEffect(() => control._removeUnmounted());
75685
+ return value;
75686
+ }
75687
+ function useController(props2) {
75688
+ const methods = useFormContext();
75689
+ const { name, disabled, control = methods.control, shouldUnregister } = props2;
75690
+ const isArrayField = isNameInFieldArray(control._names.array, name);
75691
+ const value = useWatch({
75692
+ control,
75693
+ name,
75694
+ defaultValue: get(control._formValues, name, get(control._defaultValues, name, props2.defaultValue)),
75695
+ exact: true
75696
+ });
75697
+ const formState = useFormState({
75698
+ control,
75699
+ name,
75700
+ exact: true
75701
+ });
75702
+ const _props = React__default.useRef(props2);
75703
+ const _registerProps = React__default.useRef(control.register(name, {
75704
+ ...props2.rules,
75705
+ value,
75706
+ ...isBoolean(props2.disabled) ? { disabled: props2.disabled } : {}
75707
+ }));
75708
+ const fieldState = React__default.useMemo(() => Object.defineProperties({}, {
75709
+ invalid: {
75710
+ enumerable: true,
75711
+ get: () => !!get(formState.errors, name)
76139
75712
  },
76140
75713
  isDirty: {
76141
75714
  enumerable: true,
@@ -77648,6 +77221,305 @@ var n = function(r2, e4) {
77648
77221
  }
77649
77222
  };
77650
77223
  };
77224
+ const base = "reach-styles-module__base___r-a1U";
77225
+ const primary = "reach-styles-module__primary___mGKjo";
77226
+ const success = "reach-styles-module__success___xn1Y1";
77227
+ const warning = "reach-styles-module__warning___jdyU9";
77228
+ const error = "reach-styles-module__error___Z-3IS";
77229
+ const sizeDefault = "reach-styles-module__sizeDefault___oS6W2";
77230
+ const sizeSm = "reach-styles-module__sizeSm___GI826";
77231
+ const sizeLg = "reach-styles-module__sizeLg___J--WF";
77232
+ const positionDefault = "reach-styles-module__positionDefault___visr6";
77233
+ const positionTop = "reach-styles-module__positionTop___y6h-n";
77234
+ const positionBottom = "reach-styles-module__positionBottom___vYLkd";
77235
+ const positionInline = "reach-styles-module__positionInline___NjZsw";
77236
+ const styles = {
77237
+ base,
77238
+ "default": "reach-styles-module__default___vu2Rt",
77239
+ primary,
77240
+ success,
77241
+ warning,
77242
+ error,
77243
+ sizeDefault,
77244
+ sizeSm,
77245
+ sizeLg,
77246
+ positionDefault,
77247
+ positionTop,
77248
+ positionBottom,
77249
+ positionInline
77250
+ };
77251
+ const bannerVariants = cva([styles.base], {
77252
+ variants: {
77253
+ variant: {
77254
+ default: styles.default,
77255
+ primary: styles.primary,
77256
+ success: styles.success,
77257
+ warning: styles.warning,
77258
+ error: styles.error
77259
+ },
77260
+ size: {
77261
+ default: styles.sizeDefault,
77262
+ sm: styles.sizeSm,
77263
+ lg: styles.sizeLg
77264
+ },
77265
+ position: {
77266
+ default: styles.positionDefault,
77267
+ top: styles.positionTop,
77268
+ bottom: styles.positionBottom,
77269
+ inline: styles.positionInline
77270
+ }
77271
+ },
77272
+ defaultVariants: {
77273
+ variant: "default",
77274
+ size: "default",
77275
+ position: "default"
77276
+ }
77277
+ });
77278
+ const Form = FormProvider;
77279
+ const FormFieldContext = React.createContext(
77280
+ {}
77281
+ );
77282
+ const FormField = ({
77283
+ ...props2
77284
+ }) => {
77285
+ return /* @__PURE__ */ jsx(FormFieldContext.Provider, { value: { name: props2.name }, children: /* @__PURE__ */ jsx(Controller, { ...props2 }) });
77286
+ };
77287
+ const useFormField = () => {
77288
+ const fieldContext = React.useContext(FormFieldContext);
77289
+ const itemContext = React.useContext(FormItemContext);
77290
+ const { getFieldState, formState } = useFormContext();
77291
+ const fieldState = getFieldState(fieldContext.name, formState);
77292
+ if (!fieldContext) {
77293
+ throw new Error("useFormField should be used within <FormField>");
77294
+ }
77295
+ const { id: id2 } = itemContext;
77296
+ return {
77297
+ id: id2,
77298
+ name: fieldContext.name,
77299
+ formItemId: `${id2}-form-item`,
77300
+ formDescriptionId: `${id2}-form-item-description`,
77301
+ formMessageId: `${id2}-form-item-message`,
77302
+ ...fieldState
77303
+ };
77304
+ };
77305
+ const FormItemContext = React.createContext(
77306
+ {}
77307
+ );
77308
+ const FormItem = React.forwardRef(({ className: className2, ...props2 }, ref) => {
77309
+ const id2 = React.useId();
77310
+ return /* @__PURE__ */ jsx(FormItemContext.Provider, { value: { id: id2 }, children: /* @__PURE__ */ jsx("div", { ref, className: cn$1("space-y-2", className2), ...props2 }) });
77311
+ });
77312
+ FormItem.displayName = "FormItem";
77313
+ const FormLabel = React.forwardRef(({ className: className2, ...props2 }, ref) => {
77314
+ const { error: error2, formItemId } = useFormField();
77315
+ return /* @__PURE__ */ jsx(
77316
+ Label$1,
77317
+ {
77318
+ ref,
77319
+ className: cn$1(error2 && "text-destructive", className2),
77320
+ htmlFor: formItemId,
77321
+ ...props2
77322
+ }
77323
+ );
77324
+ });
77325
+ FormLabel.displayName = "FormLabel";
77326
+ const FormControl = React.forwardRef(({ ...props2 }, ref) => {
77327
+ const { error: error2, formItemId, formDescriptionId, formMessageId } = useFormField();
77328
+ return /* @__PURE__ */ jsx(
77329
+ Slot$4,
77330
+ {
77331
+ ref,
77332
+ id: formItemId,
77333
+ "aria-describedby": !error2 ? `${formDescriptionId}` : `${formDescriptionId} ${formMessageId}`,
77334
+ "aria-invalid": !!error2,
77335
+ ...props2
77336
+ }
77337
+ );
77338
+ });
77339
+ FormControl.displayName = "FormControl";
77340
+ const FormDescription = React.forwardRef(({ className: className2, ...props2 }, ref) => {
77341
+ const { formDescriptionId } = useFormField();
77342
+ return /* @__PURE__ */ jsx(
77343
+ "p",
77344
+ {
77345
+ ref,
77346
+ id: formDescriptionId,
77347
+ className: cn$1("text-[0.8rem] text-muted-foreground", className2),
77348
+ ...props2
77349
+ }
77350
+ );
77351
+ });
77352
+ FormDescription.displayName = "FormDescription";
77353
+ const FormMessage = React.forwardRef(({ className: className2, children: children2, ...props2 }, ref) => {
77354
+ const { error: error2, formMessageId } = useFormField();
77355
+ const body = error2 ? String(error2?.message) : children2;
77356
+ if (!body) {
77357
+ return null;
77358
+ }
77359
+ return /* @__PURE__ */ jsx(
77360
+ "p",
77361
+ {
77362
+ ref,
77363
+ id: formMessageId,
77364
+ className: cn$1("text-[0.8rem] font-medium text-destructive", className2),
77365
+ ...props2,
77366
+ children: body
77367
+ }
77368
+ );
77369
+ });
77370
+ FormMessage.displayName = "FormMessage";
77371
+ const CompanyFormFields = ({
77372
+ control,
77373
+ disabled,
77374
+ legalNameRef
77375
+ }) => /* @__PURE__ */ jsxs(Fragment, { children: [
77376
+ /* @__PURE__ */ jsx(
77377
+ FormField,
77378
+ {
77379
+ control,
77380
+ name: "company.legalName",
77381
+ render: ({ field }) => /* @__PURE__ */ jsxs(FormItem, { className: "space-y-1", children: [
77382
+ /* @__PURE__ */ jsx(FormLabel, { className: "text-sm", children: "Legal Company Name" }),
77383
+ /* @__PURE__ */ jsx(FormControl, { children: /* @__PURE__ */ jsx(
77384
+ Input,
77385
+ {
77386
+ ...field,
77387
+ ref: legalNameRef,
77388
+ disabled,
77389
+ className: "h-8"
77390
+ }
77391
+ ) }),
77392
+ /* @__PURE__ */ jsx(FormMessage, { className: "text-xs" })
77393
+ ] })
77394
+ }
77395
+ ),
77396
+ /* @__PURE__ */ jsx(
77397
+ FormField,
77398
+ {
77399
+ control,
77400
+ name: "company.type",
77401
+ render: ({ field }) => /* @__PURE__ */ jsxs(FormItem, { className: "space-y-1", children: [
77402
+ /* @__PURE__ */ jsx(FormLabel, { className: "text-sm", children: "Company Type" }),
77403
+ /* @__PURE__ */ jsxs(
77404
+ Select,
77405
+ {
77406
+ onValueChange: field.onChange,
77407
+ defaultValue: field.value,
77408
+ disabled,
77409
+ children: [
77410
+ /* @__PURE__ */ jsx(FormControl, { children: /* @__PURE__ */ jsx(SelectTrigger, { className: "h-8", children: /* @__PURE__ */ jsx(SelectValue, { placeholder: "Select company type" }) }) }),
77411
+ /* @__PURE__ */ jsxs(SelectContent, { children: [
77412
+ /* @__PURE__ */ jsx(SelectItem, { value: "corporation", children: "Corporation" }),
77413
+ /* @__PURE__ */ jsx(SelectItem, { value: "llc", children: "LLC" })
77414
+ ] })
77415
+ ]
77416
+ }
77417
+ ),
77418
+ /* @__PURE__ */ jsx(FormMessage, { className: "text-xs" })
77419
+ ] })
77420
+ }
77421
+ ),
77422
+ /* @__PURE__ */ jsx(
77423
+ FormField,
77424
+ {
77425
+ control,
77426
+ name: "company.ein",
77427
+ render: ({ field }) => /* @__PURE__ */ jsxs(FormItem, { className: "space-y-1", children: [
77428
+ /* @__PURE__ */ jsx(FormLabel, { className: "text-sm", children: "EIN (Employer Identification Number)" }),
77429
+ /* @__PURE__ */ jsx(FormControl, { children: /* @__PURE__ */ jsx(Input, { ...field, type: "text", disabled, className: "h-8" }) }),
77430
+ /* @__PURE__ */ jsx(FormMessage, { className: "text-xs" })
77431
+ ] })
77432
+ }
77433
+ )
77434
+ ] });
77435
+ const RepresentativeFormFields = ({
77436
+ control,
77437
+ disabled
77438
+ }) => /* @__PURE__ */ jsxs(Fragment, { children: [
77439
+ /* @__PURE__ */ jsx(
77440
+ FormField,
77441
+ {
77442
+ control,
77443
+ name: "representative.title",
77444
+ render: ({ field }) => /* @__PURE__ */ jsxs(FormItem, { className: "space-y-1", children: [
77445
+ /* @__PURE__ */ jsx(FormLabel, { className: "text-sm", children: "Title" }),
77446
+ /* @__PURE__ */ jsx(FormControl, { children: /* @__PURE__ */ jsx(Input, { ...field, disabled, className: "h-8" }) }),
77447
+ /* @__PURE__ */ jsx(FormMessage, { className: "text-xs" })
77448
+ ] })
77449
+ }
77450
+ ),
77451
+ /* @__PURE__ */ jsx(
77452
+ FormField,
77453
+ {
77454
+ control,
77455
+ name: "representative.firstName",
77456
+ render: ({ field }) => /* @__PURE__ */ jsxs(FormItem, { className: "space-y-1", children: [
77457
+ /* @__PURE__ */ jsx(FormLabel, { className: "text-sm", children: "First Name" }),
77458
+ /* @__PURE__ */ jsx(FormControl, { children: /* @__PURE__ */ jsx(Input, { ...field, disabled, className: "h-8" }) }),
77459
+ /* @__PURE__ */ jsx(FormMessage, { className: "text-xs" })
77460
+ ] })
77461
+ }
77462
+ ),
77463
+ /* @__PURE__ */ jsx(
77464
+ FormField,
77465
+ {
77466
+ control,
77467
+ name: "representative.email",
77468
+ render: ({ field }) => /* @__PURE__ */ jsxs(FormItem, { className: "space-y-1", children: [
77469
+ /* @__PURE__ */ jsx(FormLabel, { className: "text-sm", children: "Email" }),
77470
+ /* @__PURE__ */ jsx(FormControl, { children: /* @__PURE__ */ jsx(
77471
+ Input,
77472
+ {
77473
+ ...field,
77474
+ type: "email",
77475
+ disabled,
77476
+ className: "h-8"
77477
+ }
77478
+ ) }),
77479
+ /* @__PURE__ */ jsx(FormMessage, { className: "text-xs" })
77480
+ ] })
77481
+ }
77482
+ ),
77483
+ /* @__PURE__ */ jsx(
77484
+ FormField,
77485
+ {
77486
+ control,
77487
+ name: "representative.phone",
77488
+ render: ({ field }) => /* @__PURE__ */ jsxs(FormItem, { className: "space-y-1", children: [
77489
+ /* @__PURE__ */ jsx(FormLabel, { className: "text-sm", children: "Contact Phone Number" }),
77490
+ /* @__PURE__ */ jsx(FormControl, { children: /* @__PURE__ */ jsx(Input, { ...field, type: "tel", disabled, className: "h-8" }) }),
77491
+ /* @__PURE__ */ jsx(FormMessage, { className: "text-xs" })
77492
+ ] })
77493
+ }
77494
+ ),
77495
+ /* @__PURE__ */ jsx(
77496
+ FormField,
77497
+ {
77498
+ control,
77499
+ name: "representative.position",
77500
+ render: ({ field }) => /* @__PURE__ */ jsxs(FormItem, { className: "space-y-1", children: [
77501
+ /* @__PURE__ */ jsx(FormLabel, { className: "text-sm", children: "Position" }),
77502
+ /* @__PURE__ */ jsxs(
77503
+ Select,
77504
+ {
77505
+ onValueChange: field.onChange,
77506
+ defaultValue: field.value,
77507
+ disabled,
77508
+ children: [
77509
+ /* @__PURE__ */ jsx(FormControl, { children: /* @__PURE__ */ jsx(SelectTrigger, { className: "h-8", children: /* @__PURE__ */ jsx(SelectValue, { placeholder: "Select position" }) }) }),
77510
+ /* @__PURE__ */ jsxs(SelectContent, { children: [
77511
+ /* @__PURE__ */ jsx(SelectItem, { value: "owner", children: "Owner" }),
77512
+ /* @__PURE__ */ jsx(SelectItem, { value: "manager", children: "Manager" }),
77513
+ /* @__PURE__ */ jsx(SelectItem, { value: "director", children: "Director" })
77514
+ ] })
77515
+ ]
77516
+ }
77517
+ ),
77518
+ /* @__PURE__ */ jsx(FormMessage, { className: "text-xs" })
77519
+ ] })
77520
+ }
77521
+ )
77522
+ ] });
77651
77523
  var util;
77652
77524
  (function(util2) {
77653
77525
  util2.assertEqual = (val) => val;
@@ -77797,6 +77669,10 @@ const ZodIssueCode = util.arrayToEnum([
77797
77669
  "not_multiple_of",
77798
77670
  "not_finite"
77799
77671
  ]);
77672
+ const quotelessJson = (obj) => {
77673
+ const json = JSON.stringify(obj, null, 2);
77674
+ return json.replace(/"([^"]+)":/g, "$1:");
77675
+ };
77800
77676
  class ZodError extends Error {
77801
77677
  get errors() {
77802
77678
  return this.issues;
@@ -77989,6 +77865,9 @@ const errorMap = (issue, _ctx) => {
77989
77865
  return { message: message2 };
77990
77866
  };
77991
77867
  let overrideErrorMap = errorMap;
77868
+ function setErrorMap(map) {
77869
+ overrideErrorMap = map;
77870
+ }
77992
77871
  function getErrorMap() {
77993
77872
  return overrideErrorMap;
77994
77873
  }
@@ -78017,6 +77896,7 @@ const makeIssue = (params) => {
78017
77896
  message: errorMessage
78018
77897
  };
78019
77898
  };
77899
+ const EMPTY_PATH = [];
78020
77900
  function addIssueToContext(ctx, issueData) {
78021
77901
  const overrideMap = getErrorMap();
78022
77902
  const issue = makeIssue({
@@ -81368,6 +81248,7 @@ ZodNaN.create = (params) => {
81368
81248
  ...processCreateParams(params)
81369
81249
  });
81370
81250
  };
81251
+ const BRAND = Symbol("zod_brand");
81371
81252
  class ZodBranded extends ZodType {
81372
81253
  _parse(input) {
81373
81254
  const { ctx } = this._processInputParams(input);
@@ -81459,9 +81340,38 @@ ZodReadonly.create = (type, params) => {
81459
81340
  ...processCreateParams(params)
81460
81341
  });
81461
81342
  };
81462
- ({
81343
+ function cleanParams(params, data) {
81344
+ const p2 = typeof params === "function" ? params(data) : typeof params === "string" ? { message: params } : params;
81345
+ const p22 = typeof p2 === "string" ? { message: p2 } : p2;
81346
+ return p22;
81347
+ }
81348
+ function custom(check, _params = {}, fatal) {
81349
+ if (check)
81350
+ return ZodAny.create().superRefine((data, ctx) => {
81351
+ var _a2, _b;
81352
+ const r2 = check(data);
81353
+ if (r2 instanceof Promise) {
81354
+ return r2.then((r3) => {
81355
+ var _a3, _b2;
81356
+ if (!r3) {
81357
+ const params = cleanParams(_params, data);
81358
+ const _fatal = (_b2 = (_a3 = params.fatal) !== null && _a3 !== void 0 ? _a3 : fatal) !== null && _b2 !== void 0 ? _b2 : true;
81359
+ ctx.addIssue({ code: "custom", ...params, fatal: _fatal });
81360
+ }
81361
+ });
81362
+ }
81363
+ if (!r2) {
81364
+ const params = cleanParams(_params, data);
81365
+ const _fatal = (_b = (_a2 = params.fatal) !== null && _a2 !== void 0 ? _a2 : fatal) !== null && _b !== void 0 ? _b : true;
81366
+ ctx.addIssue({ code: "custom", ...params, fatal: _fatal });
81367
+ }
81368
+ return;
81369
+ });
81370
+ return ZodAny.create();
81371
+ }
81372
+ const late = {
81463
81373
  object: ZodObject.lazycreate
81464
- });
81374
+ };
81465
81375
  var ZodFirstPartyTypeKind;
81466
81376
  (function(ZodFirstPartyTypeKind2) {
81467
81377
  ZodFirstPartyTypeKind2["ZodString"] = "ZodString";
@@ -81501,133 +81411,824 @@ var ZodFirstPartyTypeKind;
81501
81411
  ZodFirstPartyTypeKind2["ZodPipeline"] = "ZodPipeline";
81502
81412
  ZodFirstPartyTypeKind2["ZodReadonly"] = "ZodReadonly";
81503
81413
  })(ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {}));
81414
+ const instanceOfType = (cls, params = {
81415
+ message: `Input not instance of ${cls.name}`
81416
+ }) => custom((data) => data instanceof cls, params);
81504
81417
  const stringType = ZodString.create;
81505
- ZodNumber.create;
81506
- ZodNaN.create;
81507
- ZodBigInt.create;
81508
- ZodBoolean.create;
81509
- ZodDate.create;
81510
- ZodSymbol.create;
81511
- ZodUndefined.create;
81512
- ZodNull.create;
81513
- ZodAny.create;
81514
- ZodUnknown.create;
81515
- ZodNever.create;
81516
- ZodVoid.create;
81517
- ZodArray.create;
81418
+ const numberType = ZodNumber.create;
81419
+ const nanType = ZodNaN.create;
81420
+ const bigIntType = ZodBigInt.create;
81421
+ const booleanType = ZodBoolean.create;
81422
+ const dateType = ZodDate.create;
81423
+ const symbolType = ZodSymbol.create;
81424
+ const undefinedType = ZodUndefined.create;
81425
+ const nullType = ZodNull.create;
81426
+ const anyType = ZodAny.create;
81427
+ const unknownType = ZodUnknown.create;
81428
+ const neverType = ZodNever.create;
81429
+ const voidType = ZodVoid.create;
81430
+ const arrayType = ZodArray.create;
81518
81431
  const objectType = ZodObject.create;
81519
- ZodObject.strictCreate;
81520
- ZodUnion.create;
81521
- ZodDiscriminatedUnion.create;
81522
- ZodIntersection.create;
81523
- ZodTuple.create;
81524
- ZodRecord.create;
81525
- ZodMap.create;
81526
- ZodSet.create;
81527
- ZodFunction.create;
81528
- ZodLazy.create;
81529
- ZodLiteral.create;
81530
- ZodEnum.create;
81531
- ZodNativeEnum.create;
81532
- ZodPromise.create;
81533
- ZodEffects.create;
81534
- ZodOptional.create;
81535
- ZodNullable.create;
81536
- ZodEffects.createWithPreprocess;
81537
- ZodPipeline.create;
81538
- const Form = FormProvider;
81539
- const FormFieldContext = React.createContext(
81540
- {}
81541
- );
81542
- const FormField = ({
81543
- ...props2
81544
- }) => {
81545
- return /* @__PURE__ */ jsx(FormFieldContext.Provider, { value: { name: props2.name }, children: /* @__PURE__ */ jsx(Controller, { ...props2 }) });
81432
+ const strictObjectType = ZodObject.strictCreate;
81433
+ const unionType = ZodUnion.create;
81434
+ const discriminatedUnionType = ZodDiscriminatedUnion.create;
81435
+ const intersectionType = ZodIntersection.create;
81436
+ const tupleType = ZodTuple.create;
81437
+ const recordType = ZodRecord.create;
81438
+ const mapType = ZodMap.create;
81439
+ const setType = ZodSet.create;
81440
+ const functionType = ZodFunction.create;
81441
+ const lazyType = ZodLazy.create;
81442
+ const literalType = ZodLiteral.create;
81443
+ const enumType = ZodEnum.create;
81444
+ const nativeEnumType = ZodNativeEnum.create;
81445
+ const promiseType = ZodPromise.create;
81446
+ const effectsType = ZodEffects.create;
81447
+ const optionalType = ZodOptional.create;
81448
+ const nullableType = ZodNullable.create;
81449
+ const preprocessType = ZodEffects.createWithPreprocess;
81450
+ const pipelineType = ZodPipeline.create;
81451
+ const ostring = () => stringType().optional();
81452
+ const onumber = () => numberType().optional();
81453
+ const oboolean = () => booleanType().optional();
81454
+ const coerce = {
81455
+ string: (arg) => ZodString.create({ ...arg, coerce: true }),
81456
+ number: (arg) => ZodNumber.create({ ...arg, coerce: true }),
81457
+ boolean: (arg) => ZodBoolean.create({
81458
+ ...arg,
81459
+ coerce: true
81460
+ }),
81461
+ bigint: (arg) => ZodBigInt.create({ ...arg, coerce: true }),
81462
+ date: (arg) => ZodDate.create({ ...arg, coerce: true })
81546
81463
  };
81547
- const useFormField = () => {
81548
- const fieldContext = React.useContext(FormFieldContext);
81549
- const itemContext = React.useContext(FormItemContext);
81550
- const { getFieldState, formState } = useFormContext();
81551
- const fieldState = getFieldState(fieldContext.name, formState);
81552
- if (!fieldContext) {
81553
- throw new Error("useFormField should be used within <FormField>");
81554
- }
81555
- const { id: id2 } = itemContext;
81556
- return {
81557
- id: id2,
81558
- name: fieldContext.name,
81559
- formItemId: `${id2}-form-item`,
81560
- formDescriptionId: `${id2}-form-item-description`,
81561
- formMessageId: `${id2}-form-item-message`,
81562
- ...fieldState
81464
+ const NEVER = INVALID;
81465
+ var z2 = /* @__PURE__ */ Object.freeze({
81466
+ __proto__: null,
81467
+ defaultErrorMap: errorMap,
81468
+ setErrorMap,
81469
+ getErrorMap,
81470
+ makeIssue,
81471
+ EMPTY_PATH,
81472
+ addIssueToContext,
81473
+ ParseStatus,
81474
+ INVALID,
81475
+ DIRTY,
81476
+ OK,
81477
+ isAborted,
81478
+ isDirty,
81479
+ isValid,
81480
+ isAsync,
81481
+ get util() {
81482
+ return util;
81483
+ },
81484
+ get objectUtil() {
81485
+ return objectUtil;
81486
+ },
81487
+ ZodParsedType,
81488
+ getParsedType,
81489
+ ZodType,
81490
+ datetimeRegex,
81491
+ ZodString,
81492
+ ZodNumber,
81493
+ ZodBigInt,
81494
+ ZodBoolean,
81495
+ ZodDate,
81496
+ ZodSymbol,
81497
+ ZodUndefined,
81498
+ ZodNull,
81499
+ ZodAny,
81500
+ ZodUnknown,
81501
+ ZodNever,
81502
+ ZodVoid,
81503
+ ZodArray,
81504
+ ZodObject,
81505
+ ZodUnion,
81506
+ ZodDiscriminatedUnion,
81507
+ ZodIntersection,
81508
+ ZodTuple,
81509
+ ZodRecord,
81510
+ ZodMap,
81511
+ ZodSet,
81512
+ ZodFunction,
81513
+ ZodLazy,
81514
+ ZodLiteral,
81515
+ ZodEnum,
81516
+ ZodNativeEnum,
81517
+ ZodPromise,
81518
+ ZodEffects,
81519
+ ZodTransformer: ZodEffects,
81520
+ ZodOptional,
81521
+ ZodNullable,
81522
+ ZodDefault,
81523
+ ZodCatch,
81524
+ ZodNaN,
81525
+ BRAND,
81526
+ ZodBranded,
81527
+ ZodPipeline,
81528
+ ZodReadonly,
81529
+ custom,
81530
+ Schema: ZodType,
81531
+ ZodSchema: ZodType,
81532
+ late,
81533
+ get ZodFirstPartyTypeKind() {
81534
+ return ZodFirstPartyTypeKind;
81535
+ },
81536
+ coerce,
81537
+ any: anyType,
81538
+ array: arrayType,
81539
+ bigint: bigIntType,
81540
+ boolean: booleanType,
81541
+ date: dateType,
81542
+ discriminatedUnion: discriminatedUnionType,
81543
+ effect: effectsType,
81544
+ "enum": enumType,
81545
+ "function": functionType,
81546
+ "instanceof": instanceOfType,
81547
+ intersection: intersectionType,
81548
+ lazy: lazyType,
81549
+ literal: literalType,
81550
+ map: mapType,
81551
+ nan: nanType,
81552
+ nativeEnum: nativeEnumType,
81553
+ never: neverType,
81554
+ "null": nullType,
81555
+ nullable: nullableType,
81556
+ number: numberType,
81557
+ object: objectType,
81558
+ oboolean,
81559
+ onumber,
81560
+ optional: optionalType,
81561
+ ostring,
81562
+ pipeline: pipelineType,
81563
+ preprocess: preprocessType,
81564
+ promise: promiseType,
81565
+ record: recordType,
81566
+ set: setType,
81567
+ strictObject: strictObjectType,
81568
+ string: stringType,
81569
+ symbol: symbolType,
81570
+ transformer: effectsType,
81571
+ tuple: tupleType,
81572
+ "undefined": undefinedType,
81573
+ union: unionType,
81574
+ unknown: unknownType,
81575
+ "void": voidType,
81576
+ NEVER,
81577
+ ZodIssueCode,
81578
+ quotelessJson,
81579
+ ZodError
81580
+ });
81581
+ const phoneSettingsSchema = z2.object({
81582
+ company: z2.object({
81583
+ legalName: z2.string().min(1, "Legal company name is required"),
81584
+ type: z2.enum(["corporation", "llc"]).optional(),
81585
+ ein: z2.string().min(1, "EIN is required")
81586
+ }),
81587
+ representative: z2.object({
81588
+ title: z2.string().min(1, "Title is required"),
81589
+ firstName: z2.string().min(1, "First name is required"),
81590
+ email: z2.string().email("Invalid email address"),
81591
+ phone: z2.string().min(1, "Phone number is required"),
81592
+ position: z2.enum(["owner", "manager", "director"]).optional()
81593
+ })
81594
+ });
81595
+ const PHONE_NUMBER = null;
81596
+ const PhoneSettings = ({ onSave, onBack }) => {
81597
+ const legalNameRef = useRef(null);
81598
+ const { isUpdatingBrandSettings, data: meResponse } = useBusiness();
81599
+ const { toast: toast2 } = useToast();
81600
+ const [hideBanner, sethideBanner] = useState(Boolean(PHONE_NUMBER));
81601
+ useEffect(() => {
81602
+ legalNameRef.current?.focus();
81603
+ }, []);
81604
+ const form = useForm({
81605
+ resolver: t2(phoneSettingsSchema),
81606
+ defaultValues: {
81607
+ company: { legalName: "", type: void 0, ein: "" },
81608
+ representative: {
81609
+ title: "",
81610
+ firstName: "",
81611
+ email: "",
81612
+ phone: "",
81613
+ position: void 0
81614
+ }
81615
+ }
81616
+ });
81617
+ const onSubmit = async (data) => {
81618
+ try {
81619
+ console.log("Submitted Phone Settings data", data);
81620
+ toast2({ title: "Settings saved 🚀" });
81621
+ onSave?.();
81622
+ } catch (error2) {
81623
+ toast2({ title: "Error saving settings", variant: "destructive" });
81624
+ }
81563
81625
  };
81626
+ const primaryColor = meResponse?.branding?.primaryColor || "#000000";
81627
+ const errorCount = Object.entries(form.formState.errors).reduce(
81628
+ (acc, [key, error2]) => {
81629
+ if (key === "company" || key === "representative") {
81630
+ return acc + Object.keys(error2).length;
81631
+ }
81632
+ return acc + 1;
81633
+ },
81634
+ 0
81635
+ );
81636
+ return /* @__PURE__ */ jsx(Form, { ...form, children: /* @__PURE__ */ jsxs(
81637
+ "form",
81638
+ {
81639
+ onSubmit: form.handleSubmit(onSubmit),
81640
+ className: "w-full h-full flex flex-col bg-white rounded-lg",
81641
+ children: [
81642
+ /* @__PURE__ */ jsx("div", { className: "flex-1 flex flex-col min-h-0 px-6 pt-16 overflow-y-auto relative", children: /* @__PURE__ */ jsxs("div", { className: "flex-1 w-full min-h-[400px] @container flex flex-col gap-2", children: [
81643
+ !hideBanner && /* @__PURE__ */ jsx(
81644
+ "div",
81645
+ {
81646
+ className: cn$1(
81647
+ bannerVariants({
81648
+ variant: "warning",
81649
+ size: "default",
81650
+ position: "inline"
81651
+ }),
81652
+ styles.base,
81653
+ "p-4 relative"
81654
+ ),
81655
+ role: "alert",
81656
+ children: /* @__PURE__ */ jsxs("div", { className: "flex items-start", children: [
81657
+ /* @__PURE__ */ jsx("div", { className: "mr-3 shrink-0 pt-0.5", children: /* @__PURE__ */ jsx(TriangleAlert, { className: "h-6 w-6" }) }),
81658
+ /* @__PURE__ */ jsxs("div", { className: "flex-grow", children: [
81659
+ /* @__PURE__ */ jsx("h5", { className: "text-sm font-medium mb-1", children: "Complete Required Information" }),
81660
+ /* @__PURE__ */ jsx("div", { className: "text-sm", children: "Please complete the required information to get your Twilio phone number." })
81661
+ ] })
81662
+ ] })
81663
+ }
81664
+ ),
81665
+ /* @__PURE__ */ jsxs("div", { className: "bg-card rounded-lg border shadow-sm", children: [
81666
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between p-6", children: [
81667
+ /* @__PURE__ */ jsx("h2", { className: "text-xl font-semibold", children: "Twilio Application" }),
81668
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
81669
+ /* @__PURE__ */ jsx("span", { className: "text-sm text-muted-foreground", children: "Status:" }),
81670
+ /* @__PURE__ */ jsx("span", { className: "inline-flex items-center rounded-full bg-yellow-100 px-2 py-1 text-xs font-medium text-yellow-800", children: "Pending" })
81671
+ ] })
81672
+ ] }),
81673
+ /* @__PURE__ */ jsxs("div", { className: "py-4 @md:grid @md:grid-cols-2 @md:gap-8 px-6", children: [
81674
+ /* @__PURE__ */ jsxs("div", { children: [
81675
+ /* @__PURE__ */ jsx("h3", { className: "text-base font-medium pb-2 border-b border-border", children: "Company" }),
81676
+ /* @__PURE__ */ jsx("div", { className: "space-y-4 py-4", children: /* @__PURE__ */ jsx(
81677
+ CompanyFormFields,
81678
+ {
81679
+ control: form.control,
81680
+ disabled: isUpdatingBrandSettings,
81681
+ legalNameRef
81682
+ }
81683
+ ) })
81684
+ ] }),
81685
+ /* @__PURE__ */ jsxs("div", { children: [
81686
+ /* @__PURE__ */ jsx("h3", { className: "text-base font-medium pb-2 border-b border-border", children: "Authorized Representative" }),
81687
+ /* @__PURE__ */ jsx("div", { className: "space-y-4 py-4", children: /* @__PURE__ */ jsx(
81688
+ RepresentativeFormFields,
81689
+ {
81690
+ control: form.control,
81691
+ disabled: isUpdatingBrandSettings
81692
+ }
81693
+ ) })
81694
+ ] })
81695
+ ] })
81696
+ ] }),
81697
+ /* @__PURE__ */ jsx("div", { className: "h-4", children: " " })
81698
+ ] }) }),
81699
+ /* @__PURE__ */ jsxs(DialogFooter, { className: "py-4 px-6", children: [
81700
+ onBack && /* @__PURE__ */ jsx(
81701
+ Button$1,
81702
+ {
81703
+ variant: "outline",
81704
+ className: "gap-1.5",
81705
+ onClick: onBack,
81706
+ disabled: isUpdatingBrandSettings,
81707
+ children: "Go Back"
81708
+ }
81709
+ ),
81710
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-4", children: [
81711
+ errorCount > 0 && /* @__PURE__ */ jsxs("span", { className: "text-sm text-destructive flex items-center gap-1.5", children: [
81712
+ "Please fix the ",
81713
+ /* @__PURE__ */ jsx("span", { className: "font-bold", children: errorCount }),
81714
+ " ",
81715
+ "fields that need attention"
81716
+ ] }),
81717
+ /* @__PURE__ */ jsx(
81718
+ Button$1,
81719
+ {
81720
+ type: "submit",
81721
+ className: "px-4",
81722
+ style: { backgroundColor: primaryColor },
81723
+ disabled: isUpdatingBrandSettings || !form.formState.isDirty,
81724
+ children: isUpdatingBrandSettings ? /* @__PURE__ */ jsxs(Fragment, { children: [
81725
+ /* @__PURE__ */ jsx(LoaderCircle, { className: "mr-2 h-4 w-4 animate-spin" }),
81726
+ "Saving"
81727
+ ] }) : "Save Changes"
81728
+ }
81729
+ )
81730
+ ] })
81731
+ ] })
81732
+ ]
81733
+ }
81734
+ ) });
81564
81735
  };
81565
- const FormItemContext = React.createContext(
81566
- {}
81567
- );
81568
- const FormItem = React.forwardRef(({ className: className2, ...props2 }, ref) => {
81569
- const id2 = React.useId();
81570
- return /* @__PURE__ */ jsx(FormItemContext.Provider, { value: { id: id2 }, children: /* @__PURE__ */ jsx("div", { ref, className: cn$1("space-y-2", className2), ...props2 }) });
81571
- });
81572
- FormItem.displayName = "FormItem";
81573
- const FormLabel = React.forwardRef(({ className: className2, ...props2 }, ref) => {
81574
- const { error: error2, formItemId } = useFormField();
81575
- return /* @__PURE__ */ jsx(
81576
- Label$1,
81736
+ function SidebarTabLayout({
81737
+ tabs,
81738
+ activeTab,
81739
+ onTabChange,
81740
+ title: title2
81741
+ }) {
81742
+ return /* @__PURE__ */ jsxs("div", { className: "flex h-full", children: [
81743
+ /* @__PURE__ */ jsxs("div", { className: "w-48 py-2 pl-4", children: [
81744
+ title2 && /* @__PURE__ */ jsx("h2", { className: "px-4 pt-4 pb-5 text-lg font-medium", children: title2 }),
81745
+ tabs.map((tab) => /* @__PURE__ */ jsx(
81746
+ Button$1,
81747
+ {
81748
+ variant: "ghost",
81749
+ className: cn$1(
81750
+ "w-full justify-start mb-1",
81751
+ activeTab === tab.id && "bg-accent"
81752
+ ),
81753
+ onClick: () => onTabChange(tab.id),
81754
+ children: tab.label
81755
+ },
81756
+ tab.id
81757
+ ))
81758
+ ] }),
81759
+ /* @__PURE__ */ jsx("div", { className: "flex-1", children: tabs.find((tab) => tab.id === activeTab)?.content })
81760
+ ] });
81761
+ }
81762
+ function EngageSettingsDialog({
81763
+ open,
81764
+ setOpen
81765
+ }) {
81766
+ const [activeTab, setActiveTab] = useState("brand");
81767
+ const flags = ne();
81768
+ const isSettingsModalEnabled = flags["show-settings-modal"] ?? false;
81769
+ useEffect(() => {
81770
+ if (open) {
81771
+ setActiveTab("brand");
81772
+ }
81773
+ }, [open]);
81774
+ const tabs = isSettingsModalEnabled ? [
81577
81775
  {
81578
- ref,
81579
- className: cn$1(error2 && "text-destructive", className2),
81580
- htmlFor: formItemId,
81581
- ...props2
81776
+ id: "brand",
81777
+ label: "Brand",
81778
+ content: /* @__PURE__ */ jsx(BrandSettings, {})
81779
+ },
81780
+ {
81781
+ id: "phone-number",
81782
+ label: "Phone Number",
81783
+ content: /* @__PURE__ */ jsx(PhoneSettings, {})
81582
81784
  }
81583
- );
81584
- });
81585
- FormLabel.displayName = "FormLabel";
81586
- const FormControl = React.forwardRef(({ ...props2 }, ref) => {
81587
- const { error: error2, formItemId, formDescriptionId, formMessageId } = useFormField();
81588
- return /* @__PURE__ */ jsx(
81589
- Slot$4,
81785
+ ] : [
81590
81786
  {
81591
- ref,
81592
- id: formItemId,
81593
- "aria-describedby": !error2 ? `${formDescriptionId}` : `${formDescriptionId} ${formMessageId}`,
81594
- "aria-invalid": !!error2,
81595
- ...props2
81787
+ id: "brand",
81788
+ label: "Brand",
81789
+ content: /* @__PURE__ */ jsx(BrandSettings, {})
81596
81790
  }
81791
+ ];
81792
+ return /* @__PURE__ */ jsx(Dialog, { open, onOpenChange: setOpen, children: /* @__PURE__ */ jsxs(DialogContent, { className: "flex w-[90vw] h-[90vh] flex-col gap-0 overflow-hidden sm:max-w-xl md:max-w-3xl lg:max-w-4xl xl:max-w-5xl p-0", children: [
81793
+ /* @__PURE__ */ jsxs(VisuallyHidden$2, { children: [
81794
+ /* @__PURE__ */ jsx(DialogTitle, { children: "Settings" }),
81795
+ /* @__PURE__ */ jsx(DialogDescription, { children: "Edit your business and brand settings" })
81796
+ ] }),
81797
+ /* @__PURE__ */ jsx("div", { className: "flex-1 overflow-hidden", children: /* @__PURE__ */ jsx(
81798
+ SidebarTabLayout,
81799
+ {
81800
+ tabs,
81801
+ activeTab,
81802
+ onTabChange: setActiveTab,
81803
+ title: "Settings"
81804
+ }
81805
+ ) })
81806
+ ] }) });
81807
+ }
81808
+ const useAutomationStatusToggle = (id2) => {
81809
+ const { updateAutomation: updateAutomation2, updateError, isUpdateSuccess } = useUpdateBusinessAutomation(id2);
81810
+ const { toast: toast2 } = useToast();
81811
+ const toggleStatus = async (isActive) => {
81812
+ try {
81813
+ await updateAutomation2({
81814
+ status: isActive ? AutomationStatus.ACTIVE : AutomationStatus.DRAFT
81815
+ });
81816
+ return true;
81817
+ } catch (error2) {
81818
+ console.error("Update failed:", error2);
81819
+ toast2({
81820
+ title: "Error updating status",
81821
+ description: "Please try again",
81822
+ variant: "destructive"
81823
+ });
81824
+ return false;
81825
+ }
81826
+ };
81827
+ useEffect(() => {
81828
+ if (isUpdateSuccess) {
81829
+ toast2({
81830
+ title: "Status updated",
81831
+ description: "The status has been updated successfully"
81832
+ });
81833
+ } else if (updateError) {
81834
+ toast2({
81835
+ title: "Error updating status",
81836
+ description: "Please try again",
81837
+ variant: "destructive"
81838
+ });
81839
+ }
81840
+ }, [isUpdateSuccess, updateError, toast2]);
81841
+ return { toggleStatus };
81842
+ };
81843
+ const DEFAULT_PAGE_SIZE$2 = 10;
81844
+ function AutomationList() {
81845
+ const { toast: toast2 } = useToast();
81846
+ const [updatingId, setUpdatingId] = useState(null);
81847
+ const { toggleStatus } = useAutomationStatusToggle(updatingId || "");
81848
+ const navigate = useNavigate();
81849
+ const [pageSizeForQuery, setPageSizeForQuery] = useState(DEFAULT_PAGE_SIZE$2);
81850
+ const [cursorForQuery, setCursorForQuery] = useState(
81851
+ void 0
81597
81852
  );
81598
- });
81599
- FormControl.displayName = "FormControl";
81600
- const FormDescription = React.forwardRef(({ className: className2, ...props2 }, ref) => {
81601
- const { formDescriptionId } = useFormField();
81602
- return /* @__PURE__ */ jsx(
81603
- "p",
81604
- {
81605
- ref,
81606
- id: formDescriptionId,
81607
- className: cn$1("text-[0.8rem] text-muted-foreground", className2),
81608
- ...props2
81853
+ const [searchQuery, setSearchQuery] = useState("");
81854
+ const {
81855
+ automations,
81856
+ nextCursor,
81857
+ isLoading,
81858
+ error: error2,
81859
+ isFetching,
81860
+ isPlaceholderData
81861
+ } = useListBusinessAutomations({
81862
+ cursor: cursorForQuery,
81863
+ limit: pageSizeForQuery,
81864
+ triggerType: AutomationTriggerType.TRIGGER_BASED,
81865
+ search: searchQuery || void 0
81866
+ });
81867
+ useEffect(() => {
81868
+ if (error2) {
81869
+ toast2({
81870
+ title: `Error Fetching ${t$1("engage:automation")}`,
81871
+ description: error2?.message || "Please try again.",
81872
+ variant: "destructive"
81873
+ });
81609
81874
  }
81875
+ }, [error2, toast2]);
81876
+ const mappedItems = useMemo(() => {
81877
+ return (automations || []).map((automation2) => ({
81878
+ ...automation2,
81879
+ emailsSent: 0,
81880
+ smsSent: 0,
81881
+ updated_at: automation2.updatedAt || automation2.createdAt
81882
+ }));
81883
+ }, [automations]);
81884
+ const handleToggle = useCallback(
81885
+ async (id2, newStatus) => {
81886
+ try {
81887
+ setUpdatingId(id2);
81888
+ const shouldBeActive = newStatus === AutomationStatus.ACTIVE;
81889
+ await toggleStatus(shouldBeActive);
81890
+ } finally {
81891
+ setUpdatingId(null);
81892
+ }
81893
+ },
81894
+ [toggleStatus, setUpdatingId]
81610
81895
  );
81611
- });
81612
- FormDescription.displayName = "FormDescription";
81613
- const FormMessage = React.forwardRef(({ className: className2, children: children2, ...props2 }, ref) => {
81614
- const { error: error2, formMessageId } = useFormField();
81615
- const body = error2 ? String(error2?.message) : children2;
81616
- if (!body) {
81617
- return null;
81618
- }
81619
- return /* @__PURE__ */ jsx(
81620
- "p",
81896
+ const handleQueryParametersChange = useCallback(
81897
+ (params) => {
81898
+ setCursorForQuery(params.cursor);
81899
+ setPageSizeForQuery(params.pageSize);
81900
+ },
81901
+ []
81902
+ );
81903
+ const setUrl = useCallback(
81904
+ (id2) => `/automations/view-modal/${id2}?showBackButton=true`,
81905
+ []
81906
+ );
81907
+ const columns = useMemo(
81908
+ () => createColumns({
81909
+ automationName: t$1("engage:automation"),
81910
+ setUrl,
81911
+ onToggle: handleToggle,
81912
+ vsaasManaged: true
81913
+ }),
81914
+ [handleToggle, setUrl]
81915
+ );
81916
+ return /* @__PURE__ */ jsx("div", { className: "w-full h-[75vh] flex flex-col", children: /* @__PURE__ */ jsx("div", { className: "flex-grow min-h-0 p-2", children: /* @__PURE__ */ jsx(
81917
+ TanstackTable,
81621
81918
  {
81622
- ref,
81623
- id: formMessageId,
81624
- className: cn$1("text-[0.8rem] font-medium text-destructive", className2),
81625
- ...props2,
81626
- children: body
81919
+ data: mappedItems,
81920
+ columns,
81921
+ paginationMode: "cursor",
81922
+ initialPageSize: pageSizeForQuery,
81923
+ isLoading: isLoading && !isPlaceholderData,
81924
+ onRowClick: (row) => {
81925
+ navigate(`/automations/view-modal/${row.id}?showBackButton=true`);
81926
+ },
81927
+ cursorPaginationQueryResult: {
81928
+ nextCursor,
81929
+ isLoading,
81930
+ isFetching,
81931
+ isPlaceholderData
81932
+ },
81933
+ onQueryParametersChange: handleQueryParametersChange,
81934
+ searchValue: searchQuery,
81935
+ onSearchChange: setSearchQuery
81627
81936
  }
81937
+ ) }) });
81938
+ }
81939
+ const DEFAULT_PAGE_SIZE$1 = 10;
81940
+ function BroadcastList() {
81941
+ const { toast: toast2 } = useToast();
81942
+ const [createDialogOpen, setCreateDialogOpen] = useState(false);
81943
+ const [updatingId, setUpdatingId] = useState(null);
81944
+ const { toggleStatus } = useAutomationStatusToggle(updatingId || "");
81945
+ const navigate = useNavigate();
81946
+ const [pageSizeForQuery, setPageSizeForQuery] = useState(DEFAULT_PAGE_SIZE$1);
81947
+ const [cursorForQuery, setCursorForQuery] = useState(
81948
+ void 0
81628
81949
  );
81629
- });
81630
- FormMessage.displayName = "FormMessage";
81950
+ const [searchQuery, setSearchQuery] = useState("");
81951
+ const {
81952
+ automations,
81953
+ nextCursor,
81954
+ isLoading,
81955
+ error: error2,
81956
+ isFetching,
81957
+ isPlaceholderData
81958
+ } = useListBusinessAutomations({
81959
+ cursor: cursorForQuery,
81960
+ limit: pageSizeForQuery,
81961
+ triggerType: AutomationTriggerType.ONE_TIME,
81962
+ search: searchQuery || void 0
81963
+ });
81964
+ useEffect(() => {
81965
+ if (error2) {
81966
+ toast2({
81967
+ title: `Error Fetching ${t$1("engage:one_time")}`,
81968
+ description: error2?.message || "Please try again.",
81969
+ variant: "destructive"
81970
+ });
81971
+ }
81972
+ }, [error2, toast2]);
81973
+ const broadcasts = useMemo(() => {
81974
+ return (automations || []).map((automation2) => ({
81975
+ ...automation2,
81976
+ updated_at: automation2.updatedAt
81977
+ }));
81978
+ }, [automations]);
81979
+ const handleToggle = useCallback(
81980
+ async (id2, newStatus) => {
81981
+ try {
81982
+ setUpdatingId(id2);
81983
+ const shouldBeActive = newStatus === AutomationStatus.ACTIVE;
81984
+ await toggleStatus(shouldBeActive);
81985
+ } finally {
81986
+ setUpdatingId(null);
81987
+ }
81988
+ },
81989
+ [toggleStatus, setUpdatingId]
81990
+ );
81991
+ const handleQueryParametersChange = useCallback(
81992
+ (params) => {
81993
+ setCursorForQuery(params.cursor);
81994
+ setPageSizeForQuery(params.pageSize);
81995
+ },
81996
+ []
81997
+ );
81998
+ const resetListPagination = () => {
81999
+ setCursorForQuery(void 0);
82000
+ setPageSizeForQuery(DEFAULT_PAGE_SIZE$1);
82001
+ setSearchQuery("");
82002
+ };
82003
+ const onDialogClose = (result) => {
82004
+ console.log("result", result);
82005
+ handleDialogClose(
82006
+ setCreateDialogOpen,
82007
+ toast2,
82008
+ result,
82009
+ `Error creating ${t$1("engage:one_time")}`,
82010
+ "Please try again"
82011
+ );
82012
+ resetListPagination();
82013
+ if (result !== false) {
82014
+ navigate(`/automations/view-modal/${result}?showBackButton=true`);
82015
+ }
82016
+ };
82017
+ const setUrl = useCallback(
82018
+ (id2) => `/automations/view-modal/${id2}?showBackButton=true`,
82019
+ []
82020
+ );
82021
+ const columns = useMemo(
82022
+ () => createColumns({
82023
+ automationName: t$1("engage:one_time"),
82024
+ setUrl,
82025
+ onToggle: handleToggle
82026
+ }),
82027
+ [handleToggle, setUrl]
82028
+ );
82029
+ const headerActionsContent = /* @__PURE__ */ jsxs(Button$1, { className: "bg-primary", onClick: () => setCreateDialogOpen(true), children: [
82030
+ /* @__PURE__ */ jsx(Plus, { className: "h-4 w-4 mr-1" }),
82031
+ "New"
82032
+ ] });
82033
+ return /* @__PURE__ */ jsxs("div", { className: "w-full h-[75vh] flex flex-col", children: [
82034
+ /* @__PURE__ */ jsx("div", { className: "flex-grow min-h-0 p-2", children: /* @__PURE__ */ jsx(
82035
+ TanstackTable,
82036
+ {
82037
+ data: broadcasts,
82038
+ columns,
82039
+ paginationMode: "cursor",
82040
+ initialPageSize: pageSizeForQuery,
82041
+ headerActions: headerActionsContent,
82042
+ isLoading: isLoading && !isPlaceholderData,
82043
+ cursorPaginationQueryResult: {
82044
+ nextCursor,
82045
+ isLoading,
82046
+ isFetching,
82047
+ isPlaceholderData
82048
+ },
82049
+ onRowClick: (row) => {
82050
+ navigate(`/automations/view-modal/${row.id}?showBackButton=true`);
82051
+ },
82052
+ onQueryParametersChange: handleQueryParametersChange,
82053
+ searchValue: searchQuery,
82054
+ onSearchChange: setSearchQuery
82055
+ }
82056
+ ) }),
82057
+ /* @__PURE__ */ jsx(
82058
+ CreateAutomationDialog,
82059
+ {
82060
+ open: createDialogOpen,
82061
+ setOpen: setCreateDialogOpen,
82062
+ onClose: onDialogClose,
82063
+ automationType: AutomationTriggerType.ONE_TIME
82064
+ }
82065
+ )
82066
+ ] });
82067
+ }
82068
+ const DEFAULT_PAGE_SIZE = 10;
82069
+ function SegmentList() {
82070
+ const { toast: toast2 } = useToast();
82071
+ const [createDialogOpen, setCreateDialogOpen] = useState(false);
82072
+ const [selectedSegment, setSelectedSegment] = useState(null);
82073
+ const [pageSizeForQuery, setPageSizeForQuery] = useState(DEFAULT_PAGE_SIZE);
82074
+ const [cursorForQuery, setCursorForQuery] = useState(
82075
+ void 0
82076
+ );
82077
+ const [searchQuery, setSearchQuery] = useState("");
82078
+ const { segments, isLoading, nextCursor, isFetching, isPlaceholderData } = useListSegments({
82079
+ search: searchQuery || void 0,
82080
+ cursor: cursorForQuery,
82081
+ limit: pageSizeForQuery
82082
+ });
82083
+ const toggleSelectedSegment = useCallback(
82084
+ (id2) => {
82085
+ setSelectedSegment(id2);
82086
+ setCreateDialogOpen(true);
82087
+ },
82088
+ [setSelectedSegment]
82089
+ );
82090
+ const columns = useMemo(
82091
+ () => createSegmentColumns(toggleSelectedSegment),
82092
+ [toggleSelectedSegment]
82093
+ );
82094
+ const segmentsMapped = useMemo(
82095
+ () => segments ? segments.map((segment2) => ({
82096
+ ...segment2,
82097
+ updated_at: segment2.createdAt.toString(),
82098
+ user_count: segment2.userCount,
82099
+ user_count_updated_at: segment2.userCountUpdatedAt
82100
+ })) : [],
82101
+ [segments]
82102
+ );
82103
+ const headerActionsContent = useMemo(() => {
82104
+ return /* @__PURE__ */ jsxs(
82105
+ Button$1,
82106
+ {
82107
+ onClick: () => {
82108
+ setSelectedSegment(null);
82109
+ setCreateDialogOpen(true);
82110
+ },
82111
+ children: [
82112
+ /* @__PURE__ */ jsx(Plus, { className: "h-4 w-4" }),
82113
+ "New List"
82114
+ ]
82115
+ }
82116
+ );
82117
+ }, []);
82118
+ const handleQueryParametersChange = useCallback(
82119
+ (params) => {
82120
+ setCursorForQuery(params.cursor);
82121
+ setPageSizeForQuery(params.pageSize);
82122
+ },
82123
+ []
82124
+ );
82125
+ const resetListPagination = () => {
82126
+ setCursorForQuery(void 0);
82127
+ setPageSizeForQuery(DEFAULT_PAGE_SIZE);
82128
+ setSearchQuery("");
82129
+ };
82130
+ const onDialogClose = (result) => {
82131
+ handleDialogClose(
82132
+ setCreateDialogOpen,
82133
+ toast2,
82134
+ result,
82135
+ `Error creating ${t$1("engage:segment")}`,
82136
+ "Please try again"
82137
+ );
82138
+ resetListPagination();
82139
+ };
82140
+ return /* @__PURE__ */ jsxs("div", { className: "w-full h-[75vh] flex flex-col", children: [
82141
+ /* @__PURE__ */ jsx("div", { className: "flex-grow min-h-0 p-2", children: /* @__PURE__ */ jsx(
82142
+ TanstackTable,
82143
+ {
82144
+ data: segmentsMapped,
82145
+ columns,
82146
+ paginationMode: "cursor",
82147
+ initialPageSize: pageSizeForQuery,
82148
+ headerActions: headerActionsContent,
82149
+ isLoading: isLoading && !isPlaceholderData,
82150
+ cursorPaginationQueryResult: {
82151
+ nextCursor,
82152
+ isLoading,
82153
+ isFetching,
82154
+ isPlaceholderData
82155
+ },
82156
+ onQueryParametersChange: handleQueryParametersChange,
82157
+ onRowClick: (row) => {
82158
+ setSelectedSegment(row.id);
82159
+ setCreateDialogOpen(true);
82160
+ },
82161
+ searchValue: searchQuery,
82162
+ onSearchChange: setSearchQuery
82163
+ }
82164
+ ) }),
82165
+ /* @__PURE__ */ jsx(
82166
+ SegmentBuilderDialog,
82167
+ {
82168
+ open: createDialogOpen,
82169
+ setOpen: setCreateDialogOpen,
82170
+ segmentId: selectedSegment ?? void 0,
82171
+ onSegmentUpdated: onDialogClose
82172
+ }
82173
+ )
82174
+ ] });
82175
+ }
82176
+ const EngageMain = () => {
82177
+ const engageListTabs = [
82178
+ {
82179
+ id: "broadcasts",
82180
+ label: t$1("engage:one_time", { count: 2 }),
82181
+ content: /* @__PURE__ */ jsx(BroadcastList, {})
82182
+ },
82183
+ {
82184
+ id: "automations",
82185
+ label: t$1("engage:automation", { count: 2 }),
82186
+ content: /* @__PURE__ */ jsx(AutomationList, {})
82187
+ },
82188
+ {
82189
+ id: "segments",
82190
+ label: t$1("engage:segment", { count: 2 }),
82191
+ content: /* @__PURE__ */ jsx(SegmentList, {})
82192
+ },
82193
+ {
82194
+ id: "statistics",
82195
+ label: t$1("engage:insight", { count: 2 }),
82196
+ content: /* @__PURE__ */ jsx(AutomationStatistics, {})
82197
+ }
82198
+ ];
82199
+ const queryClient = useQueryClient();
82200
+ const [engageSettingsOpen, setEngageSettingsOpen] = useState(false);
82201
+ const [activeTab, setActiveTab] = useState(engageListTabs[0].id);
82202
+ useEffect(() => {
82203
+ queryClient.prefetchQuery({
82204
+ queryKey: automationKeys.list()
82205
+ });
82206
+ queryClient.prefetchQuery({
82207
+ queryKey: segmentKeys.lists()
82208
+ });
82209
+ }, [queryClient]);
82210
+ return /* @__PURE__ */ jsxs("div", { className: "w-full h-full flex flex-col gap-4", children: [
82211
+ /* @__PURE__ */ jsx(
82212
+ EngageSettingsDialog,
82213
+ {
82214
+ open: engageSettingsOpen,
82215
+ setOpen: setEngageSettingsOpen
82216
+ }
82217
+ ),
82218
+ /* @__PURE__ */ jsx("div", { className: "flex justify-end", children: /* @__PURE__ */ jsx(Button$1, { variant: "outline", onClick: () => setEngageSettingsOpen(true), children: /* @__PURE__ */ jsx(Settings, { className: "w-4 h-4" }) }) }),
82219
+ /* @__PURE__ */ jsx("div", { className: "flex-1 w-full h-full flex flex-col gap-4", children: /* @__PURE__ */ jsx(
82220
+ AnimatedTabs,
82221
+ {
82222
+ activeTab,
82223
+ tabs: engageListTabs,
82224
+ onTabChange: setActiveTab
82225
+ }
82226
+ ) })
82227
+ ] });
82228
+ };
82229
+ const Engage = () => {
82230
+ return /* @__PURE__ */ jsx(Provider$1, { children: /* @__PURE__ */ jsx(EngageMain, {}) });
82231
+ };
81631
82232
  const formSchema$1 = objectType({
81632
82233
  name: stringType().min(2, "Title must be at least 2 characters"),
81633
82234
  description: stringType()
@@ -81724,6 +82325,10 @@ function AutomationEditDialog({
81724
82325
  defaultValues: {
81725
82326
  name: automation2?.name ?? "",
81726
82327
  description: automation2?.description ?? ""
82328
+ },
82329
+ values: {
82330
+ name: automation2?.name ?? "",
82331
+ description: automation2?.description ?? ""
81727
82332
  }
81728
82333
  });
81729
82334
  function onSubmit(values) {
@@ -81738,8 +82343,17 @@ function AutomationEditDialog({
81738
82343
  }
81739
82344
  return /* @__PURE__ */ jsx(Dialog, { open, onOpenChange, children: /* @__PURE__ */ jsxs(DialogContent, { className: "sm:max-w-[425px]", children: [
81740
82345
  /* @__PURE__ */ jsxs(DialogHeader, { children: [
81741
- /* @__PURE__ */ jsx(DialogTitle, { children: "Edit Automation" }),
81742
- /* @__PURE__ */ jsx(DialogDescription, { children: "Update the title and description of your automation." })
82346
+ /* @__PURE__ */ jsxs(DialogTitle, { children: [
82347
+ "Edit",
82348
+ " ",
82349
+ automation2.triggerType === AutomationTriggerType.ONE_TIME ? t$1("engage:one_time") : t$1("engage:automation")
82350
+ ] }),
82351
+ /* @__PURE__ */ jsxs(DialogDescription, { children: [
82352
+ "Update the title and description of your",
82353
+ " ",
82354
+ automation2.triggerType === AutomationTriggerType.ONE_TIME ? t$1("engage:one_time") : t$1("engage:automation"),
82355
+ "."
82356
+ ] })
81743
82357
  ] }),
81744
82358
  /* @__PURE__ */ jsx(Form, { ...form, children: /* @__PURE__ */ jsxs("form", { onSubmit: form.handleSubmit(onSubmit), className: "space-y-4", children: [
81745
82359
  /* @__PURE__ */ jsx(
@@ -81977,18 +82591,66 @@ const AutomationsEditorHeader = ({ showBackButton, onDuplicationCreated, onBefor
81977
82591
  if (!showSwitch) {
81978
82592
  return /* @__PURE__ */ jsx(Badge, { variant: getAutomationStatusVariant(automation2.status), children: STATUS_DISPLAY[automation2.status] });
81979
82593
  } else {
81980
- return /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 w-[12ch] cursor-pointer", children: [
81981
- isActive ? /* @__PURE__ */ jsx(Check, { className: "w-4 h-4" }) : /* @__PURE__ */ jsx(CircleX, { className: "w-4 h-4" }),
81982
- /* @__PURE__ */ jsx("div", { className: "text-[13px] font-medium", children: isActive ? "Active" : "Inactive" }),
81983
- /* @__PURE__ */ jsx(
81984
- Switch,
81985
- {
81986
- checked: isActive,
81987
- onCheckedChange: handleStatusChange,
81988
- disabled: disableSwitch
82594
+ switch (automation2.triggerType) {
82595
+ case AutomationTriggerType.TRIGGER_BASED:
82596
+ return /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 w-[12ch] cursor-pointer", children: [
82597
+ isActive ? /* @__PURE__ */ jsx(Check, { className: "w-4 h-4" }) : /* @__PURE__ */ jsx(CircleX, { className: "w-4 h-4" }),
82598
+ /* @__PURE__ */ jsx("div", { className: "text-[13px] font-medium", children: isActive ? "Active" : "Inactive" }),
82599
+ /* @__PURE__ */ jsx(
82600
+ Switch,
82601
+ {
82602
+ checked: isActive,
82603
+ onCheckedChange: handleStatusChange,
82604
+ disabled: disableSwitch
82605
+ }
82606
+ )
82607
+ ] });
82608
+ case AutomationTriggerType.ONE_TIME: {
82609
+ if (!automation2.triggerMetadata || automation2.triggerMetadata?.triggerType === AutomationTriggerType.ONE_TIME && !automation2.triggerMetadata?.scheduledAt) {
82610
+ return /* @__PURE__ */ jsx(
82611
+ Button$1,
82612
+ {
82613
+ variant: "outline",
82614
+ className: "flex items-center gap-2",
82615
+ disabled: true,
82616
+ children: "Set Scheduled Time"
82617
+ }
82618
+ );
81989
82619
  }
81990
- )
81991
- ] });
82620
+ if (!isActive) {
82621
+ let sendText = "Schedule Send";
82622
+ if (automation2.triggerMetadata.triggerType === AutomationTriggerType.ONE_TIME && automation2.triggerMetadata.scheduledAt && new Date(automation2.triggerMetadata.scheduledAt) < new Date(Date.now() + 5 * 60 * 1e3)) {
82623
+ sendText = "Send Now";
82624
+ }
82625
+ return /* @__PURE__ */ jsx(
82626
+ Button$1,
82627
+ {
82628
+ variant: "default",
82629
+ className: "flex items-center gap-2",
82630
+ onClick: () => handleStatusChange(!isActive),
82631
+ disabled: disableSwitch,
82632
+ children: sendText
82633
+ }
82634
+ );
82635
+ } else {
82636
+ return /* @__PURE__ */ jsx(
82637
+ Button$1,
82638
+ {
82639
+ variant: "outline",
82640
+ className: "flex items-center gap-2",
82641
+ onClick: () => handleStatusChange(!isActive),
82642
+ disabled: disableSwitch,
82643
+ children: "Convert to Draft"
82644
+ }
82645
+ );
82646
+ }
82647
+ }
82648
+ default:
82649
+ throw UnreachableCaseStatement(
82650
+ automation2.triggerType,
82651
+ AutomationTriggerType
82652
+ );
82653
+ }
81992
82654
  }
81993
82655
  }, [
81994
82656
  automation2,
@@ -82009,24 +82671,38 @@ const AutomationsEditorHeader = ({ showBackButton, onDuplicationCreated, onBefor
82009
82671
  ] }),
82010
82672
  /* @__PURE__ */ jsxs("div", { className: "ml-auto flex gap-4 items-center", children: [
82011
82673
  /* @__PURE__ */ jsx("div", { className: "flex items-center gap-2 text-muted-foreground", children: automation2.triggerType === AutomationTriggerType.ONE_TIME && /* @__PURE__ */ jsxs(Fragment, { children: [
82012
- /* @__PURE__ */ jsx("div", { className: "inline-flex items-center justify-center rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 hover:bg-accent hover:text-accent-foreground h-10 w-10 cursor-pointer", children: /* @__PURE__ */ jsx(
82013
- InfoTooltip,
82674
+ /* @__PURE__ */ jsx(
82675
+ "div",
82014
82676
  {
82015
- title: "Edit",
82016
- Icon: IconDefinitions.EditIcon,
82017
- asChild: false,
82018
- onClick: () => setIsEditDialogOpen(true)
82677
+ className: "inline-flex items-center justify-center rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 hover:bg-accent hover:text-accent-foreground h-10 w-10 cursor-pointer",
82678
+ onClick: () => setIsEditDialogOpen(true),
82679
+ children: /* @__PURE__ */ jsx(
82680
+ InfoTooltip,
82681
+ {
82682
+ title: "Edit",
82683
+ Icon: IconDefinitions.EditIcon,
82684
+ asChild: false,
82685
+ onClick: () => setIsEditDialogOpen(true)
82686
+ }
82687
+ )
82019
82688
  }
82020
- ) }),
82021
- /* @__PURE__ */ jsx("div", { className: "inline-flex items-center justify-center rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 hover:bg-accent hover:text-accent-foreground h-10 w-10 cursor-pointer", children: /* @__PURE__ */ jsx(
82022
- InfoTooltip,
82689
+ ),
82690
+ /* @__PURE__ */ jsx(
82691
+ "div",
82023
82692
  {
82024
- title: "Duplicate",
82025
- Icon: IconDefinitions.DuplicateIcon,
82026
- asChild: false,
82027
- onClick: () => setIsDuplicateDialogOpen(true)
82693
+ className: "inline-flex items-center justify-center rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 hover:bg-accent hover:text-accent-foreground h-10 w-10 cursor-pointer",
82694
+ onClick: () => setIsDuplicateDialogOpen(true),
82695
+ children: /* @__PURE__ */ jsx(
82696
+ InfoTooltip,
82697
+ {
82698
+ title: "Duplicate",
82699
+ Icon: IconDefinitions.DuplicateIcon,
82700
+ asChild: false,
82701
+ onClick: () => setIsDuplicateDialogOpen(true)
82702
+ }
82703
+ )
82028
82704
  }
82029
- ) })
82705
+ )
82030
82706
  ] }) }),
82031
82707
  editingStatus ? /* @__PURE__ */ jsx("div", { className: "flex items-center text-muted-foreground pr-8", children: /* @__PURE__ */ jsx(BasicLoader, {}) }) : renderSwitch()
82032
82708
  ] }),
@@ -82055,7 +82731,7 @@ const AutomationsEditorHeader = ({ showBackButton, onDuplicationCreated, onBefor
82055
82731
  )
82056
82732
  ] });
82057
82733
  };
82058
- const AutomationsEditorStatsTab = () => {
82734
+ const AutomationsEditorStatsTab = ({ hideSms, hideSales }) => {
82059
82735
  const automation2 = useAutomation();
82060
82736
  const { isLoading: isStatisticsLoading } = useGetBusinessAutomationStatistics(
82061
82737
  automation2?.id
@@ -82073,7 +82749,8 @@ const AutomationsEditorStatsTab = () => {
82073
82749
  {
82074
82750
  automationId: automation2.id,
82075
82751
  automation: automation2,
82076
- includeSales: true
82752
+ includeSales: !hideSales,
82753
+ includeSms: !hideSms
82077
82754
  }
82078
82755
  ) });
82079
82756
  };
@@ -84300,9 +84977,7 @@ const DEFAULT_BG = "rgba(245, 246, 247, 1)";
84300
84977
  const STEP_METADATA = {
84301
84978
  [ActionType.SEND_COMMUNICATION]: {
84302
84979
  color: {
84303
- bg: "rgba(205, 241, 225, 1)",
84304
- text: "rgba(30, 108, 74, 1)",
84305
- bgUnselected: DEFAULT_BG
84980
+ bg: DEFAULT_BG
84306
84981
  },
84307
84982
  clickable: true
84308
84983
  },
@@ -84652,11 +85327,16 @@ const AutomationsEditorStep = ({
84652
85327
  const AutomationFlowMain = () => {
84653
85328
  const [isDetailsVisible, setIsDetailsVisible] = useState(false);
84654
85329
  const [actionDataWithMetadata, setActionDataWithMetadata] = useState(void 0);
85330
+ const [isEditingDescription, setIsEditingDescription] = useState(false);
85331
+ const [editedDescription, setEditedDescription] = useState("");
85332
+ const [optimisticDescription, setOptimisticDescription] = useState(null);
84655
85333
  const automation2 = useAutomation();
84656
85334
  const {
84657
85335
  setActionId: setActionId2,
84658
85336
  state: { selectedActionId }
84659
85337
  } = useContext$1(Context);
85338
+ const { updateAutomation: businessUpdateAutomation } = useUpdateBusinessAutomation(automation2?.id || "");
85339
+ const { toast: toast2 } = useToast();
84660
85340
  useEffect(() => {
84661
85341
  if (!automation2) {
84662
85342
  return;
@@ -84704,6 +85384,10 @@ const AutomationFlowMain = () => {
84704
85384
  };
84705
85385
  getData();
84706
85386
  }, [automation2]);
85387
+ useEffect(() => {
85388
+ setOptimisticDescription(null);
85389
+ setEditedDescription(automation2?.description ?? "");
85390
+ }, [automation2?.description]);
84707
85391
  if (!automation2 || !actionDataWithMetadata) {
84708
85392
  return null;
84709
85393
  }
@@ -84721,21 +85405,73 @@ const AutomationFlowMain = () => {
84721
85405
  renderTriggerAndAudienceStep = () => {
84722
85406
  return /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-3", children: [
84723
85407
  automation2.triggerType === AutomationTriggerType.ONE_TIME && /* @__PURE__ */ jsx(AutomationAudienceSelector, {}),
84724
- /* @__PURE__ */ jsx(AutomationEditorTrigger, {})
85408
+ automation2.triggerType !== AutomationTriggerType.ONE_TIME && /* @__PURE__ */ jsx(AutomationEditorTrigger, {})
84725
85409
  ] });
84726
85410
  };
84727
85411
  }
85412
+ const handleSaveDescription = async () => {
85413
+ setOptimisticDescription(editedDescription);
85414
+ businessUpdateAutomation(
85415
+ {
85416
+ description: editedDescription
85417
+ },
85418
+ {
85419
+ onSuccess: () => {
85420
+ toast2({
85421
+ title: "Description updated 🚀"
85422
+ });
85423
+ setIsEditingDescription(false);
85424
+ }
85425
+ }
85426
+ );
85427
+ };
85428
+ const handleCancelEdit = () => {
85429
+ setIsEditingDescription(false);
85430
+ };
84728
85431
  const renderAutomationDescription = () => {
84729
- if (!automation2.description) return null;
85432
+ if (!automation2.description && !isEditingDescription) return null;
84730
85433
  return /* @__PURE__ */ jsx(
84731
85434
  "div",
84732
85435
  {
84733
- className: "w-full mx-auto rounded-xl bg-neutral-50 dark:bg-neutral-900 shadow-sm px-4 py-3 my-2 border border-neutral-200 dark:border-neutral-800 text-neutral-800 dark:text-neutral-100 text-[15px] font-medium leading-snug tracking-tight justify-start",
85436
+ className: "w-full mx-auto rounded-xl bg-neutral-50 dark:bg-neutral-900 shadow-sm px-4 py-3 my-2 border border-neutral-200 dark:border-neutral-800 text-neutral-800 dark:text-neutral-100 text-[15px] font-medium leading-snug tracking-tight justify-start group relative transition-colors duration-150",
84734
85437
  style: {
84735
- /* Container queries for mobile optimization */
84736
85438
  containerType: "inline-size"
84737
85439
  },
84738
- children: automation2.description
85440
+ tabIndex: 0,
85441
+ onClick: () => {
85442
+ setIsEditingDescription(true);
85443
+ },
85444
+ role: "button",
85445
+ "aria-label": "Edit automation description",
85446
+ children: isEditingDescription ? /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-2", children: [
85447
+ /* @__PURE__ */ jsx(
85448
+ "textarea",
85449
+ {
85450
+ className: "w-full bg-transparent outline-none resize-none text-[15px] font-medium leading-snug tracking-tight text-neutral-800 dark:text-neutral-100 rounded-xl border border-primary-500 focus:ring-2 focus:ring-primary-400 transition-all min-h-[48px] p-2",
85451
+ style: { containerType: "inline-size" },
85452
+ value: editedDescription,
85453
+ autoFocus: true,
85454
+ rows: 2,
85455
+ maxLength: 300,
85456
+ onChange: (e4) => setEditedDescription(e4.target.value),
85457
+ onBlur: handleCancelEdit,
85458
+ "aria-label": "Edit automation description textarea"
85459
+ }
85460
+ ),
85461
+ /* @__PURE__ */ jsx(
85462
+ Button$1,
85463
+ {
85464
+ variant: "secondary",
85465
+ onClick: handleSaveDescription,
85466
+ onMouseDown: (e4) => e4.preventDefault(),
85467
+ className: "z-20",
85468
+ children: "Update Description"
85469
+ }
85470
+ )
85471
+ ] }) : /* @__PURE__ */ jsxs(Fragment, { children: [
85472
+ /* @__PURE__ */ jsx("span", { className: "pr-8 select-text cursor-pointer", children: optimisticDescription !== null ? optimisticDescription : automation2.description }),
85473
+ /* @__PURE__ */ jsx("span", { className: "absolute right-3 top-1/2 -translate-y-1/2 opacity-0 group-hover:opacity-100 group-focus:opacity-100 transition-opacity duration-150 pointer-events-none", children: /* @__PURE__ */ jsx(IconDefinitions.EditIcon, { className: "w-4 h-4" }) })
85474
+ ] })
84739
85475
  }
84740
85476
  );
84741
85477
  };
@@ -84772,7 +85508,8 @@ const AutomationFlowMain = () => {
84772
85508
  children: /* @__PURE__ */ jsx(AutomationsEditorStep, { actionDataWithMetadata: actionData })
84773
85509
  },
84774
85510
  actionData.actionData.actionMetadata?.currentActionId ?? index2
84775
- ))
85511
+ )),
85512
+ automation2.triggerType === AutomationTriggerType.ONE_TIME && /* @__PURE__ */ jsx("div", { className: "flex flex-col gap-3", children: /* @__PURE__ */ jsx(AutomationEditorTrigger, {}) })
84776
85513
  ] }) })
84777
85514
  ] });
84778
85515
  };
@@ -84792,26 +85529,26 @@ const AutomationsEditorSidebar = () => {
84792
85529
  }
84793
85530
  return /* @__PURE__ */ jsx("div", { className: "h-full pt-4 relative", children: /* @__PURE__ */ jsx("div", { className: "absolute inset-0 overflow-y-auto flex flex-col gap-3", children: /* @__PURE__ */ jsx(AutomationFlowMain, {}) }) });
84794
85531
  };
84795
- const AutomationsEditorMain = () => {
85532
+ const AutomationsEditorMain = ({ hideSms }) => {
84796
85533
  const {
84797
85534
  state: { selectedActionId }
84798
85535
  } = useContext$1(Context);
84799
- return /* @__PURE__ */ jsx("div", { className: "flex flex-col gap-4 h-full w-full", children: /* @__PURE__ */ jsx(AnimatePresence, { mode: "wait", children: selectedActionId === BuiltInActionIds.EditTime ? /* @__PURE__ */ jsx(AutomationSelectTimeMain, {}) : selectedActionId === BuiltInActionIds.EditAudience ? /* @__PURE__ */ jsx(AutomationAudienceSelectorMain, {}) : /* @__PURE__ */ jsx(AutomationEditorTabs, {}) }) });
85536
+ return /* @__PURE__ */ jsx("div", { className: "flex flex-col gap-4 h-full w-full", children: /* @__PURE__ */ jsx(AnimatePresence, { mode: "wait", children: selectedActionId === BuiltInActionIds.EditTime ? /* @__PURE__ */ jsx(AutomationSelectTimeMain, {}) : selectedActionId === BuiltInActionIds.EditAudience ? /* @__PURE__ */ jsx(AutomationAudienceSelectorMain, {}) : /* @__PURE__ */ jsx(AutomationEditorTabs, { hideSms }) }) });
84800
85537
  };
84801
- const AutomationsEditorWorkflowTab = () => {
85538
+ const AutomationsEditorWorkflowTab = ({ hideSms }) => {
84802
85539
  return /* @__PURE__ */ jsxs(ResizablePanelGroup, { direction: "horizontal", className: "flex-1", children: [
84803
85540
  /* @__PURE__ */ jsx(ResizablePanel, { defaultSize: 30, minSize: 16, maxSize: 48, children: /* @__PURE__ */ jsx("aside", { className: "h-full", children: /* @__PURE__ */ jsx(AutomationsEditorSidebar, {}) }) }),
84804
85541
  /* @__PURE__ */ jsx(ResizableHandle, { className: "px-1 opacity-0 hover:opacity-100 transition-opacity duration-200 mx-1" }),
84805
- /* @__PURE__ */ jsx(ResizablePanel, { defaultSize: 70, children: /* @__PURE__ */ jsx("main", { className: "h-full", children: /* @__PURE__ */ jsx(AutomationsEditorMain, {}) }) })
85542
+ /* @__PURE__ */ jsx(ResizablePanel, { defaultSize: 70, children: /* @__PURE__ */ jsx("main", { className: "h-full", children: /* @__PURE__ */ jsx(AutomationsEditorMain, { hideSms }) }) })
84806
85543
  ] });
84807
85544
  };
84808
- const AutomationsEditorTabs = () => {
85545
+ const AutomationsEditorTabs = ({ hideSms, hideSales }) => {
84809
85546
  const [activeTab, setActiveTab] = React__default.useState("workflow");
84810
85547
  const tabs = [
84811
85548
  {
84812
85549
  id: "workflow",
84813
85550
  label: "Workflow",
84814
- content: /* @__PURE__ */ jsx(AutomationsEditorWorkflowTab, {})
85551
+ content: /* @__PURE__ */ jsx(AutomationsEditorWorkflowTab, { hideSms })
84815
85552
  },
84816
85553
  {
84817
85554
  id: "recipients",
@@ -84821,7 +85558,7 @@ const AutomationsEditorTabs = () => {
84821
85558
  {
84822
85559
  id: "insights",
84823
85560
  label: t$1("engage:insight", { count: 2 }),
84824
- content: /* @__PURE__ */ jsx(AutomationsEditorStatsTab, {})
85561
+ content: /* @__PURE__ */ jsx(AutomationsEditorStatsTab, { hideSms, hideSales })
84825
85562
  }
84826
85563
  ];
84827
85564
  return /* @__PURE__ */ jsx("div", { className: "h-full w-full", children: /* @__PURE__ */ jsx(
@@ -84838,7 +85575,9 @@ const ViewAutomationMain = ({
84838
85575
  showBackButton = false,
84839
85576
  onDuplicationCreated,
84840
85577
  onBeforeSchedule,
84841
- getExtraMergeFields
85578
+ getExtraMergeFields,
85579
+ hideSms,
85580
+ hideSales
84842
85581
  }) => {
84843
85582
  const automation2 = useAutomation();
84844
85583
  const communicationGroup = useCommunicationGroup();
@@ -84895,7 +85634,7 @@ const ViewAutomationMain = ({
84895
85634
  onBeforeSchedule
84896
85635
  }
84897
85636
  ),
84898
- /* @__PURE__ */ jsx("div", { className: "flex-1 border-t", children: /* @__PURE__ */ jsx(AutomationsEditorTabs, {}) })
85637
+ /* @__PURE__ */ jsx("div", { className: "flex-1 border-t", children: /* @__PURE__ */ jsx(AutomationsEditorTabs, { hideSms, hideSales }) })
84899
85638
  ] });
84900
85639
  };
84901
85640
  const ViewAutomationContent = ({ ...props2 }) => {