@retailcrm/embed-ui-v1-components 0.5.13 → 0.5.15

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/host.cjs CHANGED
@@ -86,13 +86,18 @@ const _sfc_main$i = /* @__PURE__ */ vue.defineComponent({
86
86
  };
87
87
  }
88
88
  });
89
- const isURL = (href) => {
89
+ const isURL = (href, loose = true) => {
90
90
  try {
91
- const normalizedHref = href.includes("://") ? href : `http://${href}`;
92
- const url = new URL(normalizedHref);
93
- const urlPattern = /^(https?:\/\/)?([a-zA-Z0-9-]+\.)+[a-zA-Z]{2,}(\S*)$/;
94
- return urlPattern.test(url.href);
91
+ const url = new URL(href);
92
+ return /^(https?:\/\/)?([a-zA-Z0-9-]+\.)+[a-zA-Z]{2,}(\S*)$/.test(url.href);
95
93
  } catch {
94
+ if (loose) {
95
+ if (!href.startsWith("/")) return false;
96
+ return [
97
+ href.includes("://") ? href : `https://${href}`,
98
+ `https://example.com${href}`
99
+ ].some((href2) => isURL(href2, false));
100
+ }
96
101
  return false;
97
102
  }
98
103
  };
package/dist/host.css CHANGED
@@ -1,4 +1,5 @@
1
1
  .ui-v1-avatar {
2
+ display: inline-block;
2
3
  background-color: #E9ECEE;
3
4
  border-radius: 50%;
4
5
  position: relative;
package/dist/host.js CHANGED
@@ -84,13 +84,18 @@ const _sfc_main$i = /* @__PURE__ */ defineComponent({
84
84
  };
85
85
  }
86
86
  });
87
- const isURL = (href) => {
87
+ const isURL = (href, loose = true) => {
88
88
  try {
89
- const normalizedHref = href.includes("://") ? href : `http://${href}`;
90
- const url = new URL(normalizedHref);
91
- const urlPattern = /^(https?:\/\/)?([a-zA-Z0-9-]+\.)+[a-zA-Z]{2,}(\S*)$/;
92
- return urlPattern.test(url.href);
89
+ const url = new URL(href);
90
+ return /^(https?:\/\/)?([a-zA-Z0-9-]+\.)+[a-zA-Z]{2,}(\S*)$/.test(url.href);
93
91
  } catch {
92
+ if (loose) {
93
+ if (!href.startsWith("/")) return false;
94
+ return [
95
+ href.includes("://") ? href : `https://${href}`,
96
+ `https://example.com${href}`
97
+ ].some((href2) => isURL(href2, false));
98
+ }
94
99
  return false;
95
100
  }
96
101
  };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@retailcrm/embed-ui-v1-components",
3
3
  "type": "module",
4
- "version": "0.5.13",
4
+ "version": "0.5.15",
5
5
  "license": "MIT",
6
6
  "author": "RetailDriverLLC <integration@retailcrm.ru>",
7
7
  "repository": "git@github.com:retailcrm/embed-ui.git",