@embedreach/components 0.1.72 → 0.1.73

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.
@@ -2768,6 +2768,9 @@ var AutomationTriggerType = /* @__PURE__ */ ((AutomationTriggerType2) => {
2768
2768
  function isOneTimeTriggerMetadata(triggerMetadata) {
2769
2769
  return triggerMetadata?.trigger_type === "one_time";
2770
2770
  }
2771
+ function isTriggerBasedTriggerMetadata(triggerMetadata) {
2772
+ return triggerMetadata?.trigger_type === "trigger_based";
2773
+ }
2771
2774
  var AutomationStatus = /* @__PURE__ */ ((AutomationStatus2) => {
2772
2775
  AutomationStatus2["DRAFT"] = "draft";
2773
2776
  AutomationStatus2["ACTIVE"] = "active";
@@ -26483,6 +26486,37 @@ function UnreachableCaseStatement(x3, enumObj) {
26483
26486
  `Unreachable case statement: ${JSON.stringify(x3)}. Valid values are: ${Object.values(enumObj).join(", ")}`
26484
26487
  );
26485
26488
  }
26489
+ const Input = React.forwardRef(
26490
+ ({ className: className2, type, ...props }, ref) => {
26491
+ return /* @__PURE__ */ jsx(
26492
+ "input",
26493
+ {
26494
+ type,
26495
+ className: cn$1(
26496
+ "flex h-9 w-full rounded-md border border-input bg-transparent px-3 py-1 text-base shadow-sm transition-colors file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",
26497
+ className2
26498
+ ),
26499
+ ref,
26500
+ ...props
26501
+ }
26502
+ );
26503
+ }
26504
+ );
26505
+ Input.displayName = "Input";
26506
+ const Textarea = React.forwardRef(({ className: className2, ...props }, ref) => {
26507
+ return /* @__PURE__ */ jsx(
26508
+ "textarea",
26509
+ {
26510
+ className: cn$1(
26511
+ "flex min-h-[60px] w-full rounded-md border border-input bg-transparent px-3 py-2 text-base shadow-sm placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",
26512
+ className2
26513
+ ),
26514
+ ref,
26515
+ ...props
26516
+ }
26517
+ );
26518
+ });
26519
+ Textarea.displayName = "Textarea";
26486
26520
  const OneTimeBroadcast = ({ iconDefinitions }) => {
26487
26521
  return /* @__PURE__ */ jsxs("div", { children: [
26488
26522
  /* @__PURE__ */ jsx("div", { className: styles$3.iconWrapper, children: /* @__PURE__ */ jsx(iconDefinitions.OneTimeBroadcast, {}) }),
@@ -26498,7 +26532,14 @@ const RealtimeActivity = ({ iconDefinitions }) => {
26498
26532
  /* @__PURE__ */ jsx("p", { className: styles$3.cardDescription, children: "Responds to immediate actions your contacts take, like abandoned carts, form submissions, or appointment bookings." })
26499
26533
  ] });
26500
26534
  };
26501
- const SetAutomationName = ({ selectedType, setAutomationName, automationName, iconDefinitions }) => {
26535
+ const SetAutomationNameAndDescription = ({
26536
+ selectedType,
26537
+ setAutomationName,
26538
+ automationName,
26539
+ iconDefinitions,
26540
+ setAutomationDescription,
26541
+ automationDescription
26542
+ }) => {
26502
26543
  const getAutomationComponent = () => {
26503
26544
  switch (selectedType) {
26504
26545
  case AutomationTriggerType.ONE_TIME:
@@ -26513,31 +26554,58 @@ const SetAutomationName = ({ selectedType, setAutomationName, automationName, ic
26513
26554
  }
26514
26555
  };
26515
26556
  return /* @__PURE__ */ jsxs("div", { className: "flex flex-col items-center justify-center p-8 max-w-lg mx-auto", children: [
26516
- /* @__PURE__ */ jsx("h2", { className: "text-2xl font-semibold mb-6 text-center", children: "Name Your Automation" }),
26517
- /* @__PURE__ */ jsxs("div", { className: "w-full space-y-4", children: [
26518
- /* @__PURE__ */ jsx("div", { className: "bg-gray-50 p-4 rounded-lg items-center justify-center text-center", children: getAutomationComponent() }),
26519
- /* @__PURE__ */ jsxs("div", { className: "space-y-2", children: [
26520
- /* @__PURE__ */ jsx(
26521
- "label",
26522
- {
26523
- htmlFor: "automationName",
26524
- className: "block text-sm font-medium text-gray-700",
26525
- children: "Automation Name"
26526
- }
26527
- ),
26528
- /* @__PURE__ */ jsx(
26529
- "input",
26530
- {
26531
- id: "automationName",
26532
- type: "text",
26533
- value: automationName,
26534
- onChange: (e4) => setAutomationName(e4.target.value),
26535
- className: "w-full px-4 py-2 border border-gray-300 rounded-md focus:ring-indigo-500 focus:border-indigo-500 shadow-sm",
26536
- placeholder: "Enter a descriptive name...",
26537
- autoFocus: true
26538
- }
26539
- ),
26540
- /* @__PURE__ */ jsx("p", { className: "text-sm text-gray-500", children: "This name is for your internal reference only - your customers won't see it" })
26557
+ /* @__PURE__ */ jsx("h2", { className: "text-2xl font-semibold mb-8 text-center", children: "Name Your Automation" }),
26558
+ /* @__PURE__ */ jsxs("div", { className: "w-full space-y-6", children: [
26559
+ /* @__PURE__ */ jsx("div", { className: "bg-gray-50 p-6 rounded-xl items-center justify-center text-center", children: getAutomationComponent() }),
26560
+ /* @__PURE__ */ jsxs("div", { className: "space-y-6", children: [
26561
+ /* @__PURE__ */ jsxs("div", { children: [
26562
+ /* @__PURE__ */ jsxs("div", { className: "flex items-baseline justify-between mb-2", children: [
26563
+ /* @__PURE__ */ jsx(
26564
+ "label",
26565
+ {
26566
+ htmlFor: "automationName",
26567
+ className: "block text-sm font-medium text-gray-900",
26568
+ children: "Name"
26569
+ }
26570
+ ),
26571
+ /* @__PURE__ */ jsx("span", { className: "text-xs text-muted-foreground", children: "Only visible to your team" })
26572
+ ] }),
26573
+ /* @__PURE__ */ jsx(
26574
+ Input,
26575
+ {
26576
+ id: "automationName",
26577
+ type: "text",
26578
+ value: automationName,
26579
+ onChange: (e4) => setAutomationName(e4.target.value),
26580
+ className: "w-full px-4 py-2 border border-gray-300 rounded-md focus:ring-indigo-500 focus:border-indigo-500 shadow-sm",
26581
+ placeholder: "e.g. April Newsletter Campaign",
26582
+ autoFocus: true
26583
+ }
26584
+ )
26585
+ ] }),
26586
+ /* @__PURE__ */ jsxs("div", { children: [
26587
+ /* @__PURE__ */ jsxs("div", { className: "flex items-baseline justify-between mb-2", children: [
26588
+ /* @__PURE__ */ jsx(
26589
+ "label",
26590
+ {
26591
+ htmlFor: "automationDescription",
26592
+ className: "block text-sm font-medium text-gray-900",
26593
+ children: "Description"
26594
+ }
26595
+ ),
26596
+ /* @__PURE__ */ jsx("span", { className: "text-xs text-muted-foreground", children: "Optional" })
26597
+ ] }),
26598
+ /* @__PURE__ */ jsx(
26599
+ Textarea,
26600
+ {
26601
+ id: "automationDescription",
26602
+ value: automationDescription,
26603
+ onChange: (e4) => setAutomationDescription(e4.target.value),
26604
+ className: "w-full min-h-[80px] resize-none",
26605
+ placeholder: "Add any helpful context for your team..."
26606
+ }
26607
+ )
26608
+ ] })
26541
26609
  ] })
26542
26610
  ] })
26543
26611
  ] });
@@ -26562,9 +26630,11 @@ const CreateAutomationModal = ({
26562
26630
  */
26563
26631
  automationType ? {
26564
26632
  name: void 0,
26633
+ description: void 0,
26565
26634
  type: automationType
26566
26635
  } : {
26567
26636
  name: void 0,
26637
+ description: void 0,
26568
26638
  type: void 0
26569
26639
  }
26570
26640
  );
@@ -26581,9 +26651,11 @@ const CreateAutomationModal = ({
26581
26651
  day: "numeric"
26582
26652
  });
26583
26653
  const autoName = `Campaign ${formattedDate} ${formattedTime}`;
26654
+ const autoDescription = `New one time campaign created on ${formattedDate} at ${formattedTime}`;
26584
26655
  setAutomationState((prevState) => ({
26585
26656
  ...prevState,
26586
- name: autoName
26657
+ name: autoName,
26658
+ description: autoDescription
26587
26659
  }));
26588
26660
  }
26589
26661
  }, [automationState]);
@@ -26597,7 +26669,8 @@ const CreateAutomationModal = ({
26597
26669
  setStartedCreating(true);
26598
26670
  const params = {
26599
26671
  name: automationState.name,
26600
- type: automationState.type
26672
+ type: automationState.type,
26673
+ description: automationState.description
26601
26674
  };
26602
26675
  createAutomation2(params, {
26603
26676
  onSuccess: async (response) => {
@@ -26626,6 +26699,7 @@ const CreateAutomationModal = ({
26626
26699
  onSettled: () => {
26627
26700
  setAutomationState({
26628
26701
  name: void 0,
26702
+ description: void 0,
26629
26703
  type: void 0
26630
26704
  });
26631
26705
  }
@@ -26647,7 +26721,7 @@ const CreateAutomationModal = ({
26647
26721
  }
26648
26722
  ) }, "choose-automation-type"),
26649
26723
  currentStep === CreateAutomationModalStep.SetAutomationName && automationState.type && /* @__PURE__ */ jsx(BlurDiv, { children: /* @__PURE__ */ jsx(
26650
- SetAutomationName,
26724
+ SetAutomationNameAndDescription,
26651
26725
  {
26652
26726
  iconDefinitions: finalIconDefinitions,
26653
26727
  selectedType: automationState.type,
@@ -26657,7 +26731,14 @@ const CreateAutomationModal = ({
26657
26731
  name
26658
26732
  });
26659
26733
  },
26660
- automationName: automationState.name ?? ""
26734
+ automationName: automationState.name ?? "",
26735
+ setAutomationDescription: (description2) => {
26736
+ setAutomationState({
26737
+ ...automationState,
26738
+ description: description2
26739
+ });
26740
+ },
26741
+ automationDescription: automationState.description ?? ""
26661
26742
  }
26662
26743
  ) }, "set-automation-name")
26663
26744
  ] }),
@@ -33842,23 +33923,6 @@ const HeaderActions = memo$1(
33842
33923
  ] }) });
33843
33924
  }
33844
33925
  );
33845
- const Input = React.forwardRef(
33846
- ({ className: className2, type, ...props }, ref) => {
33847
- return /* @__PURE__ */ jsx(
33848
- "input",
33849
- {
33850
- type,
33851
- className: cn$1(
33852
- "flex h-9 w-full rounded-md border border-input bg-transparent px-3 py-1 text-base shadow-sm transition-colors file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",
33853
- className2
33854
- ),
33855
- ref,
33856
- ...props
33857
- }
33858
- );
33859
- }
33860
- );
33861
- Input.displayName = "Input";
33862
33926
  const SearchBar = memo$1(
33863
33927
  ({
33864
33928
  searchQuery,
@@ -45919,20 +45983,6 @@ const useMe = () => {
45919
45983
  });
45920
45984
  return query;
45921
45985
  };
45922
- const Textarea = React.forwardRef(({ className: className2, ...props }, ref) => {
45923
- return /* @__PURE__ */ jsx(
45924
- "textarea",
45925
- {
45926
- className: cn$1(
45927
- "flex min-h-[60px] w-full rounded-md border border-input bg-transparent px-3 py-2 text-base shadow-sm placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",
45928
- className2
45929
- ),
45930
- ref,
45931
- ...props
45932
- }
45933
- );
45934
- });
45935
- Textarea.displayName = "Textarea";
45936
45986
  const SMSPreview = ({ automation, iconDefinitions, mergeFieldsResponse }) => {
45937
45987
  const [isUpdating, setIsUpdating] = useState(false);
45938
45988
  const _getCommunicationGroupFromAutomation = useCallback(() => {
@@ -48297,29 +48347,36 @@ const ViewAutomationHeaderContainer = ({
48297
48347
  /* @__PURE__ */ jsx(DropdownMenuItem, { onClick: handleDuplicateAutomation, children: "Duplicate" })
48298
48348
  ] })
48299
48349
  ] });
48300
- const renderAutomationDetails = () => /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-2 gap-x-8 gap-y-4", children: [
48301
- /* @__PURE__ */ jsxs("div", { children: [
48350
+ const renderAutomationDetails = () => /* @__PURE__ */ jsx("div", { className: "@container", children: /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-1 @sm:grid-cols-2 gap-6", children: [
48351
+ /* @__PURE__ */ jsxs("div", { className: "min-w-[200px]", children: [
48302
48352
  /* @__PURE__ */ jsx("div", { className: "text-sm text-gray-600", children: "Name" }),
48303
- /* @__PURE__ */ jsx("div", { className: "font-medium", children: automation.name })
48353
+ /* @__PURE__ */ jsx("div", { className: "font-medium truncate", children: automation.name })
48354
+ ] }),
48355
+ automation.description && /* @__PURE__ */ jsxs("div", { className: "", children: [
48356
+ /* @__PURE__ */ jsx("div", { className: "text-sm text-gray-600", children: "Description" }),
48357
+ /* @__PURE__ */ jsx("div", { className: "font-medium whitespace-pre-wrap", children: automation.description })
48304
48358
  ] }),
48305
48359
  /* @__PURE__ */ jsxs("div", { children: [
48306
48360
  /* @__PURE__ */ jsx("div", { className: "text-sm text-gray-600", children: "Date Created" }),
48307
48361
  /* @__PURE__ */ jsx("div", { className: "font-medium", children: format$1(new Date(automation.created_at), "h:mma MM/dd/yy") })
48308
48362
  ] }),
48309
- automation.trigger_type === AutomationTriggerType.ONE_TIME && isOneTimeTriggerMetadata(automation.trigger_metadata) && automation.trigger_metadata.scheduled_at && /* @__PURE__ */ jsxs(Fragment, { children: [
48310
- /* @__PURE__ */ jsxs("div", { children: [
48311
- /* @__PURE__ */ jsx("div", { className: "text-sm text-gray-600", children: "Type" }),
48312
- /* @__PURE__ */ jsx("div", { className: "font-medium", children: "One Time" })
48313
- ] }),
48314
- /* @__PURE__ */ jsxs("div", { children: [
48315
- /* @__PURE__ */ jsx("div", { className: "text-sm text-gray-600", children: "Scheduled For" }),
48316
- /* @__PURE__ */ jsx("div", { className: "font-medium", children: format$1(
48317
- new Date(automation.trigger_metadata.scheduled_at),
48318
- "h:mma MM/dd/yy"
48319
- ) })
48320
- ] })
48363
+ automation.trigger_type === AutomationTriggerType.ONE_TIME && isOneTimeTriggerMetadata(automation.trigger_metadata) && /* @__PURE__ */ jsxs("div", { children: [
48364
+ /* @__PURE__ */ jsx("div", { className: "text-sm text-gray-600", children: "Type" }),
48365
+ /* @__PURE__ */ jsx("div", { className: "font-medium", children: "One Time" })
48366
+ ] }),
48367
+ automation.trigger_type === AutomationTriggerType.TRIGGER_BASED && isTriggerBasedTriggerMetadata(automation.trigger_metadata) && /* @__PURE__ */ jsxs("div", { children: [
48368
+ /* @__PURE__ */ jsx("div", { className: "text-sm text-gray-600", children: "Type" }),
48369
+ /* @__PURE__ */ jsx("div", { className: "font-medium", children: "Trigger Based" })
48370
+ ] }),
48371
+ /* @__PURE__ */ jsx("div", { className: "col-span-1 @sm:col-span-2", children: /* @__PURE__ */ jsx("div", { className: "border-t border-gray-200" }) }),
48372
+ automation.trigger_type === AutomationTriggerType.ONE_TIME && isOneTimeTriggerMetadata(automation.trigger_metadata) && automation.trigger_metadata.scheduled_at && /* @__PURE__ */ jsxs("div", { children: [
48373
+ /* @__PURE__ */ jsx("div", { className: "text-sm text-gray-600", children: "Scheduled For" }),
48374
+ /* @__PURE__ */ jsx("div", { className: "font-medium", children: format$1(
48375
+ new Date(automation.trigger_metadata.scheduled_at),
48376
+ "h:mma MM/dd/yy"
48377
+ ) })
48321
48378
  ] })
48322
- ] });
48379
+ ] }) });
48323
48380
  return /* @__PURE__ */ jsxs(Fragment, { children: [
48324
48381
  renderEditAutomationDialog(),
48325
48382
  renderCancelAutomationDialog(),