@octaviaflow/core 3.1.0-beta.88 → 3.1.0-beta.90

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
@@ -8080,7 +8080,6 @@ var TimezonePicker = forwardRef32(
8080
8080
  TimezonePicker.displayName = "TimezonePicker";
8081
8081
 
8082
8082
  // src/components/ScheduleBuilder/ScheduleBuilder.tsx
8083
- import "./ScheduleBuilder.module.scss";
8084
8083
  import { jsx as jsx40, jsxs as jsxs40 } from "react/jsx-runtime";
8085
8084
  var FREQUENCY_LABELS = {
8086
8085
  immediate: "Immediately",
@@ -37066,7 +37065,7 @@ var CHANNEL_TYPE_META = {
37066
37065
  whatsapp: {
37067
37066
  label: "WhatsApp",
37068
37067
  hint: "Template messages to a phone number.",
37069
- connected: true,
37068
+ connected: false,
37070
37069
  icon: /* @__PURE__ */ jsx152(ChatLaunchIcon, { size: "sm", "aria-hidden": "true" })
37071
37070
  },
37072
37071
  webhook: {
@@ -37827,9 +37826,12 @@ import { useEffect as useEffect57, useMemo as useMemo41, useState as useState80
37827
37826
  var CONNECTED_CHANNEL_TYPES = [
37828
37827
  "slack",
37829
37828
  "teams",
37830
- "google_chat",
37831
- "whatsapp"
37829
+ "google_chat"
37832
37830
  ];
37831
+ function isValidPhoneNumber(value) {
37832
+ const digits = value.replace(/[^\d]/g, "");
37833
+ return /^\+?[\d\s()-]+$/.test(value.trim()) && digits.length >= 8 && digits.length <= 15;
37834
+ }
37833
37835
  var EMAIL_RE = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
37834
37836
  function isValidEmail(value) {
37835
37837
  return EMAIL_RE.test(value.trim());
@@ -37856,6 +37858,10 @@ function validateChannelDraft(draft) {
37856
37858
  if (!draft.url?.trim()) errors.url = "Enter the endpoint URL.";
37857
37859
  else if (!isValidWebhookUrl(draft.url))
37858
37860
  errors.url = "Enter a full URL, starting with https://.";
37861
+ } else if (draft.type === "whatsapp") {
37862
+ if (!draft.target?.trim()) errors.target = "Enter the recipient\u2019s WhatsApp number.";
37863
+ else if (!isValidPhoneNumber(draft.target))
37864
+ errors.target = "Enter a valid number in international format, e.g. +91 98765 43210.";
37859
37865
  }
37860
37866
  return errors;
37861
37867
  }
@@ -38197,6 +38203,23 @@ function NotificationChannelForm({
38197
38203
  disabled: readOnly,
38198
38204
  size
38199
38205
  }
38206
+ ),
38207
+ value.type === "whatsapp" && /* @__PURE__ */ jsx158(
38208
+ Input,
38209
+ {
38210
+ id: `${baseId}-target`,
38211
+ type: "tel",
38212
+ label: TARGET_LABEL.whatsapp ?? "Phone number",
38213
+ placeholder: TARGET_PLACEHOLDER.whatsapp,
38214
+ value: value.target ?? "",
38215
+ onChange: (e) => patch({ target: e.target.value }),
38216
+ onBlur: () => touch("target"),
38217
+ error: Boolean(errorFor("target")),
38218
+ errorMessage: errorText("target"),
38219
+ helperText: "Sent from Octaviaflow\u2019s WhatsApp using the approved template. Include the country code.",
38220
+ disabled: readOnly,
38221
+ size
38222
+ }
38200
38223
  )
38201
38224
  ] }),
38202
38225
  /* @__PURE__ */ jsxs150("fieldset", { className: "ods-notif-channel-form__section", children: [