bhl-forms 0.0.83 → 0.0.85

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.
@@ -4675,6 +4675,9 @@ function dbg$1() {
4675
4675
  return;
4676
4676
  console.debug(...arguments);
4677
4677
  }
4678
+ const sleep = (time) => __async(this, null, function* () {
4679
+ return new Promise((resolve2) => setTimeout(resolve2, time));
4680
+ });
4678
4681
  const getCoords$1 = (elem) => {
4679
4682
  let box2 = elem.getBoundingClientRect();
4680
4683
  return {
@@ -5956,8 +5959,10 @@ const dataDefaults = {
5956
5959
  redirect = strSubUrl(redirect, formData);
5957
5960
  }
5958
5961
  redirectTo(redirect);
5962
+ yield sleep(2e3);
5959
5963
  } else if (redirect) {
5960
- yield redirect(formData, node);
5964
+ redirect(formData, node);
5965
+ yield sleep(2e3);
5961
5966
  }
5962
5967
  }),
5963
5968
  stringify: (value) => JSON.stringify(value, null, 2)
@@ -11123,6 +11128,18 @@ function rollbar(type, msg) {
11123
11128
  }
11124
11129
  }
11125
11130
  }
11131
+ function valid_phone(node) {
11132
+ if (!node.value) {
11133
+ return true;
11134
+ }
11135
+ if (node.value.replace(/-/g, "").match(/([0-9])\1{5,9}/)) {
11136
+ return false;
11137
+ }
11138
+ if (node.value.match(/^[0-1]{1}/)) {
11139
+ return false;
11140
+ }
11141
+ return true;
11142
+ }
11126
11143
  function analyticsEvent(event, body) {
11127
11144
  try {
11128
11145
  dbg(body);
@@ -11344,11 +11361,14 @@ const doRedirect = (redirectUrl, newTabUrl) => {
11344
11361
  dbg("redirect:", redirectUrl, "newTab:", newTabUrl);
11345
11362
  redirectTo(redirectUrl);
11346
11363
  };
11347
- const handleRedirect = (formData, node) => __async(this, null, function* () {
11364
+ function isIOS() {
11365
+ return /(iPad|iPhone|iPod)/g.test(navigator.userAgent || "");
11366
+ }
11367
+ const handleRedirect = (formData, node) => {
11348
11368
  try {
11349
11369
  var redirectUrl = getRedirect(formData, node);
11350
11370
  if (redirectUrl && redirectUrl !== "null") {
11351
- if (node && node.props.attrs.popUnder) {
11371
+ if (node && node.props.attrs.popUnder && !isIOS()) {
11352
11372
  var popUnderUrl = node.props.attrs.popUnder;
11353
11373
  const res = openNewTab(redirectUrl);
11354
11374
  if (res !== null) {
@@ -11363,7 +11383,6 @@ const handleRedirect = (formData, node) => __async(this, null, function* () {
11363
11383
  } else {
11364
11384
  doRedirect(redirectUrl, null);
11365
11385
  }
11366
- yield new Promise((resolve2) => setTimeout(resolve2, 2e3));
11367
11386
  } else {
11368
11387
  rollbar("warning", "No redirectUrl found");
11369
11388
  }
@@ -11372,7 +11391,7 @@ const handleRedirect = (formData, node) => __async(this, null, function* () {
11372
11391
  console.warn(msg);
11373
11392
  rollbar("warning", msg);
11374
11393
  }
11375
- });
11394
+ };
11376
11395
  const textClassification = {
11377
11396
  label: "t-block t-mb-3 t-font-semibold t-text-base formkit-invalid:t-text-red-500",
11378
11397
  inner: `
@@ -15800,6 +15819,9 @@ const init = () => {
15800
15819
  inputs: {
15801
15820
  DatePicker: createInput(_sfc_main)
15802
15821
  },
15822
+ rules: {
15823
+ valid_phone
15824
+ },
15803
15825
  config: {
15804
15826
  classes
15805
15827
  }