@octaviaflow/core 3.1.0-beta.89 → 3.1.0-beta.91

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.
package/dist/index.js CHANGED
@@ -30967,7 +30967,13 @@ function SlideoutContent({
30967
30967
  {
30968
30968
  isOpen: open,
30969
30969
  onClose,
30970
- isDismissable: true
30970
+ isDismissable: true,
30971
+ // Don't treat a click inside a PORTALED floating element (Select /
30972
+ // Combobox / MultiSelect / DatePicker / DropdownMenu / ContextMenu — all
30973
+ // marked data-ods-floating and rendered to <body>, i.e. outside this
30974
+ // panel's DOM) as an outside click. Without this, opening a dropdown or
30975
+ // picking an option inside the sheet dismisses the whole sheet.
30976
+ shouldCloseOnInteractOutside: (el) => !el.closest?.("[data-ods-floating]")
30971
30977
  },
30972
30978
  overlayRef
30973
30979
  );
@@ -37065,7 +37071,7 @@ var CHANNEL_TYPE_META = {
37065
37071
  whatsapp: {
37066
37072
  label: "WhatsApp",
37067
37073
  hint: "Template messages to a phone number.",
37068
- connected: true,
37074
+ connected: false,
37069
37075
  icon: /* @__PURE__ */ jsx152(ChatLaunchIcon, { size: "sm", "aria-hidden": "true" })
37070
37076
  },
37071
37077
  webhook: {
@@ -37826,9 +37832,12 @@ import { useEffect as useEffect57, useMemo as useMemo41, useState as useState80
37826
37832
  var CONNECTED_CHANNEL_TYPES = [
37827
37833
  "slack",
37828
37834
  "teams",
37829
- "google_chat",
37830
- "whatsapp"
37835
+ "google_chat"
37831
37836
  ];
37837
+ function isValidPhoneNumber(value) {
37838
+ const digits = value.replace(/[^\d]/g, "");
37839
+ return /^\+?[\d\s()-]+$/.test(value.trim()) && digits.length >= 8 && digits.length <= 15;
37840
+ }
37832
37841
  var EMAIL_RE = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
37833
37842
  function isValidEmail(value) {
37834
37843
  return EMAIL_RE.test(value.trim());
@@ -37855,6 +37864,10 @@ function validateChannelDraft(draft) {
37855
37864
  if (!draft.url?.trim()) errors.url = "Enter the endpoint URL.";
37856
37865
  else if (!isValidWebhookUrl(draft.url))
37857
37866
  errors.url = "Enter a full URL, starting with https://.";
37867
+ } else if (draft.type === "whatsapp") {
37868
+ if (!draft.target?.trim()) errors.target = "Enter the recipient\u2019s WhatsApp number.";
37869
+ else if (!isValidPhoneNumber(draft.target))
37870
+ errors.target = "Enter a valid number in international format, e.g. +91 98765 43210.";
37858
37871
  }
37859
37872
  return errors;
37860
37873
  }
@@ -38196,6 +38209,23 @@ function NotificationChannelForm({
38196
38209
  disabled: readOnly,
38197
38210
  size
38198
38211
  }
38212
+ ),
38213
+ value.type === "whatsapp" && /* @__PURE__ */ jsx158(
38214
+ Input,
38215
+ {
38216
+ id: `${baseId}-target`,
38217
+ type: "tel",
38218
+ label: TARGET_LABEL.whatsapp ?? "Phone number",
38219
+ placeholder: TARGET_PLACEHOLDER.whatsapp,
38220
+ value: value.target ?? "",
38221
+ onChange: (e) => patch({ target: e.target.value }),
38222
+ onBlur: () => touch("target"),
38223
+ error: Boolean(errorFor("target")),
38224
+ errorMessage: errorText("target"),
38225
+ helperText: "Sent from Octaviaflow\u2019s WhatsApp using the approved template. Include the country code.",
38226
+ disabled: readOnly,
38227
+ size
38228
+ }
38199
38229
  )
38200
38230
  ] }),
38201
38231
  /* @__PURE__ */ jsxs150("fieldset", { className: "ods-notif-channel-form__section", children: [