@saasquatch/vanilla-components 1.4.2-1 → 1.4.3

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.
Files changed (29) hide show
  1. package/dist/cjs/{WidgetHost-7c65e2c5.js → WidgetHost-71b013eb.js} +2 -2
  2. package/dist/cjs/sqh-close-button.cjs.entry.js +1 -1
  3. package/dist/cjs/sqh-copy-button_12.cjs.entry.js +1537 -1287
  4. package/dist/cjs/sqh-referral-code.cjs.entry.js +1 -1
  5. package/dist/collection/components/text-component/text-component.js +4 -4
  6. package/dist/collection/services/WidgetHost.js +2 -2
  7. package/dist/collection/utilities.js +12 -1
  8. package/dist/esm/{WidgetHost-b09e0d27.js → WidgetHost-9c337319.js} +2 -2
  9. package/dist/esm/sqh-close-button.entry.js +1 -1
  10. package/dist/esm/sqh-copy-button_12.entry.js +1537 -1287
  11. package/dist/esm/sqh-referral-code.entry.js +1 -1
  12. package/dist/esm-es5/{WidgetHost-b09e0d27.js → WidgetHost-9c337319.js} +2 -2
  13. package/dist/esm-es5/sqh-close-button.entry.js +1 -1
  14. package/dist/esm-es5/sqh-copy-button_12.entry.js +1401 -828
  15. package/dist/esm-es5/sqh-referral-code.entry.js +1 -1
  16. package/dist/types/utilities.d.ts +10 -1
  17. package/dist/widget-components/{p-c1c81a3b.entry.js → p-366f1663.entry.js} +1 -1
  18. package/dist/widget-components/{p-d6bde96f.entry.js → p-54ea7a00.entry.js} +1 -1
  19. package/dist/widget-components/p-5829fc57.system.entry.js +8 -0
  20. package/dist/widget-components/p-58be1132.system.js +1 -1
  21. package/dist/widget-components/{p-37fd6e72.system.js → p-8e232564.system.js} +1 -1
  22. package/dist/widget-components/{p-1a19f961.system.entry.js → p-b17efca4.system.entry.js} +1 -1
  23. package/dist/widget-components/p-b9ae08a2.entry.js +149 -0
  24. package/dist/widget-components/{p-e1d2fd8f.system.entry.js → p-c8bc8c77.system.entry.js} +1 -1
  25. package/dist/widget-components/{p-5f2ae286.js → p-edd43dbc.js} +2 -2
  26. package/dist/widget-components/widget-components.esm.js +1 -1
  27. package/package.json +20 -29
  28. package/dist/widget-components/p-2e323fe9.system.entry.js +0 -8
  29. package/dist/widget-components/p-7c848114.entry.js +0 -149
@@ -4,7 +4,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  const index = require('./index-deb40352.js');
6
6
  require('./_commonjsHelpers-ac2d0785.js');
7
- const WidgetHost = require('./WidgetHost-7c65e2c5.js');
7
+ const WidgetHost = require('./WidgetHost-71b013eb.js');
8
8
 
9
9
  const referralCodeCss = "sqh-referral-code{display:inline}sqh-referral-code span{font-family:inherit;font-size:inherit;color:inherit;overflow-wrap:break-word}";
10
10
 
@@ -1,6 +1,7 @@
1
1
  import { h, Component, Prop, Element } from "@stencil/core";
2
2
  import { css } from "emotion";
3
- import marked from "marked";
3
+ import { marked } from "marked";
4
+ import { isUrl } from "../../utilities";
4
5
  /**
5
6
  * @uiName Text Component
6
7
  * @canvasRenderer always-replace
@@ -10,7 +11,6 @@ import marked from "marked";
10
11
  */
11
12
  export class TextComponent {
12
13
  render() {
13
- const regex = /\b((?:[a-z][\w-]+:(?:\/{1,3}|[a-z0-9%])|www\d{0,3}[.]|[a-z0-9.\-]+[.][a-z]{2,4}\/)(?:[^\s()<>]+|\(([^\s()<>]+|(\([^\s()<>]+\)))*\))+(?:\(([^\s()<>]+|(\([^\s()<>]+\)))*\)|[^\s`!()\[\]{};:'".,<>?«»“”‘’]))/i;
14
14
  const textStyle = css `
15
15
  font-family: ${this.fontfamily || "inherit"};
16
16
  font-size: ${this.fontsize ? this.fontsize + "px" : "inherit"};
@@ -25,14 +25,14 @@ export class TextComponent {
25
25
  `;
26
26
  const divStyle = css `
27
27
  background: ${this.background
28
- ? this.background.match(regex)
28
+ ? isUrl(this.background)
29
29
  ? `url(${this.background}) no-repeat center center;`
30
30
  : this.background
31
31
  : "inherit"};
32
32
  height: ${this.height || "inherit"};
33
33
  background-size: contain;
34
34
  `;
35
- const content = this.ismarkdown ? (h("div", { innerHTML: marked(this.text) })) : (this.text);
35
+ const content = this.ismarkdown ? (h("div", { innerHTML: marked.parse(this.text) })) : (this.text);
36
36
  return (!this.ishidden && (h("div", { class: divStyle },
37
37
  h("p", { class: textStyle }, content))));
38
38
  }
@@ -318,7 +318,7 @@ const API = {
318
318
  $userId: String!
319
319
  $accountId: String!
320
320
  $programId: ID
321
- $engagementMedium: UserEngagementMedium
321
+ $engagementMedium: UserEngagementMedium!
322
322
  ) {
323
323
  user(id: $userId, accountId: $accountId) {
324
324
  shareLink(
@@ -597,7 +597,7 @@ const API = {
597
597
  return this.getClient()
598
598
  .query({
599
599
  query: gql `
600
- query($userId: String!, $accountId: String!, $programId: ID, $engagementMedium: UserEngagementMedium) {
600
+ query($userId: String!, $accountId: String!, $programId: ID, $engagementMedium: UserEngagementMedium!) {
601
601
  user(id: $userId, accountId: $accountId) {
602
602
  ${mediums[0]}:messageLink(programId: $programId, engagementMedium: $engagementMedium, shareMedium: ${mediums[0]})
603
603
  ${mediums[1]}:messageLink(programId: $programId, engagementMedium: $engagementMedium, shareMedium: ${mediums[1]})
@@ -78,4 +78,15 @@ const uuid = function b(a = undefined) {
78
78
  ? (a ^ ((Math.random() * 16) >> (a / 4))).toString(16)
79
79
  : ([1e7] + -1e3 + -4e3 + -8e3 + -1e11).replace(/[018]/g, b);
80
80
  };
81
- export { shadeColor, addClass, removeClass, detectMobileSafari, detectMobileChrome, uuid, };
81
+ /**
82
+ * Decides whether a background value should be treated as an image URL
83
+ * (as opposed to a CSS color). The check is anchored to the start of the
84
+ * value and runs in linear time: an unanchored pattern would rescan the
85
+ * remaining suffix at every word boundary, freezing the widget on long
86
+ * non-URL values (e.g. "a.".repeat(32000) + "!") since it runs
87
+ * synchronously in render(). Embedded URLs are intentionally unsupported.
88
+ */
89
+ const isUrl = (value) => {
90
+ return /^(?:[a-z][\w-]+:(?:\/{1,3}|[a-z0-9%])|(?:\/\/)?(?:www\d{0,3}\.|[a-z0-9-]+(?:\.[a-z0-9-]+)*\.[a-z]{2,4}\/))/i.test(value.trim());
91
+ };
92
+ export { shadeColor, addClass, removeClass, detectMobileSafari, detectMobileChrome, uuid, isUrl, };
@@ -10224,7 +10224,7 @@ const API = {
10224
10224
  $userId: String!
10225
10225
  $accountId: String!
10226
10226
  $programId: ID
10227
- $engagementMedium: UserEngagementMedium
10227
+ $engagementMedium: UserEngagementMedium!
10228
10228
  ) {
10229
10229
  user(id: $userId, accountId: $accountId) {
10230
10230
  shareLink(
@@ -10503,7 +10503,7 @@ const API = {
10503
10503
  return this.getClient()
10504
10504
  .query({
10505
10505
  query: src `
10506
- query($userId: String!, $accountId: String!, $programId: ID, $engagementMedium: UserEngagementMedium) {
10506
+ query($userId: String!, $accountId: String!, $programId: ID, $engagementMedium: UserEngagementMedium!) {
10507
10507
  user(id: $userId, accountId: $accountId) {
10508
10508
  ${mediums[0]}:messageLink(programId: $programId, engagementMedium: $engagementMedium, shareMedium: ${mediums[0]})
10509
10509
  ${mediums[1]}:messageLink(programId: $programId, engagementMedium: $engagementMedium, shareMedium: ${mediums[1]})
@@ -1,6 +1,6 @@
1
1
  import { r as registerInstance, h, g as getElement } from './index-8ea8b6d8.js';
2
2
  import './_commonjsHelpers-1d681858.js';
3
- import { A as API, w as widgetIdent } from './WidgetHost-b09e0d27.js';
3
+ import { A as API, w as widgetIdent } from './WidgetHost-9c337319.js';
4
4
 
5
5
  const closeButtonCss = "sqh-close-button .squatch-header-close{position:absolute;top:4px;right:6px;background:transparent;border:0;color:#4486e1;font-size:12px}sqh-close-button .squatch-header-close:hover{text-decoration:underline}";
6
6