@saasquatch/vanilla-components 1.3.0-2 → 1.4.0

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 (92) hide show
  1. package/LICENSE +21 -21
  2. package/dist/cjs/{WidgetHost-d7b870ce.js → WidgetHost-71b013eb.js} +615 -615
  3. package/dist/cjs/loader.cjs.js +1 -1
  4. package/dist/cjs/sqh-close-button.cjs.entry.js +25 -25
  5. package/dist/cjs/sqh-copy-button_12.cjs.entry.js +1015 -1148
  6. package/dist/cjs/sqh-referral-code.cjs.entry.js +22 -22
  7. package/dist/cjs/sqh-rewards-actions.cjs.entry.js +26 -26
  8. package/dist/cjs/widget-components.cjs.js +1 -1
  9. package/dist/collection/components/close-button/close-button.js +68 -67
  10. package/dist/collection/components/copy-button/copy-button.js +380 -332
  11. package/dist/collection/components/copy-link-button/copy-link-button.js +230 -203
  12. package/dist/collection/components/global-container/global-container.js +158 -144
  13. package/dist/collection/components/image-component/image-component.js +175 -153
  14. package/dist/collection/components/partner-stat-component/partner-stat-component.js +196 -173
  15. package/dist/collection/components/referral-code/referral-code.js +36 -33
  16. package/dist/collection/components/referral-component/referral-component.js +255 -254
  17. package/dist/collection/components/referral-list/referral-list.js +911 -818
  18. package/dist/collection/components/rewards-actions/rewards-actions.js +105 -104
  19. package/dist/collection/components/share-button/share-button.js +301 -291
  20. package/dist/collection/components/share-button-container/share-button-container.js +2384 -2194
  21. package/dist/collection/components/stat-component/stat-component.js +196 -173
  22. package/dist/collection/components/stats-container/stats-container.js +210 -197
  23. package/dist/collection/components/text-component/text-component.js +304 -264
  24. package/dist/collection/entrypoint.js +34 -32
  25. package/dist/collection/global/global.js +4 -4
  26. package/dist/collection/services/FormatJs.js +15 -15
  27. package/dist/collection/services/WidgetHost.js +621 -621
  28. package/dist/collection/utilities.js +81 -81
  29. package/dist/esm/{WidgetHost-a27e693d.js → WidgetHost-9c337319.js} +615 -615
  30. package/dist/esm/loader.mjs +1 -1
  31. package/dist/esm/polyfills/core-js.js +0 -0
  32. package/dist/esm/polyfills/dom.js +0 -0
  33. package/dist/esm/polyfills/es5-html-element.js +0 -0
  34. package/dist/esm/polyfills/index.js +0 -0
  35. package/dist/esm/polyfills/system.js +0 -0
  36. package/dist/esm/sqh-close-button.entry.js +25 -25
  37. package/dist/esm/sqh-copy-button_12.entry.js +1015 -1148
  38. package/dist/esm/sqh-referral-code.entry.js +22 -22
  39. package/dist/esm/sqh-rewards-actions.entry.js +26 -26
  40. package/dist/esm/widget-components.mjs +1 -1
  41. package/dist/esm-es5/{WidgetHost-a27e693d.js → WidgetHost-9c337319.js} +9432 -9432
  42. package/dist/esm-es5/_commonjsHelpers-1d681858.js +17 -17
  43. package/dist/esm-es5/css-shim-a659079f.js +122 -122
  44. package/dist/esm-es5/dom-4061ceba.js +468 -468
  45. package/dist/esm-es5/en-be593af0.js +1471 -1471
  46. package/dist/esm-es5/index-8ea8b6d8.js +1758 -1758
  47. package/dist/esm-es5/loader.mjs +11 -11
  48. package/dist/esm-es5/sqh-close-button.entry.js +35 -35
  49. package/dist/esm-es5/sqh-copy-button_12.entry.js +9535 -9657
  50. package/dist/esm-es5/sqh-referral-code.entry.js +29 -29
  51. package/dist/esm-es5/sqh-rewards-actions.entry.js +31 -31
  52. package/dist/esm-es5/widget-components.mjs +6 -6
  53. package/dist/types/components/close-button/close-button.d.ts +16 -15
  54. package/dist/types/components/copy-button/copy-button.d.ts +90 -86
  55. package/dist/types/components/copy-link-button/copy-link-button.d.ts +53 -50
  56. package/dist/types/components/global-container/global-container.d.ts +39 -37
  57. package/dist/types/components/image-component/image-component.d.ts +45 -42
  58. package/dist/types/components/partner-stat-component/partner-stat-component.d.ts +51 -44
  59. package/dist/types/components/referral-code/referral-code.d.ts +12 -9
  60. package/dist/types/components/referral-component/referral-component.d.ts +46 -45
  61. package/dist/types/components/referral-list/referral-list.d.ts +234 -211
  62. package/dist/types/components/rewards-actions/rewards-actions.d.ts +25 -24
  63. package/dist/types/components/share-button/share-button.d.ts +77 -75
  64. package/dist/types/components/share-button-container/share-button-container.d.ts +593 -591
  65. package/dist/types/components/stat-component/stat-component.d.ts +48 -44
  66. package/dist/types/components/stats-container/stats-container.d.ts +47 -41
  67. package/dist/types/components/text-component/text-component.d.ts +74 -73
  68. package/dist/types/components.d.ts +722 -536
  69. package/dist/types/global/global.d.ts +4 -4
  70. package/dist/types/saasquatch.d.ts +105 -103
  71. package/dist/types/services/FormatJs.d.ts +7 -7
  72. package/dist/types/services/WidgetHost.d.ts +45 -45
  73. package/dist/types/utilities.d.ts +7 -7
  74. package/dist/widget-components/entrypoint.js +34 -32
  75. package/dist/widget-components/p-24fc4ba9.js +1 -1
  76. package/dist/widget-components/{p-d4b27c72.entry.js → p-366f1663.entry.js} +1 -1
  77. package/dist/widget-components/p-46109683.js +3 -3
  78. package/dist/widget-components/{p-650d012d.entry.js → p-54ea7a00.entry.js} +1 -1
  79. package/dist/widget-components/p-58be1132.system.js +1 -1
  80. package/dist/widget-components/{p-d7059393.entry.js → p-95fe9766.entry.js} +17 -16
  81. package/dist/widget-components/{p-c0cdba77.system.entry.js → p-b17efca4.system.entry.js} +1 -1
  82. package/dist/widget-components/p-c8bc8c77.system.entry.js +1 -0
  83. package/dist/widget-components/p-d1f56be8.system.entry.js +8 -0
  84. package/dist/widget-components/widget-components.esm.js +1 -1
  85. package/docs/raisins.json +1 -1
  86. package/package.json +97 -94
  87. package/readme.md +52 -52
  88. package/CHANGELOG.md +0 -143
  89. package/dist/widget-components/p-908068c2.system.entry.js +0 -1
  90. package/dist/widget-components/p-fba5ea7f.system.entry.js +0 -8
  91. /package/dist/widget-components/{p-9adc7c50.system.js → p-8e232564.system.js} +0 -0
  92. /package/dist/widget-components/{p-9525bf4a.js → p-edd43dbc.js} +0 -0
@@ -4,87 +4,87 @@ Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  const index = require('./index-deb40352.js');
6
6
  const _commonjsHelpers = require('./_commonjsHelpers-ac2d0785.js');
7
- const WidgetHost = require('./WidgetHost-d7b870ce.js');
8
-
9
- /////////////////////////////////////
10
- ////// ////
11
- ///// Color Utility Functions /////
12
- //// //////
13
- /////////////////////////////////////
14
- const cutHex = (hex) => {
15
- return hex.charAt(0) == "#" ? hex.substring(1) : hex;
16
- };
17
- const cutRgb = (rgb) => {
18
- return rgb.substring(4, rgb.length - 1);
19
- };
20
- const hexToRgb = (hex) => {
21
- const noHex = cutHex(hex);
22
- const r = parseInt(noHex.substring(0, 2), 16);
23
- const g = parseInt(noHex.substring(2, 4), 16);
24
- const b = parseInt(noHex.substring(4, 6), 16);
25
- return `rgb(${r}, ${g}, ${b})`;
26
- };
27
- const isHex = (string) => {
28
- return !!string.match(/^#[0-9a-f]{6}$/i);
29
- };
30
- const isRgb = (string) => {
31
- const rgbArray = cutRgb(string).split(", ");
32
- if (rgbArray.length !== 3)
33
- return false;
34
- return rgbArray.every((x) => parseInt(x) >= 0 && parseInt(x) <= 255);
35
- };
36
- const shadeColor = (color, percent) => {
37
- if (!isHex(color) && !isRgb(color))
38
- return;
39
- const rgb = isHex(color) ? hexToRgb(color) : color;
40
- const decimalPercent = percent / 100;
41
- const shadedArray = cutRgb(rgb)
42
- .split(", ")
43
- .map((n) => {
44
- return Math.floor(parseInt(n) * (1 - decimalPercent));
45
- });
46
- return `rgb(${shadedArray.join(", ")})`;
47
- };
48
- /////////////////////
49
- ////// ////
50
- ///// Exports /////
51
- //// //////
52
- /////////////////////
53
- const hasClass = (el, className) => {
54
- if (el.classList)
55
- return el.classList.contains(className);
56
- else
57
- return !!el.className.match(new RegExp("(\\s|^)" + className + "(\\s|$)"));
58
- };
59
- const addClass = (el, className) => {
60
- if (el.classList) {
61
- el.classList.add(className);
62
- }
63
- else if (!hasClass(el, className)) {
64
- el.className += " " + className;
65
- }
66
- };
67
- const removeClass = (el, className) => {
68
- if (el.classList) {
69
- el.classList.remove(className);
70
- }
71
- else if (hasClass(el, className)) {
72
- const reg = new RegExp("(\\s|^)" + className + "(\\s|$)");
73
- el.className = el.className.replace(reg, " ");
74
- }
75
- };
76
- const detectMobileSafari = () => {
77
- return /iP(ad|hone|od).+Version\/[\d\.]+.*Safari/i.test(window.navigator.userAgent);
78
- };
79
- const detectMobileChrome = () => {
80
- return window.navigator.userAgent.match("CriOS");
81
- };
82
- // @ts-ignore
83
- // https://gist.github.com/jed/982883
84
- const uuid = function b(a = undefined) {
85
- return a
86
- ? (a ^ ((Math.random() * 16) >> (a / 4))).toString(16)
87
- : ([1e7] + -1e3 + -4e3 + -8e3 + -1e11).replace(/[018]/g, b);
7
+ const WidgetHost = require('./WidgetHost-71b013eb.js');
8
+
9
+ /////////////////////////////////////
10
+ ////// ////
11
+ ///// Color Utility Functions /////
12
+ //// //////
13
+ /////////////////////////////////////
14
+ const cutHex = (hex) => {
15
+ return hex.charAt(0) == "#" ? hex.substring(1) : hex;
16
+ };
17
+ const cutRgb = (rgb) => {
18
+ return rgb.substring(4, rgb.length - 1);
19
+ };
20
+ const hexToRgb = (hex) => {
21
+ const noHex = cutHex(hex);
22
+ const r = parseInt(noHex.substring(0, 2), 16);
23
+ const g = parseInt(noHex.substring(2, 4), 16);
24
+ const b = parseInt(noHex.substring(4, 6), 16);
25
+ return `rgb(${r}, ${g}, ${b})`;
26
+ };
27
+ const isHex = (string) => {
28
+ return !!string.match(/^#[0-9a-f]{6}$/i);
29
+ };
30
+ const isRgb = (string) => {
31
+ const rgbArray = cutRgb(string).split(", ");
32
+ if (rgbArray.length !== 3)
33
+ return false;
34
+ return rgbArray.every((x) => parseInt(x) >= 0 && parseInt(x) <= 255);
35
+ };
36
+ const shadeColor = (color, percent) => {
37
+ if (!isHex(color) && !isRgb(color))
38
+ return;
39
+ const rgb = isHex(color) ? hexToRgb(color) : color;
40
+ const decimalPercent = percent / 100;
41
+ const shadedArray = cutRgb(rgb)
42
+ .split(", ")
43
+ .map((n) => {
44
+ return Math.floor(parseInt(n) * (1 - decimalPercent));
45
+ });
46
+ return `rgb(${shadedArray.join(", ")})`;
47
+ };
48
+ /////////////////////
49
+ ////// ////
50
+ ///// Exports /////
51
+ //// //////
52
+ /////////////////////
53
+ const hasClass = (el, className) => {
54
+ if (el.classList)
55
+ return el.classList.contains(className);
56
+ else
57
+ return !!el.className.match(new RegExp("(\\s|^)" + className + "(\\s|$)"));
58
+ };
59
+ const addClass = (el, className) => {
60
+ if (el.classList) {
61
+ el.classList.add(className);
62
+ }
63
+ else if (!hasClass(el, className)) {
64
+ el.className += " " + className;
65
+ }
66
+ };
67
+ const removeClass = (el, className) => {
68
+ if (el.classList) {
69
+ el.classList.remove(className);
70
+ }
71
+ else if (hasClass(el, className)) {
72
+ const reg = new RegExp("(\\s|^)" + className + "(\\s|$)");
73
+ el.className = el.className.replace(reg, " ");
74
+ }
75
+ };
76
+ const detectMobileSafari = () => {
77
+ return /iP(ad|hone|od).+Version\/[\d\.]+.*Safari/i.test(window.navigator.userAgent);
78
+ };
79
+ const detectMobileChrome = () => {
80
+ return window.navigator.userAgent.match("CriOS");
81
+ };
82
+ // @ts-ignore
83
+ // https://gist.github.com/jed/982883
84
+ const uuid = function b(a = undefined) {
85
+ return a
86
+ ? (a ^ ((Math.random() * 16) >> (a / 4))).toString(16)
87
+ : ([1e7] + -1e3 + -4e3 + -8e3 + -1e11).replace(/[018]/g, b);
88
88
  };
89
89
 
90
90
  /*
@@ -832,21 +832,6 @@ function stylis_min (W) {
832
832
  return B;
833
833
  }
834
834
 
835
- var weakMemoize = function weakMemoize(func) {
836
- // $FlowFixMe flow doesn't include all non-primitive types as allowed for weakmaps
837
- var cache = new WeakMap();
838
- return function (arg) {
839
- if (cache.has(arg)) {
840
- // $FlowFixMe
841
- return cache.get(arg);
842
- }
843
-
844
- var ret = func(arg);
845
- cache.set(arg, ret);
846
- return ret;
847
- };
848
- };
849
-
850
835
  // https://github.com/thysultan/stylis.js/tree/master/plugins/rule-sheet
851
836
  // inlined to avoid umd wrapper and peerDep warnings/installing stylis
852
837
  // since we use stylis after closure compiler
@@ -921,35 +906,6 @@ var ruleSheet = function ruleSheet(context, content, selectors, parents, line, c
921
906
  }
922
907
  }
923
908
  };
924
- var removeLabel = function removeLabel(context, content) {
925
- if (context === 1 && // charcode for l
926
- content.charCodeAt(0) === 108 && // charcode for b
927
- content.charCodeAt(2) === 98 // this ignores label
928
- ) {
929
- return '';
930
- }
931
- };
932
-
933
- var isBrowser = typeof document !== 'undefined';
934
- var rootServerStylisCache = {};
935
- var getServerStylisCache = isBrowser ? undefined : weakMemoize(function () {
936
- var getCache = weakMemoize(function () {
937
- return {};
938
- });
939
- var prefixTrueCache = {};
940
- var prefixFalseCache = {};
941
- return function (prefix) {
942
- if (prefix === undefined || prefix === true) {
943
- return prefixTrueCache;
944
- }
945
-
946
- if (prefix === false) {
947
- return prefixFalseCache;
948
- }
949
-
950
- return getCache(prefix);
951
- };
952
- });
953
909
 
954
910
  var createCache = function createCache(options) {
955
911
  if (options === undefined) options = {};
@@ -968,7 +924,7 @@ var createCache = function createCache(options) {
968
924
 
969
925
  var container;
970
926
 
971
- if (isBrowser) {
927
+ {
972
928
  container = options.container || document.head;
973
929
  var nodes = document.querySelectorAll("style[data-emotion-" + key + "]");
974
930
  Array.prototype.forEach.call(nodes, function (node) {
@@ -986,7 +942,7 @@ var createCache = function createCache(options) {
986
942
 
987
943
  var _insert;
988
944
 
989
- if (isBrowser) {
945
+ {
990
946
  stylis.use(options.stylisPlugins)(ruleSheet);
991
947
 
992
948
  _insert = function insert(selector, serialized, sheet, shouldCache) {
@@ -999,54 +955,6 @@ var createCache = function createCache(options) {
999
955
  cache.inserted[name] = true;
1000
956
  }
1001
957
  };
1002
- } else {
1003
- stylis.use(removeLabel);
1004
- var serverStylisCache = rootServerStylisCache;
1005
-
1006
- if (options.stylisPlugins || options.prefix !== undefined) {
1007
- stylis.use(options.stylisPlugins); // $FlowFixMe
1008
-
1009
- serverStylisCache = getServerStylisCache(options.stylisPlugins || rootServerStylisCache)(options.prefix);
1010
- }
1011
-
1012
- var getRules = function getRules(selector, serialized) {
1013
- var name = serialized.name;
1014
-
1015
- if (serverStylisCache[name] === undefined) {
1016
- serverStylisCache[name] = stylis(selector, serialized.styles);
1017
- }
1018
-
1019
- return serverStylisCache[name];
1020
- };
1021
-
1022
- _insert = function _insert(selector, serialized, sheet, shouldCache) {
1023
- var name = serialized.name;
1024
- var rules = getRules(selector, serialized);
1025
-
1026
- if (cache.compat === undefined) {
1027
- // in regular mode, we don't set the styles on the inserted cache
1028
- // since we don't need to and that would be wasting memory
1029
- // we return them so that they are rendered in a style tag
1030
- if (shouldCache) {
1031
- cache.inserted[name] = true;
1032
- }
1033
-
1034
- return rules;
1035
- } else {
1036
- // in compat mode, we put the styles on the inserted cache so
1037
- // that emotion-server can pull out the styles
1038
- // except when we don't want to cache it which was in Global but now
1039
- // is nowhere but we don't want to do a major right now
1040
- // and just in case we're going to leave the case here
1041
- // it's also not affecting client side bundle size
1042
- // so it's really not a big deal
1043
- if (shouldCache) {
1044
- cache.inserted[name] = rules;
1045
- } else {
1046
- return rules;
1047
- }
1048
- }
1049
- };
1050
958
  }
1051
959
 
1052
960
  var cache = {
@@ -1395,7 +1303,7 @@ var serializeStyles = function serializeStyles(args, registered, mergedProps) {
1395
1303
  };
1396
1304
  };
1397
1305
 
1398
- var isBrowser$1 = typeof document !== 'undefined';
1306
+ var isBrowser = "object" !== 'undefined';
1399
1307
  function getRegisteredStyles(registered, registeredStyles, classNames) {
1400
1308
  var rawClassName = '';
1401
1309
  classNames.split(' ').forEach(function (className) {
@@ -1419,27 +1327,18 @@ var insertStyles = function insertStyles(cache, serialized, isStringTag) {
1419
1327
  // in node since emotion-server relies on whether a style is in
1420
1328
  // the registered cache to know whether a style is global or not
1421
1329
  // also, note that this check will be dead code eliminated in the browser
1422
- isBrowser$1 === false && cache.compat !== undefined) && cache.registered[className] === undefined) {
1330
+ isBrowser === false ) && cache.registered[className] === undefined) {
1423
1331
  cache.registered[className] = serialized.styles;
1424
1332
  }
1425
1333
 
1426
1334
  if (cache.inserted[serialized.name] === undefined) {
1427
- var stylesForSSR = '';
1428
1335
  var current = serialized;
1429
1336
 
1430
1337
  do {
1431
1338
  var maybeStyles = cache.insert("." + className, current, cache.sheet, true);
1432
1339
 
1433
- if (!isBrowser$1 && maybeStyles !== undefined) {
1434
- stylesForSSR += maybeStyles;
1435
- }
1436
-
1437
1340
  current = current.next;
1438
1341
  } while (current !== undefined);
1439
-
1440
- if (!isBrowser$1 && stylesForSSR.length !== 0) {
1441
- return stylesForSSR;
1442
- }
1443
1342
  }
1444
1343
  };
1445
1344
 
@@ -2552,226 +2451,226 @@ const Clipboard = _commonjsHelpers.unwrapExports(clipboard);
2552
2451
 
2553
2452
  const copyButtonCss = "sqh-copy-button{display:block}sqh-copy-button .sqh-align-button{text-align:center;position:relative;margin:20px 0}sqh-copy-button .sqh-align-button .sqh-copy-button{width:100%;text-align:center;padding:8px;cursor:pointer}sqh-copy-button .sqh-align-button .label{padding:0.2em 0.6em 0.3em;font-size:11px;font-weight:bold;line-height:1;color:#fff;text-align:center;white-space:nowrap;border-radius:0.25em;background-color:#35b21e}sqh-copy-button .sqh-align-button .label:empty{display:none}sqh-copy-button .sqh-align-button .fade{opacity:0;-webkit-transition:opacity 0.15s linear;-o-transition:opacity 0.15s linear;transition:opacity 0.15s linear}sqh-copy-button .sqh-align-button .fade.in{opacity:1}sqh-copy-button .sqh-align-button #squatch-copy-notification{position:absolute;left:215px;bottom:35px;z-index:2}";
2554
2453
 
2555
- const CopyButton = class {
2556
- constructor(hostRef) {
2557
- index.registerInstance(this, hostRef);
2558
- }
2559
- componentWillLoad() {
2560
- if (!this.ishidden) {
2561
- return WidgetHost.API.graphql
2562
- .getFueltankCode(this.rewardkey)
2563
- .then((res) => {
2564
- const fuelTank = res.rewards.data.length > 0
2565
- ? res.rewards.data[0].fuelTankCode
2566
- : null;
2567
- this.fueltankcode =
2568
- fuelTank || res.referredByReferral.referrerUser.referralCode;
2569
- })
2570
- .catch((e) => {
2571
- this.onError(e);
2572
- });
2573
- }
2574
- }
2575
- onError(e) {
2576
- console.log("Error loading via GraphQL.", e);
2577
- }
2578
- notify(clipboardNotification, notificationText) {
2579
- const notification = document.getElementById(clipboardNotification.slice(1));
2580
- notification.textContent = notificationText;
2581
- addClass(notification, "in");
2582
- setTimeout(() => {
2583
- removeClass(notification, "in");
2584
- }, 1400);
2585
- }
2586
- notifySuccess(e) {
2587
- this.notify(e.trigger.dataset.clipboardNotification, this.copysuccess);
2588
- }
2589
- notifyFailure(e) {
2590
- this.notify(e.trigger.dataset.clipboardNotification, this.copyfailure);
2591
- }
2592
- componentDidLoad() {
2593
- const clipboard = new Clipboard("button");
2594
- clipboard.on("success", this.notifySuccess.bind(this));
2595
- clipboard.on("error", this.notifyFailure.bind(this));
2596
- }
2597
- render() {
2598
- const style = css `
2599
- max-width: ${this.width}px;
2600
- background-color: ${this.backgroundcolor};
2601
- border: ${this.backgroundcolor};
2602
- color: ${this.textcolor};
2603
- border-radius: ${this.borderradius}px;
2604
- font-size: ${this.fontsize}px;
2605
-
2606
- &:hover {
2607
- background-color: ${shadeColor(this.backgroundcolor, 10)};
2608
- border-color: ${shadeColor(this.backgroundcolor, 12)};
2609
- color: ${this.textcolor};
2610
- }
2611
-
2612
- &:focus {
2613
- color: ${this.textcolor};
2614
- }
2615
- `;
2616
- const code = css `
2617
- text-align: center;
2618
- font-weight: bold;
2619
- font-size: ${this.codefontsize};
2620
- color: ${this.codefontcolor};
2621
- `;
2622
- const classes = [`sqh-copy-button`, style].join(" ");
2623
- return (!this.ishidden && (index.h("div", null, index.h("div", { class: code }, this.fueltankcode), index.h("div", { class: "sqh-align-button" }, index.h("span", { class: "label fade", id: "squatch-copy-notification" }, this.copysuccess), index.h("button", { class: classes, "data-clipboard-text": this.fueltankcode, "data-clipboard-notification": "#squatch-copy-notification" }, this.text)))));
2624
- }
2625
- };
2454
+ const CopyButton = class {
2455
+ constructor(hostRef) {
2456
+ index.registerInstance(this, hostRef);
2457
+ }
2458
+ componentWillLoad() {
2459
+ if (!this.ishidden) {
2460
+ return WidgetHost.API.graphql
2461
+ .getFueltankCode(this.rewardkey)
2462
+ .then((res) => {
2463
+ const fuelTank = res.rewards.data.length > 0
2464
+ ? res.rewards.data[0].fuelTankCode
2465
+ : null;
2466
+ this.fueltankcode =
2467
+ fuelTank || res.referredByReferral.referrerUser.referralCode;
2468
+ })
2469
+ .catch((e) => {
2470
+ this.onError(e);
2471
+ });
2472
+ }
2473
+ }
2474
+ onError(e) {
2475
+ console.log("Error loading via GraphQL.", e);
2476
+ }
2477
+ notify(clipboardNotification, notificationText) {
2478
+ const notification = document.getElementById(clipboardNotification.slice(1));
2479
+ notification.textContent = notificationText;
2480
+ addClass(notification, "in");
2481
+ setTimeout(() => {
2482
+ removeClass(notification, "in");
2483
+ }, 1400);
2484
+ }
2485
+ notifySuccess(e) {
2486
+ this.notify(e.trigger.dataset.clipboardNotification, this.copysuccess);
2487
+ }
2488
+ notifyFailure(e) {
2489
+ this.notify(e.trigger.dataset.clipboardNotification, this.copyfailure);
2490
+ }
2491
+ componentDidLoad() {
2492
+ const clipboard = new Clipboard("button");
2493
+ clipboard.on("success", this.notifySuccess.bind(this));
2494
+ clipboard.on("error", this.notifyFailure.bind(this));
2495
+ }
2496
+ render() {
2497
+ const style = css `
2498
+ max-width: ${this.width}px;
2499
+ background-color: ${this.backgroundcolor};
2500
+ border: ${this.backgroundcolor};
2501
+ color: ${this.textcolor};
2502
+ border-radius: ${this.borderradius}px;
2503
+ font-size: ${this.fontsize}px;
2504
+
2505
+ &:hover {
2506
+ background-color: ${shadeColor(this.backgroundcolor, 10)};
2507
+ border-color: ${shadeColor(this.backgroundcolor, 12)};
2508
+ color: ${this.textcolor};
2509
+ }
2510
+
2511
+ &:focus {
2512
+ color: ${this.textcolor};
2513
+ }
2514
+ `;
2515
+ const code = css `
2516
+ text-align: center;
2517
+ font-weight: bold;
2518
+ font-size: ${this.codefontsize};
2519
+ color: ${this.codefontcolor};
2520
+ `;
2521
+ const classes = [`sqh-copy-button`, style].join(" ");
2522
+ return (!this.ishidden && (index.h("div", null, index.h("div", { class: code }, this.fueltankcode), index.h("div", { class: "sqh-align-button" }, index.h("span", { class: "label fade", id: "squatch-copy-notification" }, this.copysuccess), index.h("button", { class: classes, "data-clipboard-text": this.fueltankcode, "data-clipboard-notification": "#squatch-copy-notification" }, this.text)))));
2523
+ }
2524
+ };
2626
2525
  CopyButton.style = copyButtonCss;
2627
2526
 
2628
2527
  const copyLinkButtonCss = "sqh-copy-link-button{display:block;text-align:center}sqh-copy-link-button .input-group{padding:8px 0 10px;position:relative;display:table;border-collapse:separate;width:100%;max-width:440px;margin:0 auto}sqh-copy-link-button #squatch-share-link{height:34px;padding:6px 12px;font-size:14px;line-height:1.428571429;border:1px solid #ccc;border-radius:4px 0 0 4px;-webkit-box-shadow:inset 0 1px 1px rgba(0, 0, 0, 0.075);box-shadow:inset 0 1px 1px rgba(0, 0, 0, 0.075);-webkit-transition:border-color ease-in-out 0.15s, box-shadow ease-in-out 0.15s;-o-transition:border-color ease-in-out 0.15s, box-shadow ease-in-out 0.15s;-webkit-transition:border-color ease-in-out 0.15s, -webkit-box-shadow ease-in-out 0.15s;transition:border-color ease-in-out 0.15s, -webkit-box-shadow ease-in-out 0.15s;transition:border-color ease-in-out 0.15s, box-shadow ease-in-out 0.15s;transition:border-color ease-in-out 0.15s, box-shadow ease-in-out 0.15s, -webkit-box-shadow ease-in-out 0.15s;color:#5b6165;cursor:text;position:relative;z-index:2;width:100%;margin-bottom:0;display:table-cell}sqh-copy-link-button .label{padding:0.2em 0.6em 0.3em;font-size:11px;font-weight:bold;line-height:1;color:#fff;text-align:center;white-space:nowrap;border-radius:0.25em;background-color:#737b80}sqh-copy-link-button .label:empty{display:none}sqh-copy-link-button .fade{opacity:0;-webkit-transition:opacity 0.15s linear;-o-transition:opacity 0.15s linear;transition:opacity 0.15s linear}sqh-copy-link-button .fade.in{opacity:1}sqh-copy-link-button #squatch-share-notification{position:absolute;top:16px;right:156px;z-index:2}sqh-copy-link-button .input-group-btn{display:table-cell;width:1%;white-space:nowrap;vertical-align:middle}sqh-copy-link-button .sqh-copy-btn{-ms-touch-action:manipulation;touch-action:manipulation;cursor:pointer;background-image:none;border:1px solid transparent;white-space:nowrap;border-radius:4px;border-bottom-left-radius:0;border-top-left-radius:0;height:34px}sqh-copy-link-button .sqh-copy-btn:focus{outline:0}sqh-copy-link-button .sqh-copy-btn.disabled,sqh-copy-link-button .sqh-copy-btn[disabled],fieldset[disabled] sqh-copy-link-button .sqh-copy-btn{cursor:not-allowed;pointer-events:none;opacity:0.65;-webkit-box-shadow:none;box-shadow:none}sqh-copy-link-button .icon-btn{width:139px;border-left:0;padding-left:0;padding-right:0;position:relative;text-align:left}sqh-copy-link-button .icon-btn:before{content:\"\";position:absolute;top:-1px;left:-3px;bottom:-1px;background:rgba(255, 255, 255, 0.18);width:40px}sqh-copy-link-button .icon-btn .icon{width:42px;margin-right:30px}sqh-copy-link-button .hidden-sm{text-align:center;padding-left:10px;font-size:14px}sqh-copy-link-button .icon-link:before{font-size:1.2em;padding-left:8px}@media (max-width: 499px){sqh-copy-link-button .input-group{max-width:100%}}@media (max-width: 499px){sqh-copy-link-button #squatch-share-notification{right:60px}}@media (max-width: 499px){sqh-copy-link-button .sqh-copy-btn{width:auto}sqh-copy-link-button .sqh-copy-btn .icon{width:39px;margin-right:0;padding-right:8px}}@media (min-width: 0px) and (max-width: 499px){sqh-copy-link-button .hidden-sm{display:none !important}}";
2629
2528
 
2630
- const CopyLinkButton = class {
2631
- constructor(hostRef) {
2632
- index.registerInstance(this, hostRef);
2633
- }
2634
- componentWillLoad() {
2635
- if (!this.ishidden) {
2636
- return WidgetHost.API.graphql
2637
- .getShareLink()
2638
- .then((res) => {
2639
- this.sharelink = res;
2640
- })
2641
- .catch((e) => {
2642
- this.onError(e);
2643
- });
2644
- }
2645
- }
2646
- onError(e) {
2647
- console.log("Error loading via GraphQL.", e);
2648
- }
2649
- notify(clipboardNotification, notificationText) {
2650
- const notification = document.getElementById(clipboardNotification.slice(1));
2651
- notification.textContent = notificationText;
2652
- addClass(notification, "in");
2653
- setTimeout(() => {
2654
- removeClass(notification, "in");
2655
- }, 1400);
2656
- WidgetHost.API.analytics.shareEvent("DIRECT");
2657
- }
2658
- notifySuccess(e) {
2659
- this.notify(e.trigger.dataset.clipboardNotification, this.copysuccess);
2660
- }
2661
- notifyFailure(e) {
2662
- this.notify(e.trigger.dataset.clipboardNotification, this.copyfailure);
2663
- }
2664
- componentDidLoad() {
2665
- const clipboard = new Clipboard("[data-clipboard-target]");
2666
- clipboard.on("success", this.notifySuccess.bind(this));
2667
- clipboard.on("error", this.notifyFailure.bind(this));
2668
- }
2669
- render() {
2670
- const myStyle = css `
2671
- background-color: ${this.buttoncolor};
2672
- border: 1px solid ${this.buttoncolor};
2673
- color: ${this.textcolor};
2674
- font-family: ${"inherit"};
2675
-
2676
- &:hover {
2677
- background: ${shadeColor(this.buttoncolor, 10)};
2678
- border-color: ${shadeColor(this.buttoncolor, 12)};
2679
- color: ${this.textcolor};
2680
- }
2681
-
2682
- &:focus {
2683
- color: ${this.textcolor};
2684
- }
2685
- `;
2686
- const buttonClass = [`sqh-copy-btn icon-btn`, myStyle].join(" ");
2687
- return (!this.ishidden && (index.h("div", { class: "input-group" }, index.h("input", { id: "squatch-share-link", value: this.sharelink, readonly: "readonly" }), index.h("span", { class: "label fade", id: "squatch-share-notification" }, this.copysuccess), index.h("span", { class: "input-group-btn" }, index.h("button", { class: buttonClass, "data-clipboard-target": "#squatch-share-link", "data-clipboard-notification": "#squatch-share-notification" }, index.h("i", { class: "icon icon-link" }), index.h("span", { class: "hidden-sm" }, this.text))))));
2688
- }
2689
- };
2529
+ const CopyLinkButton = class {
2530
+ constructor(hostRef) {
2531
+ index.registerInstance(this, hostRef);
2532
+ }
2533
+ componentWillLoad() {
2534
+ if (!this.ishidden) {
2535
+ return WidgetHost.API.graphql
2536
+ .getShareLink()
2537
+ .then((res) => {
2538
+ this.sharelink = res;
2539
+ })
2540
+ .catch((e) => {
2541
+ this.onError(e);
2542
+ });
2543
+ }
2544
+ }
2545
+ onError(e) {
2546
+ console.log("Error loading via GraphQL.", e);
2547
+ }
2548
+ notify(clipboardNotification, notificationText) {
2549
+ const notification = document.getElementById(clipboardNotification.slice(1));
2550
+ notification.textContent = notificationText;
2551
+ addClass(notification, "in");
2552
+ setTimeout(() => {
2553
+ removeClass(notification, "in");
2554
+ }, 1400);
2555
+ WidgetHost.API.analytics.shareEvent("DIRECT");
2556
+ }
2557
+ notifySuccess(e) {
2558
+ this.notify(e.trigger.dataset.clipboardNotification, this.copysuccess);
2559
+ }
2560
+ notifyFailure(e) {
2561
+ this.notify(e.trigger.dataset.clipboardNotification, this.copyfailure);
2562
+ }
2563
+ componentDidLoad() {
2564
+ const clipboard = new Clipboard("[data-clipboard-target]");
2565
+ clipboard.on("success", this.notifySuccess.bind(this));
2566
+ clipboard.on("error", this.notifyFailure.bind(this));
2567
+ }
2568
+ render() {
2569
+ const myStyle = css `
2570
+ background-color: ${this.buttoncolor};
2571
+ border: 1px solid ${this.buttoncolor};
2572
+ color: ${this.textcolor};
2573
+ font-family: ${"inherit"};
2574
+
2575
+ &:hover {
2576
+ background: ${shadeColor(this.buttoncolor, 10)};
2577
+ border-color: ${shadeColor(this.buttoncolor, 12)};
2578
+ color: ${this.textcolor};
2579
+ }
2580
+
2581
+ &:focus {
2582
+ color: ${this.textcolor};
2583
+ }
2584
+ `;
2585
+ const buttonClass = [`sqh-copy-btn icon-btn`, myStyle].join(" ");
2586
+ return (!this.ishidden && (index.h("div", { class: "input-group" }, index.h("input", { id: "squatch-share-link", value: this.sharelink, readonly: "readonly" }), index.h("span", { class: "label fade", id: "squatch-share-notification" }, this.copysuccess), index.h("span", { class: "input-group-btn" }, index.h("button", { class: buttonClass, "data-clipboard-target": "#squatch-share-link", "data-clipboard-notification": "#squatch-share-notification" }, index.h("i", { class: "icon icon-link" }), index.h("span", { class: "hidden-sm" }, this.text))))));
2587
+ }
2588
+ };
2690
2589
  CopyLinkButton.style = copyLinkButtonCss;
2691
2590
 
2692
2591
  const globalContainerCss = "body{margin:0px;padding:0px;font-family:sans-serif}sqh-global-container{display:block;max-width:500px;margin:0 auto}sqh-global-container *{-webkit-box-sizing:border-box;box-sizing:border-box}sqh-global-container>div{width:100%;display:block;padding:0 10px}sqh-global-container .sqh-attribution{display:inherit;text-align:center;font-size:10px;color:lightgray;text-decoration:none;padding-bottom:10px}sqh-global-container .container-loading{display:none;left:calc(50% - 50px);position:absolute;text-align:center;top:45%;width:100px}sqh-global-container:not(.hydrated) .container-loading{display:block;visibility:visible}sqh-global-container .loading-icon{height:40px;text-align:center;font-size:10px;position:absolute;left:0;width:100%;top:45%;z-index:1000}sqh-global-container .loading-icon-tr .loading-icon{position:relative;top:0}sqh-global-container .loading-icon>div{height:100%;margin:1px;width:6px;display:inline-block;-webkit-animation:sk-stretchdelay 1.2s infinite ease-in-out;animation:sk-stretchdelay 1.2s infinite ease-in-out}sqh-global-container .loading-icon .bar2{-webkit-animation-delay:-1.1s;animation-delay:-1.1s}sqh-global-container .loading-icon .bar3{-webkit-animation-delay:-1s;animation-delay:-1s}sqh-global-container .loading-icon .bar4{-webkit-animation-delay:-0.9s;animation-delay:-0.9s}sqh-global-container .loading-icon .bar5{-webkit-animation-delay:-0.8s;animation-delay:-0.8s}@-webkit-keyframes sk-stretchdelay{0%,40%,100%{-webkit-transform:scaleY(0.4)}20%{-webkit-transform:scaleY(1)}}@keyframes sk-stretchdelay{0%,40%,100%{transform:scaleY(0.4);-webkit-transform:scaleY(0.4)}20%{transform:scaleY(1);-webkit-transform:scaleY(1)}}";
2693
2592
 
2694
- const GlobalContainer = class {
2695
- constructor(hostRef) {
2696
- index.registerInstance(this, hostRef);
2697
- }
2698
- LoadingState(props) {
2699
- const style = css `
2700
- background-color: ${props.loadingcolor || "#439B76"};
2701
- `;
2702
- return (index.h("div", { class: "container-loading" }, index.h("div", { class: "loading-icon" }, index.h("div", { class: `bar1 ${style}` }), index.h("div", { class: `bar2 ${style}` }), index.h("div", { class: `bar3 ${style}` }), index.h("div", { class: `bar4 ${style}` }), index.h("div", { class: `bar5 ${style}` }))));
2703
- }
2704
- render() {
2705
- const style = css `
2706
- background-color: ${this.background};
2707
- font-family: ${this.fontfamily};
2708
- position: relative;
2709
- max-width: ${this.maxwidth};
2710
- `;
2711
- const robotoFont = (index.h("link", { href: "https://fonts.googleapis.com/css?family=Roboto:400,700&display=swap", rel: "stylesheet" }));
2712
- const artifaktFont = (index.h("link", { href: "https://static-dc.autodesk.net/etc/designs/v201903181748/templates-general/structure/fonts/artifakt/clientlibs/artifakt.css", rel: "stylesheet" }));
2713
- return (index.h("div", { class: style }, this.fontfamily == "Roboto" ? robotoFont : "", this.fontfamily == "Artifakt Element" ? artifaktFont : "", index.h("slot", null), this.poweredby ? (index.h("a", { class: "sqh-attribution", href: "https://www.saasquatch.com/?utm_source=app&utm_medium=user-widget&utm_campaign=referral-widget", target: "_blank" }, "Powered By Saasquatch")) : (""), index.h(this.LoadingState, { loadingcolor: this.loadingcolor })));
2714
- }
2715
- };
2593
+ const GlobalContainer = class {
2594
+ constructor(hostRef) {
2595
+ index.registerInstance(this, hostRef);
2596
+ }
2597
+ LoadingState(props) {
2598
+ const style = css `
2599
+ background-color: ${props.loadingcolor || "#439B76"};
2600
+ `;
2601
+ return (index.h("div", { class: "container-loading" }, index.h("div", { class: "loading-icon" }, index.h("div", { class: `bar1 ${style}` }), index.h("div", { class: `bar2 ${style}` }), index.h("div", { class: `bar3 ${style}` }), index.h("div", { class: `bar4 ${style}` }), index.h("div", { class: `bar5 ${style}` }))));
2602
+ }
2603
+ render() {
2604
+ const style = css `
2605
+ background-color: ${this.background};
2606
+ font-family: ${this.fontfamily};
2607
+ position: relative;
2608
+ max-width: ${this.maxwidth};
2609
+ `;
2610
+ const robotoFont = (index.h("link", { href: "https://fonts.googleapis.com/css?family=Roboto:400,700&display=swap", rel: "stylesheet" }));
2611
+ const artifaktFont = (index.h("link", { href: "https://static-dc.autodesk.net/etc/designs/v201903181748/templates-general/structure/fonts/artifakt/clientlibs/artifakt.css", rel: "stylesheet" }));
2612
+ return (index.h("div", { class: style }, this.fontfamily == "Roboto" ? robotoFont : "", this.fontfamily == "Artifakt Element" ? artifaktFont : "", index.h("slot", null), this.poweredby ? (index.h("a", { class: "sqh-attribution", href: "https://impact.com/advocate/", target: "_blank" }, "Powered By Impact.com/Advocate")) : (""), index.h(this.LoadingState, { loadingcolor: this.loadingcolor })));
2613
+ }
2614
+ };
2716
2615
  GlobalContainer.style = globalContainerCss;
2717
2616
 
2718
2617
  const imageComponentCss = "sqh-image-component{display:block}sqh-image-component div{position:relative}sqh-image-component img{max-width:100%;height:auto}";
2719
2618
 
2720
- const ImageComponent = class {
2721
- constructor(hostRef) {
2722
- index.registerInstance(this, hostRef);
2723
- }
2724
- render() {
2725
- const imageString = this.url;
2726
- const alignment = css `
2727
- {
2728
- text-align: ${this.alignment};
2729
- }
2730
- `;
2731
- const myStyle = css `
2732
- {
2733
- width: ${this.width}px;
2734
- border-radius: ${this.borderradius}px;
2735
- ${this.css}
2736
- }
2737
- `;
2738
- return (!this.ishidden && (index.h("div", { class: alignment }, index.h("img", { src: imageString, class: myStyle }))));
2739
- }
2740
- };
2619
+ const ImageComponent = class {
2620
+ constructor(hostRef) {
2621
+ index.registerInstance(this, hostRef);
2622
+ }
2623
+ render() {
2624
+ const imageString = this.url;
2625
+ const alignment = css `
2626
+ {
2627
+ text-align: ${this.alignment};
2628
+ }
2629
+ `;
2630
+ const myStyle = css `
2631
+ {
2632
+ width: ${this.width}px;
2633
+ border-radius: ${this.borderradius}px;
2634
+ ${this.css}
2635
+ }
2636
+ `;
2637
+ return (!this.ishidden && (index.h("div", { class: alignment }, index.h("img", { src: imageString, class: myStyle }))));
2638
+ }
2639
+ };
2741
2640
  ImageComponent.style = imageComponentCss;
2742
2641
 
2743
2642
  const partnerStatComponentCss = "sqh-partner-stat-component{text-align:center;width:140px;float:left}sqh-partner-stat-component>div{padding:10px}sqh-partner-stat-component .stat-value{font-size:20px;line-height:20px;margin-top:20px;margin-bottom:8px;font-weight:300}sqh-partner-stat-component .stat-description{text-transform:uppercase;font-size:12px}@media (max-width: 499px){sqh-partner-stat-component{width:100%;text-align:left;background:#f2f2f2;border:1px solid #ddd}sqh-partner-stat-component:first-child{border-radius:4px 4px 0 0}sqh-partner-stat-component:last-child{border-radius:0 0 4px 4px}}@media (max-width: 499px){sqh-partner-stat-component .stat-value{font-size:22px;float:left;width:60px;text-align:center;margin:0 10px 0 0}}@media (max-width: 499px){sqh-partner-stat-component .stat-description{line-height:20px;padding-left:100px;overflow-wrap:break-word}}";
2744
2643
 
2745
- const PartnerStatComponent = class {
2746
- constructor(hostRef) {
2747
- index.registerInstance(this, hostRef);
2748
- this.statTypeUpdated = index.createEvent(this, "statTypeUpdated", 7);
2749
- this.statAdded = index.createEvent(this, "statAdded", 7);
2750
- }
2751
- componentWillLoad() {
2752
- this.statAddedHandler(this.elem);
2753
- }
2754
- stattypeHandler(newValue, oldValue) {
2755
- if (newValue !== oldValue)
2756
- this.statTypeUpdatedHandler(this.elem);
2757
- }
2758
- statAddedHandler(stat) {
2759
- this.statAdded.emit(stat);
2760
- }
2761
- statTypeUpdatedHandler(stat) {
2762
- this.statTypeUpdated.emit(stat);
2763
- }
2764
- render() {
2765
- const clz = css `
2766
- color: ${this.statcolor};
2767
- `;
2768
- return (!this.ishidden && (index.h("div", { class: clz }, index.h("div", { class: "stat-value" }, this.statvalue), index.h("div", { class: "stat-description" }, this.statdescription))));
2769
- }
2770
- get elem() { return index.getElement(this); }
2771
- static get watchers() { return {
2772
- "stattype": ["stattypeHandler"]
2773
- }; }
2774
- };
2644
+ const PartnerStatComponent = class {
2645
+ constructor(hostRef) {
2646
+ index.registerInstance(this, hostRef);
2647
+ this.statTypeUpdated = index.createEvent(this, "statTypeUpdated", 7);
2648
+ this.statAdded = index.createEvent(this, "statAdded", 7);
2649
+ }
2650
+ componentWillLoad() {
2651
+ this.statAddedHandler(this.elem);
2652
+ }
2653
+ stattypeHandler(newValue, oldValue) {
2654
+ if (newValue !== oldValue)
2655
+ this.statTypeUpdatedHandler(this.elem);
2656
+ }
2657
+ statAddedHandler(stat) {
2658
+ this.statAdded.emit(stat);
2659
+ }
2660
+ statTypeUpdatedHandler(stat) {
2661
+ this.statTypeUpdated.emit(stat);
2662
+ }
2663
+ render() {
2664
+ const clz = css `
2665
+ color: ${this.statcolor};
2666
+ `;
2667
+ return (!this.ishidden && (index.h("div", { class: clz }, index.h("div", { class: "stat-value" }, this.statvalue), index.h("div", { class: "stat-description" }, this.statdescription))));
2668
+ }
2669
+ get elem() { return index.getElement(this); }
2670
+ static get watchers() { return {
2671
+ "stattype": ["stattypeHandler"]
2672
+ }; }
2673
+ };
2775
2674
  PartnerStatComponent.style = partnerStatComponentCss;
2776
2675
 
2777
2676
  var TYPE;
@@ -6967,650 +6866,618 @@ RelativeFormat.thresholds = {
6967
6866
  'month-short': 11 // months to year
6968
6867
  };
6969
6868
 
6970
- const FormatJS = {
6971
- format(msg, values, userLocale) {
6972
- var locale = (userLocale || "en-US").replace("_", "-");
6973
- var format = new IntlMessageFormat(msg, locale);
6974
- return format.format(values);
6975
- },
6976
- formatRelative(value, userLocale) {
6977
- var locale = (userLocale || "en-US").replace("_", "-");
6978
- var relative = new RelativeFormat(locale);
6979
- return relative.format(value);
6980
- },
6869
+ const FormatJS = {
6870
+ format(msg, values, userLocale) {
6871
+ var locale = (userLocale || "en-US").replace("_", "-");
6872
+ var format = new IntlMessageFormat(msg, locale);
6873
+ return format.format(values);
6874
+ },
6875
+ formatRelative(value, userLocale) {
6876
+ var locale = (userLocale || "en-US").replace("_", "-");
6877
+ var relative = new RelativeFormat(locale);
6878
+ return relative.format(value);
6879
+ },
6981
6880
  };
6982
6881
 
6983
6882
  const referralComponentCss = "sqh-referral-component:nth-child(3) .squatch-referrals-row{border-bottom:none}sqh-referral-component .squatch-referrals-row{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;height:80px;border-bottom:1px solid #ececec;max-width:500px;margin:0 auto;padding:0 20px;line-height:1.6}sqh-referral-component .squatch-referrals-row>div:first-of-type{-ms-flex:1;flex:1}sqh-referral-component .squatch-referrals-row .icon{float:left;font-size:32px}sqh-referral-component .squatch-referrals-row .sqh-column-two{padding:10px 0}sqh-referral-component .squatch-referrals-value{width:175px;font-size:16px;float:left;margin:10px 0}sqh-referral-component .squatch-value-contents{font-size:13px;line-height:0px;padding-bottom:25px}sqh-referral-component .squatch-referrals-heading{font-size:16px}sqh-referral-component .squatch-referrals-description{font-size:13px}sqh-referral-component .squatch-customer-note{color:darkslategray;max-width:200px;text-overflow:ellipsis;white-space:nowrap;overflow:hidden}@media (max-width: 499px){sqh-referral-component .squatch-referrals-description{display:none}sqh-referral-component .squatch-referrals-row{padding:0}sqh-referral-component .squatch-referrals-row>div:first-of-type{width:100px;overflow:hidden}}";
6984
6883
 
6985
- const ReferralComponent = class {
6986
- constructor(hostRef) {
6987
- index.registerInstance(this, hostRef);
6988
- }
6989
- getName() {
6990
- const referral = this.referral;
6991
- const referredByReferral = this.referral;
6992
- // Referred User
6993
- if (referral.referredUser) {
6994
- return referral.referredUser.firstName || this.unknownuser;
6995
- }
6996
- // Referrer User
6997
- if (referredByReferral.referrerUser) {
6998
- return referredByReferral.referrerUser.firstName || this.unknownuser;
6999
- }
7000
- return this.unknownuser;
7001
- }
7002
- getIcon() {
7003
- if ((this.referraltype === "converted" || this.referraltype === "referrer") &&
7004
- !this.rewardIsExpired() &&
7005
- !this.rewardIsCancelled()) {
7006
- return `icon-ok-circled`;
7007
- }
7008
- return `icon-attention`;
7009
- }
7010
- getContent(formatVariables) {
7011
- // When reward is expired and Expired Content was set
7012
- if (this.rewardIsExpired() && this.referralvariables.expiredcontent) {
7013
- return FormatJS.format(this.referralvariables.expiredcontent, formatVariables, this.locale);
7014
- }
7015
- // When reward is cancelled and Cancelled Content was set
7016
- if (this.rewardIsCancelled() && this.referralvariables.cancelledcontent) {
7017
- return FormatJS.format(this.referralvariables.cancelledcontent, formatVariables, this.locale);
7018
- }
7019
- if (this.referraltype) {
7020
- return FormatJS.format(this.referralvariables[`${this.referraltype}content`], formatVariables, this.locale);
7021
- }
7022
- return ``;
7023
- }
7024
- rewardIsExpired() {
7025
- const { rewards } = this.referral;
7026
- const hasExpiry = rewards.length == 1 && rewards[0].statuses;
7027
- const isExpired = hasExpiry && rewards[0].statuses.indexOf("EXPIRED") > -1;
7028
- return isExpired;
7029
- }
7030
- rewardIsCancelled() {
7031
- const { rewards } = this.referral;
7032
- const hasStatuses = rewards.length == 1 && rewards[0].statuses;
7033
- const isCancelled = hasStatuses && rewards[0].statuses.indexOf("CANCELLED") > -1;
7034
- return isCancelled;
7035
- }
7036
- rewardIsRedeemed() {
7037
- const { rewards } = this.referral;
7038
- const hasStatuses = rewards.length == 1 && rewards[0].statuses;
7039
- const isRedeemed = hasStatuses && rewards[0].statuses.indexOf("REDEEMED") > -1;
7040
- return isRedeemed;
7041
- }
7042
- getValue() {
7043
- const { rewards } = this.referral;
7044
- const referrer = this.referralvariables.referrervalue;
7045
- const pending = this.referralvariables.pendingvalue;
7046
- // When we have no reward values to show
7047
- if (rewards.length == 0) {
7048
- return this.referraltype === "referrer" ||
7049
- this.referraltype === "converted"
7050
- ? referrer
7051
- : pending;
7052
- }
7053
- // When we want to use the first reward pretty value
7054
- if (rewards.length > 0 && this.referralvariables.usefirstreward) {
7055
- return rewards[rewards.length - 1].prettyValue || rewards[0].prettyValue;
7056
- }
7057
- // Use last reward pretty value
7058
- return rewards[0].prettyValue;
7059
- }
7060
- getValueContent(formatVariables) {
7061
- const { rewards } = this.referral;
7062
- // When the reward is pending and there are no other rewards
7063
- if (!rewards.length)
7064
- return "";
7065
- if (rewards.length == 1) {
7066
- // Expired content only applies when there is 1 reward in the referral
7067
- if (this.rewardIsExpired())
7068
- return FormatJS.format(this.referralvariables.expiredvalue, formatVariables, this.locale);
7069
- // Cancelled content only applies when there is 1 reward in the referral
7070
- if (this.rewardIsCancelled())
7071
- return FormatJS.format(this.referralvariables.cancelledvalue, formatVariables, this.locale);
7072
- // Redeemed content only applies when there is 1 reward in the referral
7073
- if (this.rewardIsRedeemed())
7074
- return FormatJS.format(this.referralvariables.redeemedvalue || "Redeemed", formatVariables, this.locale);
7075
- // Expiry date only shown if there is 1 reward with dateExpires set in the referral
7076
- if (this.referralvariables.showexpiry && rewards[0].dateExpires) {
7077
- const expiryDate = FormatJS.formatRelative(rewards[0].dateExpires, this.locale);
7078
- return FormatJS.format(this.referralvariables.expiresvalue || `Expires ${expiryDate}`, Object.assign(Object.assign({}, formatVariables), { expiryDate }), this.locale);
7079
- }
7080
- return "";
7081
- }
7082
- return FormatJS.format(this.referralvariables.valuecontent, formatVariables, this.locale);
7083
- }
7084
- getNote() {
7085
- const { rewards } = this.referral;
7086
- const note = rewards[0] && rewards[0].meta && rewards[0].meta.message;
7087
- return note || "";
7088
- }
7089
- render() {
7090
- const { dateReferralStarted, rewards } = this.referral;
7091
- const formatVariables = {
7092
- date: FormatJS.formatRelative(dateReferralStarted, this.locale),
7093
- extrarewards: rewards.length - 1,
7094
- };
7095
- const name = this.getName();
7096
- const icon = this.getIcon();
7097
- const content = this.getContent(formatVariables);
7098
- const value = this.getValue();
7099
- const valuecontent = this.getValueContent(formatVariables);
7100
- const customernote = this.getNote();
7101
- return (index.h("div", { class: "squatch-referrals-row" }, index.h("div", null, index.h("div", { class: "squatch-referrals-heading" }, name), index.h("div", { class: "squatch-referrals-description" }, content), this.referralvariables.shownotes && customernote && (index.h("div", { class: "squatch-referrals-description squatch-customer-note", title: customernote }, customernote))), index.h("i", { class: `icon squatch-referrals-icon ${icon} ${this.rewardIsExpired() && "expired"} ${this.rewardIsCancelled() && "cancelled"}` }), index.h("div", { class: "sqh-column-two" }, index.h("div", { class: `squatch-referrals-value ${this.rewardIsCancelled() && "cancelled"} ${rewards.length > 0
7102
- ? this.rewardIsExpired()
7103
- ? "expired"
7104
- : ""
7105
- : this.referraltype === "referrer" ||
7106
- this.referraltype === "converted"
7107
- ? "referrer"
7108
- : "pending"}` }, value), index.h("div", { class: `squatch-value-contents ${this.rewardIsExpired() && "expired"} ${this.rewardIsCancelled() && "cancelled"}` }, valuecontent))));
7109
- }
7110
- };
6884
+ const ReferralComponent = class {
6885
+ constructor(hostRef) {
6886
+ index.registerInstance(this, hostRef);
6887
+ }
6888
+ getName() {
6889
+ const referral = this.referral;
6890
+ const referredByReferral = this.referral;
6891
+ // Referred User
6892
+ if (referral.referredUser) {
6893
+ return referral.referredUser.firstName || this.unknownuser;
6894
+ }
6895
+ // Referrer User
6896
+ if (referredByReferral.referrerUser) {
6897
+ return referredByReferral.referrerUser.firstName || this.unknownuser;
6898
+ }
6899
+ return this.unknownuser;
6900
+ }
6901
+ getIcon() {
6902
+ if ((this.referraltype === "converted" || this.referraltype === "referrer") &&
6903
+ !this.rewardIsExpired() &&
6904
+ !this.rewardIsCancelled()) {
6905
+ return `icon-ok-circled`;
6906
+ }
6907
+ return `icon-attention`;
6908
+ }
6909
+ getContent(formatVariables) {
6910
+ // When reward is expired and Expired Content was set
6911
+ if (this.rewardIsExpired() && this.referralvariables.expiredcontent) {
6912
+ return FormatJS.format(this.referralvariables.expiredcontent, formatVariables, this.locale);
6913
+ }
6914
+ // When reward is cancelled and Cancelled Content was set
6915
+ if (this.rewardIsCancelled() && this.referralvariables.cancelledcontent) {
6916
+ return FormatJS.format(this.referralvariables.cancelledcontent, formatVariables, this.locale);
6917
+ }
6918
+ if (this.referraltype) {
6919
+ return FormatJS.format(this.referralvariables[`${this.referraltype}content`], formatVariables, this.locale);
6920
+ }
6921
+ return ``;
6922
+ }
6923
+ rewardIsExpired() {
6924
+ const { rewards } = this.referral;
6925
+ const hasExpiry = rewards.length == 1 && rewards[0].statuses;
6926
+ const isExpired = hasExpiry && rewards[0].statuses.indexOf("EXPIRED") > -1;
6927
+ return isExpired;
6928
+ }
6929
+ rewardIsCancelled() {
6930
+ const { rewards } = this.referral;
6931
+ const hasStatuses = rewards.length == 1 && rewards[0].statuses;
6932
+ const isCancelled = hasStatuses && rewards[0].statuses.indexOf("CANCELLED") > -1;
6933
+ return isCancelled;
6934
+ }
6935
+ rewardIsRedeemed() {
6936
+ const { rewards } = this.referral;
6937
+ const hasStatuses = rewards.length == 1 && rewards[0].statuses;
6938
+ const isRedeemed = hasStatuses && rewards[0].statuses.indexOf("REDEEMED") > -1;
6939
+ return isRedeemed;
6940
+ }
6941
+ getValue() {
6942
+ const { rewards } = this.referral;
6943
+ const referrer = this.referralvariables.referrervalue;
6944
+ const pending = this.referralvariables.pendingvalue;
6945
+ // When we have no reward values to show
6946
+ if (rewards.length == 0) {
6947
+ return this.referraltype === "referrer" ||
6948
+ this.referraltype === "converted"
6949
+ ? referrer
6950
+ : pending;
6951
+ }
6952
+ // When we want to use the first reward pretty value
6953
+ if (rewards.length > 0 && this.referralvariables.usefirstreward) {
6954
+ return rewards[rewards.length - 1].prettyValue || rewards[0].prettyValue;
6955
+ }
6956
+ // Use last reward pretty value
6957
+ return rewards[0].prettyValue;
6958
+ }
6959
+ getValueContent(formatVariables) {
6960
+ const { rewards } = this.referral;
6961
+ // When the reward is pending and there are no other rewards
6962
+ if (!rewards.length)
6963
+ return "";
6964
+ if (rewards.length == 1) {
6965
+ // Expired content only applies when there is 1 reward in the referral
6966
+ if (this.rewardIsExpired())
6967
+ return FormatJS.format(this.referralvariables.expiredvalue, formatVariables, this.locale);
6968
+ // Cancelled content only applies when there is 1 reward in the referral
6969
+ if (this.rewardIsCancelled())
6970
+ return FormatJS.format(this.referralvariables.cancelledvalue, formatVariables, this.locale);
6971
+ // Redeemed content only applies when there is 1 reward in the referral
6972
+ if (this.rewardIsRedeemed())
6973
+ return FormatJS.format(this.referralvariables.redeemedvalue || "Redeemed", formatVariables, this.locale);
6974
+ // Expiry date only shown if there is 1 reward with dateExpires set in the referral
6975
+ if (this.referralvariables.showexpiry && rewards[0].dateExpires) {
6976
+ const expiryDate = FormatJS.formatRelative(rewards[0].dateExpires, this.locale);
6977
+ return FormatJS.format(this.referralvariables.expiresvalue || `Expires ${expiryDate}`, Object.assign(Object.assign({}, formatVariables), { expiryDate }), this.locale);
6978
+ }
6979
+ return "";
6980
+ }
6981
+ return FormatJS.format(this.referralvariables.valuecontent, formatVariables, this.locale);
6982
+ }
6983
+ getNote() {
6984
+ const { rewards } = this.referral;
6985
+ const note = rewards[0] && rewards[0].meta && rewards[0].meta.message;
6986
+ return note || "";
6987
+ }
6988
+ render() {
6989
+ const { dateReferralStarted, rewards } = this.referral;
6990
+ const formatVariables = {
6991
+ date: FormatJS.formatRelative(dateReferralStarted, this.locale),
6992
+ extrarewards: rewards.length - 1,
6993
+ };
6994
+ const name = this.getName();
6995
+ const icon = this.getIcon();
6996
+ const content = this.getContent(formatVariables);
6997
+ const value = this.getValue();
6998
+ const valuecontent = this.getValueContent(formatVariables);
6999
+ const customernote = this.getNote();
7000
+ return (index.h("div", { class: "squatch-referrals-row" }, index.h("div", null, index.h("div", { class: "squatch-referrals-heading" }, name), index.h("div", { class: "squatch-referrals-description" }, content), this.referralvariables.shownotes && customernote && (index.h("div", { class: "squatch-referrals-description squatch-customer-note", title: customernote }, customernote))), index.h("i", { class: `icon squatch-referrals-icon ${icon} ${this.rewardIsExpired() && "expired"} ${this.rewardIsCancelled() && "cancelled"}` }), index.h("div", { class: "sqh-column-two" }, index.h("div", { class: `squatch-referrals-value ${this.rewardIsCancelled() && "cancelled"} ${rewards.length > 0
7001
+ ? this.rewardIsExpired()
7002
+ ? "expired"
7003
+ : ""
7004
+ : this.referraltype === "referrer" ||
7005
+ this.referraltype === "converted"
7006
+ ? "referrer"
7007
+ : "pending"}` }, value), index.h("div", { class: `squatch-value-contents ${this.rewardIsExpired() && "expired"} ${this.rewardIsCancelled() && "cancelled"}` }, valuecontent))));
7008
+ }
7009
+ };
7111
7010
  ReferralComponent.style = referralComponentCss;
7112
7011
 
7113
7012
  const referralListCss = "sqh-referral-list{display:block}sqh-referral-list .squatch-no-referrals-yet{background:white;border-color:#adadad;border:1px solid;border-color:#cccccc;border-radius:4px;font-size:14px;line-height:20px;margin:5px;padding:6px 12px;width:165px}sqh-referral-list .squatch-referrals-scroll-container{min-height:255px}sqh-referral-list .squatch-referrals-scroll-action-container{display:-ms-flexbox;display:flex;-ms-flex-pack:center;justify-content:center;padding:5px 0}sqh-referral-list .squatch-referrals-scroll-action-container .squatch-referrals-scroll-action{background:white;border:1px solid;border-color:#cccccc;border-radius:4px;cursor:pointer;font-size:14px;line-height:20px;margin:5px;padding:6px 12px;width:120px}sqh-referral-list .squatch-referrals-scroll-action-container .squatch-referrals-scroll-action.disabled{cursor:default;opacity:0.5}sqh-referral-list .squatch-referrals-scroll-action-container .squatch-referrals-scroll-action.disabled:hover{background:white;border-color:#cccccc}sqh-referral-list .squatch-referrals-scroll-action-container .squatch-referrals-scroll-action.disabled:active{border-style:solid}sqh-referral-list .squatch-referrals-scroll-action-container .squatch-referrals-scroll-action:hover{background:#e6e6e6;border-color:#adadad}sqh-referral-list .squatch-referrals-scroll-action-container .squatch-referrals-scroll-action:active,sqh-referral-list .squatch-referrals-scroll-action-container .squatch-referrals-scroll-action:focus{outline:none}";
7114
7013
 
7115
- const ReferralList = class {
7116
- constructor(hostRef) {
7117
- index.registerInstance(this, hostRef);
7118
- this.offset = 0;
7119
- this.loading = true;
7120
- }
7121
- componentWillLoad() {
7122
- if (!this.ishidden) {
7123
- return this.getReferrals(this.showreferrer)
7124
- .then((res) => {
7125
- this.referrals = res.referrals.data;
7126
- this.referredBy = res.referredByReferral;
7127
- this.referralsCount = res.referrals.totalCount;
7128
- this.loading = false;
7129
- this.locale = res.locale;
7130
- })
7131
- .catch((e) => {
7132
- this.onError(e);
7133
- });
7134
- }
7135
- }
7136
- getReferrals(showReferrer, offset = 0) {
7137
- return WidgetHost.API.graphql.getReferrals(showReferrer, offset);
7138
- }
7139
- paginate(offset, event) {
7140
- if (this.loading)
7141
- return null;
7142
- let { referralsCount } = this;
7143
- if (this.showreferrer && this.referredBy)
7144
- referralsCount++;
7145
- if (offset >= referralsCount || offset < 0)
7146
- return null;
7147
- this.loading = true;
7148
- const { target } = event;
7149
- target.innerText = "...";
7150
- this.getReferrals(this.showreferrer, offset).then((res) => {
7151
- target.innerText =
7152
- offset > this.offset ? this.paginatemore : this.paginateless;
7153
- this.referrals = res.referrals.data;
7154
- this.offset = offset;
7155
- this.loading = false;
7156
- });
7157
- }
7158
- onError(e) {
7159
- console.error(e);
7160
- this.loading = false;
7161
- }
7162
- render() {
7163
- let referredByRow;
7164
- let referralsRow;
7165
- const referralvariables = {
7166
- usefirstreward: this.usefirstreward,
7167
- referrercontent: this.referrercontent,
7168
- convertedcontent: this.convertedcontent,
7169
- pendingcontent: this.pendingcontent,
7170
- pendingvalue: this.pendingvalue,
7171
- referrervalue: this.referrervalue,
7172
- valuecontent: this.valuecontent,
7173
- expiredcontent: this.expiredcontent,
7174
- expiredvalue: this.expiredvalue,
7175
- expiresvalue: this.expiresvalue,
7176
- redeemedvalue: this.redeemedvalue,
7177
- showexpiry: this.showexpiry,
7178
- shownotes: this.shownotes,
7179
- cancelledvalue: this.cancelledvalue,
7180
- cancelledcontent: this.cancelledcontent,
7181
- };
7182
- if (this.referrals) {
7183
- referralsRow = this.referrals.map((ref) => {
7184
- const referraltype = ref.rewards.length > 0 || ref.dateConverted ? "converted" : "pending";
7185
- return (index.h("sqh-referral-component", { id: uuid(), referral: ref, referralvariables: referralvariables, referraltype: referraltype, unknownuser: this.unknownuser, locale: this.internationalization ? this.locale : "en-US" }));
7186
- });
7187
- }
7188
- if (this.referrals.length < 3 && this.referredBy && this.showreferrer) {
7189
- referredByRow = (index.h("sqh-referral-component", { id: uuid(), referral: this.referredBy, referralvariables: referralvariables, referraltype: "referrer", unknownuser: this.unknownuser, locale: this.internationalization ? this.locale : "en-US" }));
7190
- }
7191
- const clz = css `
7192
- .squatch-referrals-icon.icon-ok-circled {
7193
- color: ${this.rewardcolor};
7194
- }
7195
- .squatch-referrals-icon.icon-attention {
7196
- color: ${this.pendingcolor};
7197
- }
7198
- .squatch-referrals-value {
7199
- color: ${this.rewardcolor};
7200
- }
7201
- .squatch-referrals-value.pending {
7202
- color: ${this.pendingcolor};
7203
- }
7204
- .squatch-referrals-value.referrer {
7205
- color: ${this.rewardcolor};
7206
- }
7207
- .squatch-referrals-value.expired {
7208
- color: ${this.expiredcolor};
7209
- }
7210
- .squatch-value-contents.expired {
7211
- color: ${this.expiredcolor};
7212
- }
7213
- .squatch-referrals-icon.icon-attention.expired {
7214
- color: ${this.expiredcolor};
7215
- }
7216
- .squatch-referrals-value.cancelled {
7217
- color: ${this.cancelledcolor};
7218
- }
7219
- .squatch-value-contents.cancelled {
7220
- color: ${this.cancelledcolor};
7221
- }
7222
- .squatch-referrals-icon.icon-attention.cancelled {
7223
- color: ${this.cancelledcolor};
7224
- }
7225
- .squatch-referrals-heading {
7226
- color: ${this.referralnamecolor};
7227
- }
7228
- .squatch-referrals-description,
7229
- .squatch-referrals-value-content {
7230
- color: ${this.referraltextcolor};
7231
- }
7232
- .squatch-customer-note {
7233
- color: ${this.customernotecolor || "darkslategray"};
7234
- }
7235
- .squatch-referrals-scroll-action {
7236
- font-family: ${"inherit"};
7237
- }
7238
- `;
7239
- const totalReferralsCount = this.showreferrer && this.referredBy
7240
- ? this.referralsCount + 1
7241
- : this.referralsCount;
7242
- return !this.ishidden && totalReferralsCount > 0 ? (
7243
- // Referral List when not hidden and 1 or more referrals
7244
- index.h("div", { class: `squatch-referrals ${clz}` }, index.h("div", { class: "squatch-referrals-scroll-container" }, referralsRow, referredByRow), index.h("div", { class: "squatch-referrals-scroll-action-container" }, index.h("button", { class: `
7245
- squatch-referrals-scroll-action previous ${this.loading
7246
- ? "disabled"
7247
- : this.offset === 0
7248
- ? "disabled"
7249
- : ""}
7250
- `, onClick: (event) => this.paginate(this.offset - 3, event) }, this.paginateless), index.h("button", { class: `
7251
- squatch-referrals-scroll-action view-more ${this.loading
7252
- ? "disabled"
7253
- : this.showreferrer && this.referredBy
7254
- ? this.offset >= this.referralsCount - 2
7255
- ? "disabled"
7256
- : ""
7257
- : this.offset >= this.referralsCount - 3
7258
- ? "disabled"
7259
- : ""}
7260
- `, "view-more": true, onClick: (event) => this.paginate(this.offset + 3, event) }, this.paginatemore)))) : (
7261
- // 'No Referrals Yet' button if this.referralCount < 1
7262
- index.h("div", { class: "squatch-referrals-scroll-action-container" }, index.h("button", { disabled: true, class: "squatch-no-referrals-yet" }, this.noreferralsyet)));
7263
- }
7264
- };
7014
+ const ReferralList = class {
7015
+ constructor(hostRef) {
7016
+ index.registerInstance(this, hostRef);
7017
+ this.offset = 0;
7018
+ this.loading = true;
7019
+ }
7020
+ componentWillLoad() {
7021
+ if (!this.ishidden) {
7022
+ return this.getReferrals(this.showreferrer)
7023
+ .then((res) => {
7024
+ this.referrals = res.referrals.data;
7025
+ this.referredBy = res.referredByReferral;
7026
+ this.referralsCount = res.referrals.totalCount;
7027
+ this.loading = false;
7028
+ this.locale = res.locale;
7029
+ })
7030
+ .catch((e) => {
7031
+ this.onError(e);
7032
+ });
7033
+ }
7034
+ }
7035
+ getReferrals(showReferrer, offset = 0) {
7036
+ return WidgetHost.API.graphql.getReferrals(showReferrer, offset);
7037
+ }
7038
+ paginate(offset, event) {
7039
+ if (this.loading)
7040
+ return null;
7041
+ let { referralsCount } = this;
7042
+ if (this.showreferrer && this.referredBy)
7043
+ referralsCount++;
7044
+ if (offset >= referralsCount || offset < 0)
7045
+ return null;
7046
+ this.loading = true;
7047
+ const { target } = event;
7048
+ target.innerText = "...";
7049
+ this.getReferrals(this.showreferrer, offset).then((res) => {
7050
+ target.innerText =
7051
+ offset > this.offset ? this.paginatemore : this.paginateless;
7052
+ this.referrals = res.referrals.data;
7053
+ this.offset = offset;
7054
+ this.loading = false;
7055
+ });
7056
+ }
7057
+ onError(e) {
7058
+ console.error(e);
7059
+ this.loading = false;
7060
+ }
7061
+ render() {
7062
+ let referredByRow;
7063
+ let referralsRow;
7064
+ const referralvariables = {
7065
+ usefirstreward: this.usefirstreward,
7066
+ referrercontent: this.referrercontent,
7067
+ convertedcontent: this.convertedcontent,
7068
+ pendingcontent: this.pendingcontent,
7069
+ pendingvalue: this.pendingvalue,
7070
+ referrervalue: this.referrervalue,
7071
+ valuecontent: this.valuecontent,
7072
+ expiredcontent: this.expiredcontent,
7073
+ expiredvalue: this.expiredvalue,
7074
+ expiresvalue: this.expiresvalue,
7075
+ redeemedvalue: this.redeemedvalue,
7076
+ showexpiry: this.showexpiry,
7077
+ shownotes: this.shownotes,
7078
+ cancelledvalue: this.cancelledvalue,
7079
+ cancelledcontent: this.cancelledcontent,
7080
+ };
7081
+ if (this.referrals) {
7082
+ referralsRow = this.referrals.map((ref) => {
7083
+ const referraltype = ref.rewards.length > 0 || ref.dateConverted ? "converted" : "pending";
7084
+ return (index.h("sqh-referral-component", { id: uuid(), referral: ref, referralvariables: referralvariables, referraltype: referraltype, unknownuser: this.unknownuser, locale: this.internationalization ? this.locale : "en-US" }));
7085
+ });
7086
+ }
7087
+ if (this.referrals.length < 3 && this.referredBy && this.showreferrer) {
7088
+ referredByRow = (index.h("sqh-referral-component", { id: uuid(), referral: this.referredBy, referralvariables: referralvariables, referraltype: "referrer", unknownuser: this.unknownuser, locale: this.internationalization ? this.locale : "en-US" }));
7089
+ }
7090
+ const clz = css `
7091
+ .squatch-referrals-icon.icon-ok-circled {
7092
+ color: ${this.rewardcolor};
7093
+ }
7094
+ .squatch-referrals-icon.icon-attention {
7095
+ color: ${this.pendingcolor};
7096
+ }
7097
+ .squatch-referrals-value {
7098
+ color: ${this.rewardcolor};
7099
+ }
7100
+ .squatch-referrals-value.pending {
7101
+ color: ${this.pendingcolor};
7102
+ }
7103
+ .squatch-referrals-value.referrer {
7104
+ color: ${this.rewardcolor};
7105
+ }
7106
+ .squatch-referrals-value.expired {
7107
+ color: ${this.expiredcolor};
7108
+ }
7109
+ .squatch-value-contents.expired {
7110
+ color: ${this.expiredcolor};
7111
+ }
7112
+ .squatch-referrals-icon.icon-attention.expired {
7113
+ color: ${this.expiredcolor};
7114
+ }
7115
+ .squatch-referrals-value.cancelled {
7116
+ color: ${this.cancelledcolor};
7117
+ }
7118
+ .squatch-value-contents.cancelled {
7119
+ color: ${this.cancelledcolor};
7120
+ }
7121
+ .squatch-referrals-icon.icon-attention.cancelled {
7122
+ color: ${this.cancelledcolor};
7123
+ }
7124
+ .squatch-referrals-heading {
7125
+ color: ${this.referralnamecolor};
7126
+ }
7127
+ .squatch-referrals-description,
7128
+ .squatch-referrals-value-content {
7129
+ color: ${this.referraltextcolor};
7130
+ }
7131
+ .squatch-customer-note {
7132
+ color: ${this.customernotecolor || "darkslategray"};
7133
+ }
7134
+ .squatch-referrals-scroll-action {
7135
+ font-family: ${"inherit"};
7136
+ }
7137
+ `;
7138
+ const totalReferralsCount = this.showreferrer && this.referredBy
7139
+ ? this.referralsCount + 1
7140
+ : this.referralsCount;
7141
+ return !this.ishidden && totalReferralsCount > 0 ? (
7142
+ // Referral List when not hidden and 1 or more referrals
7143
+ index.h("div", { class: `squatch-referrals ${clz}` }, index.h("div", { class: "squatch-referrals-scroll-container" }, referralsRow, referredByRow), index.h("div", { class: "squatch-referrals-scroll-action-container" }, index.h("button", { class: `
7144
+ squatch-referrals-scroll-action previous ${this.loading
7145
+ ? "disabled"
7146
+ : this.offset === 0
7147
+ ? "disabled"
7148
+ : ""}
7149
+ `, onClick: (event) => this.paginate(this.offset - 3, event) }, this.paginateless), index.h("button", { class: `
7150
+ squatch-referrals-scroll-action view-more ${this.loading
7151
+ ? "disabled"
7152
+ : this.showreferrer && this.referredBy
7153
+ ? this.offset >= this.referralsCount - 2
7154
+ ? "disabled"
7155
+ : ""
7156
+ : this.offset >= this.referralsCount - 3
7157
+ ? "disabled"
7158
+ : ""}
7159
+ `, "view-more": true, onClick: (event) => this.paginate(this.offset + 3, event) }, this.paginatemore)))) : (
7160
+ // 'No Referrals Yet' button if this.referralCount < 1
7161
+ index.h("div", { class: "squatch-referrals-scroll-action-container" }, index.h("button", { disabled: true, class: "squatch-no-referrals-yet" }, this.noreferralsyet)));
7162
+ }
7163
+ };
7265
7164
  ReferralList.style = referralListCss;
7266
7165
 
7267
7166
  const shareButtonCss = "sqh-share-button{display:inline-block}sqh-share-button .squatch-share-btn{display:block;text-align:center;-ms-touch-action:manipulation;touch-action:manipulation;cursor:pointer;background-image:none;white-space:nowrap;padding:6px 12px;font-size:14px;line-height:1.428571429;border-radius:4px;width:140px;margin:5px}sqh-share-button .squatch-share-btn .share-btn-text{text-align:center;padding-left:30px}sqh-share-button .squatch-share-btn:focus{outline:0}sqh-share-button .squatch-share-btn.disabled,sqh-share-button .squatch-share-btn[disabled],fieldset[disabled] sqh-share-button .squatch-share-btn{cursor:not-allowed;pointer-events:none;opacity:0.65;-webkit-box-shadow:none;box-shadow:none}sqh-share-button a{position:relative;text-decoration:none}sqh-share-button a .icon{position:absolute;left:10px;top:6px;width:16px}sqh-share-button a:before{bottom:-1px;background:rgba(255, 255, 255, 0.18);content:\"\";left:-1px;position:absolute;top:-1px;width:40px}@media (max-width: 499px){sqh-share-button{display:block}}@media (max-width: 499px){sqh-share-button .squatch-share-btn{margin:5px 0px;width:auto}}";
7268
7167
 
7269
- const ShareButton = class {
7270
- constructor(hostRef) {
7271
- index.registerInstance(this, hostRef);
7272
- }
7273
- clickHandler(e) {
7274
- if (window["widgetIdent"].env === "demo") {
7275
- e.preventDefault();
7276
- return;
7277
- }
7278
- // checking for null on closest 'a' tag makes click handler avoid firing when margin is clicked
7279
- var anchor = e.target.closest("a");
7280
- if (anchor !== null && this.buttonClassName !== "email-share") {
7281
- e.preventDefault();
7282
- const url = this.url;
7283
- const target = "_blank";
7284
- const features = "status=0,width=680,height=580";
7285
- window.open(url, target, features);
7286
- }
7287
- }
7288
- componentDidLoad() {
7289
- let el = this.button;
7290
- el.addEventListener("click", this.clickHandler.bind(this), false);
7291
- }
7292
- render() {
7293
- const isMobileiOS = detectMobileSafari() || detectMobileChrome();
7294
- const target = isMobileiOS ? "_parent" : "_blank";
7295
- const iconClass = `icon icon-${this.icon}`;
7296
- const style = css `
7297
- background-color: ${this.backgroundcolor};
7298
- border: 1px solid ${this.backgroundcolor};
7299
- color: ${this.textcolor};
7300
-
7301
- &:hover {
7302
- background: ${shadeColor(this.backgroundcolor, 10)};
7303
- border-color: ${shadeColor(this.backgroundcolor, 12)};
7304
- color: ${this.textcolor};
7305
- }
7306
-
7307
- &:focus {
7308
- color: ${this.textcolor};
7309
- }
7310
- .icon-${this.icon} {
7311
- left: ${this.iconhorizontal}px;
7312
- top: ${this.iconvertical}px;
7313
- font-size: ${this.iconsize}em;
7314
- }
7315
- `;
7316
- const classes = [
7317
- `squatch-share-btn`,
7318
- this.buttonClassName,
7319
- this.displayrule,
7320
- style,
7321
- ].join(" ");
7322
- return (index.h("a", { class: classes, href: this.url, target: target }, index.h("i", { class: iconClass }), index.h("span", { class: "share-btn-text" }, this.text)));
7323
- }
7324
- get button() { return index.getElement(this); }
7325
- };
7168
+ const ShareButton = class {
7169
+ constructor(hostRef) {
7170
+ index.registerInstance(this, hostRef);
7171
+ }
7172
+ clickHandler(e) {
7173
+ if (window["widgetIdent"].env === "demo") {
7174
+ e.preventDefault();
7175
+ return;
7176
+ }
7177
+ // checking for null on closest 'a' tag makes click handler avoid firing when margin is clicked
7178
+ var anchor = e.target.closest("a");
7179
+ if (anchor !== null && this.buttonClassName !== "email-share") {
7180
+ e.preventDefault();
7181
+ const url = this.url;
7182
+ const target = "_blank";
7183
+ const features = "status=0,width=680,height=580";
7184
+ window.open(url, target, features);
7185
+ }
7186
+ }
7187
+ componentDidLoad() {
7188
+ let el = this.button;
7189
+ el.addEventListener("click", this.clickHandler.bind(this), false);
7190
+ }
7191
+ render() {
7192
+ const isMobileiOS = detectMobileSafari() || detectMobileChrome();
7193
+ const target = isMobileiOS ? "_parent" : "_blank";
7194
+ const iconClass = `icon icon-${this.icon}`;
7195
+ const style = css `
7196
+ background-color: ${this.backgroundcolor};
7197
+ border: 1px solid ${this.backgroundcolor};
7198
+ color: ${this.textcolor};
7199
+
7200
+ &:hover {
7201
+ background: ${shadeColor(this.backgroundcolor, 10)};
7202
+ border-color: ${shadeColor(this.backgroundcolor, 12)};
7203
+ color: ${this.textcolor};
7204
+ }
7205
+
7206
+ &:focus {
7207
+ color: ${this.textcolor};
7208
+ }
7209
+ .icon-${this.icon} {
7210
+ left: ${this.iconhorizontal}px;
7211
+ top: ${this.iconvertical}px;
7212
+ font-size: ${this.iconsize}em;
7213
+ }
7214
+ `;
7215
+ const classes = [
7216
+ `squatch-share-btn`,
7217
+ this.buttonClassName,
7218
+ this.displayrule,
7219
+ style,
7220
+ ].join(" ");
7221
+ return (index.h("a", { class: classes, href: this.url, target: target }, index.h("i", { class: iconClass }), index.h("span", { class: "share-btn-text" }, this.text)));
7222
+ }
7223
+ get button() { return index.getElement(this); }
7224
+ };
7326
7225
  ShareButton.style = shareButtonCss;
7327
7226
 
7328
7227
  const shareButtonContainerCss = "sqh-share-button-container{text-align:center;display:block;max-width:100%;padding-bottom:24px;border-bottom:1px solid lightgray}sqh-share-button-container .squatch-share-btn.hidden{display:none}sqh-share-button-container .squatch-share-btn.mobile-only{display:none}@media (max-width: 499px){sqh-share-button-container .squatch-share-btn.mobile-only{display:block}}@media (max-width: 499px){sqh-share-button-container .squatch-share-btn.desktop-only{display:none}}";
7329
7228
 
7330
- const ShareButtonContainer = class {
7331
- constructor(hostRef) {
7332
- index.registerInstance(this, hostRef);
7333
- /**
7334
- * Email button icon
7335
- *
7336
- * @uiName Email Icon
7337
- * @uiGroup emailButton
7338
- */
7339
- this.emailicon = "mail";
7340
- /**
7341
- * CSS Class name used to style the Email button
7342
- *
7343
- * @uiName Email Class Name
7344
- * @uiGroup emailButton
7345
- */
7346
- this.emailclassName = "email-share";
7347
- /**
7348
- * Facebook button icon
7349
- *
7350
- * @uiName Facebook Icon
7351
- * @uiGroup facebookButton
7352
- */
7353
- this.facebookicon = "facebook";
7354
- /**
7355
- * Number to horizontally align the facebook button icon
7356
- *
7357
- * @uiName Facebook Icon Horizontal
7358
- * @uiGroup facebookButton
7359
- */
7360
- this.facebookiconhorizontal = 9;
7361
- /**
7362
- * Size of the facebook button icon
7363
- *
7364
- * @uiName Facebook Icon Size
7365
- * @uiGroup facebookButton
7366
- */
7367
- this.facebookiconsize = 1.2;
7368
- /**
7369
- * Twitter button icon
7370
- *
7371
- * @uiName Twitter Icon
7372
- * @uiGroup twitterButton
7373
- */
7374
- this.twittericon = "twitter";
7375
- /**
7376
- * Number to horizontally align the twitter button icon
7377
- *
7378
- * @uiName Twitter Icon Horizontal
7379
- * @uiGroup twitterButton
7380
- */
7381
- this.twittericonhorizontal = 9;
7382
- /**
7383
- * Size of the twitter button icon
7384
- *
7385
- * @uiName Twitter Icon Size
7386
- * @uiGroup twitterButton
7387
- */
7388
- this.twittericonsize = 1.2;
7389
- /**
7390
- * SMS button icon
7391
- *
7392
- * @uiName SMS Icon
7393
- * @uiGroup smsButton
7394
- */
7395
- this.smsicon = "chat";
7396
- /**
7397
- * Color of the text inside the WhatsApp button
7398
- *
7399
- * @uiName WhatsApp Text Color
7400
- * @uiGroup whatsappButton
7401
- */
7402
- this.whatsapptextcolor = "#fff";
7403
- /**
7404
- * WhatsApp button icon
7405
- *
7406
- * @uiName WhatsApp Icon
7407
- * @uiGroup whatsappButton
7408
- */
7409
- this.whatsappicon = "whatsapp";
7410
- /**
7411
- * Number to horizontally align the WhatsApp button icon
7412
- *
7413
- * @uiName WhatsApp Icon Horizontal
7414
- * @uiGroup whatsappButton
7415
- */
7416
- this.whatsappiconhorizontal = 7;
7417
- /**
7418
- * Number to vertically align the WhatsApp button icon
7419
- *
7420
- * @uiName WhatsApp Icon Vertical
7421
- * @uiGroup whatsappButton
7422
- */
7423
- this.whatsappiconvertical = 2;
7424
- /**
7425
- * Size of the WhatsApp button icon
7426
- *
7427
- * @uiName WhatsApp Icon Size
7428
- * @uiGroup whatsappButton
7429
- */
7430
- this.whatsappiconsize = 1.4;
7431
- /**
7432
- * Linkedin button icon
7433
- *
7434
- * @uiName Linkedin Icon
7435
- * @uiGroup linkedinButton
7436
- */
7437
- this.linkedinicon = "linkedin";
7438
- /**
7439
- * Size of the Linkedin button icon
7440
- *
7441
- * @uiName Linkedin Icon Size
7442
- * @uiGroup linkedinButton
7443
- */
7444
- this.linkediniconsize = 1.2;
7445
- /**
7446
- * Pinterest button icon
7447
- *
7448
- * @uiName Pinterest Icon
7449
- * @uiGroup pinterestButton
7450
- */
7451
- this.pinteresticon = "pinterest";
7452
- /**
7453
- * Number to horizontally align the Pinterest button icon
7454
- *
7455
- * @uiName Pinterest Icon Horizontal
7456
- * @uiGroup pinterestButton
7457
- */
7458
- this.pinteresticonhorizontal = 9;
7459
- /**
7460
- * Number to vertically align the Pinterest button icon
7461
- *
7462
- * @uiName Pinterest Icon Vertical
7463
- * @uiGroup pinterestButton
7464
- */
7465
- this.pinteresticonvertical = 4;
7466
- /**
7467
- * Size of the Pinterest button icon
7468
- *
7469
- * @uiName Pinterest Icon Size
7470
- * @uiGroup pinterestButton
7471
- */
7472
- this.pinteresticonsize = 1.2;
7473
- /**
7474
- * Messenger button icon
7475
- *
7476
- * @uiName Messenger Icon
7477
- * @uiGroup messengerButton
7478
- */
7479
- this.messengericon = "messenger";
7480
- /**
7481
- * Number to horizontally align the Messenger button icon
7482
- *
7483
- * @uiName Messenger Icon Horizontal
7484
- * @uiGroup messengerButton
7485
- */
7486
- this.messengericonhorizontal = 7;
7487
- /**
7488
- * Number to vertically align the Messenger button icon
7489
- *
7490
- * @uiName Messenger Icon Vertical
7491
- * @uiGroup messengerButton
7492
- */
7493
- this.messengericonvertical = 3;
7494
- /**
7495
- * Size of the Messenger button icon
7496
- *
7497
- * @uiName Messenger Icon Size
7498
- * @uiGroup messengerButton
7499
- */
7500
- this.messengericonsize = 1.4;
7501
- /**
7502
- * Line button icon
7503
- *
7504
- * @uiName Line Icon
7505
- * @uiGroup lineButton
7506
- */
7507
- this.lineicon = "line";
7508
- /**
7509
- * Number to horizontally align the Line button icon
7510
- *
7511
- * @uiName Line Icon Horizontal
7512
- * @uiGroup lineButton
7513
- */
7514
- this.lineiconhorizontal = -2;
7515
- /**
7516
- * Number to vertically align the Line button icon
7517
- *
7518
- * @uiName Line Icon Vertical
7519
- * @uiGroup lineButton
7520
- */
7521
- this.lineiconvertical = -5;
7522
- /**
7523
- * Size of the Line button icon
7524
- *
7525
- * @uiName Line Icon Size
7526
- * @uiGroup lineButton
7527
- */
7528
- this.lineiconsize = 2.2;
7529
- }
7530
- componentWillLoad() {
7531
- if (!this.ishidden) {
7532
- const mediums = [
7533
- "EMAIL",
7534
- "FACEBOOK",
7535
- "TWITTER",
7536
- "SMS",
7537
- "WHATSAPP",
7538
- "LINKEDIN",
7539
- "PINTEREST",
7540
- "FBMESSENGER",
7541
- "LINEMESSENGER",
7542
- ];
7543
- return this.getMessageLinks(mediums);
7544
- }
7545
- }
7546
- getMessageLinks(mediums) {
7547
- return WidgetHost.API.graphql
7548
- .getMessageLinks(mediums)
7549
- .then((res) => {
7550
- this.emailurl = res.EMAIL;
7551
- this.facebookurl = res.FACEBOOK;
7552
- this.twitterurl = res.TWITTER;
7553
- this.smsurl = res.SMS;
7554
- this.whatsappurl = res.WHATSAPP;
7555
- this.linkedinurl = res.LINKEDIN;
7556
- this.pinteresturl = res.PINTEREST;
7557
- this.messengerurl = res.FBMESSENGER;
7558
- this.lineurl = res.LINEMESSENGER;
7559
- })
7560
- .catch((e) => {
7561
- this.onError(e);
7562
- });
7563
- }
7564
- onError(e) {
7565
- console.log("Error loading via GraphQL.", e);
7566
- }
7567
- render() {
7568
- const emailBtn = (index.h("sqh-share-button", { displayrule: this.emaildisplayrule, text: this.emailtext, backgroundcolor: this.emailbackgroundcolor, textcolor: this.emailtextcolor, icon: this.emailicon, class: this.emailclassName, iconhorizontal: this.emailiconhorizontal, iconvertical: this.emailiconvertical, iconsize: this.emailiconsize, url: this.emailurl }));
7569
- const facebookBtn = (index.h("sqh-share-button", { displayrule: this.facebookdisplayrule, text: this.facebooktext, backgroundcolor: this.facebookbackgroundcolor, textcolor: this.facebooktextcolor, icon: this.facebookicon, class: this.facebookclassName, iconhorizontal: this.facebookiconhorizontal, iconvertical: this.facebookiconvertical, iconsize: this.facebookiconsize, url: this.facebookurl }));
7570
- const twitterBtn = (index.h("sqh-share-button", { displayrule: this.twitterdisplayrule, text: this.twittertext, backgroundcolor: this.twitterbackgroundcolor, textcolor: this.twittertextcolor, icon: this.twittericon, class: this.twitterclassName, iconhorizontal: this.twittericonhorizontal, iconvertical: this.twittericonvertical, iconsize: this.twittericonsize, url: this.twitterurl }));
7571
- const smsBtn = (index.h("sqh-share-button", { displayrule: this.smsdisplayrule, text: this.smstext, backgroundcolor: this.smsbackgroundcolor, textcolor: this.smstextcolor, icon: this.smsicon, class: this.smsclassName, iconhorizontal: this.smsiconhorizontal, iconvertical: this.smsiconvertical, iconsize: this.smsiconsize, url: this.smsurl }));
7572
- const whatsappBtn = (index.h("sqh-share-button", { displayrule: this.whatsappdisplayrule, text: this.whatsapptext, backgroundcolor: this.whatsappbackgroundcolor, textcolor: this.whatsapptextcolor, icon: this.whatsappicon, class: this.whatsappclassName, iconhorizontal: this.whatsappiconhorizontal, iconvertical: this.whatsappiconvertical, iconsize: this.whatsappiconsize, url: this.whatsappurl }));
7573
- const linkedinBtn = (index.h("sqh-share-button", { displayrule: this.linkedindisplayrule, text: this.linkedintext, backgroundcolor: this.linkedinbackgroundcolor, textcolor: this.linkedintextcolor, icon: this.linkedinicon, class: this.linkedinclassName, iconhorizontal: this.linkediniconhorizontal, iconvertical: this.linkediniconvertical, iconsize: this.linkediniconsize, url: this.linkedinurl }));
7574
- const pinterestBtn = (index.h("sqh-share-button", { displayrule: this.pinterestdisplayrule, text: this.pinteresttext, backgroundcolor: this.pinterestbackgroundcolor, textcolor: this.pinteresttextcolor, icon: this.pinteresticon, class: this.pinterestclassName, iconhorizontal: this.pinteresticonhorizontal, iconvertical: this.pinteresticonvertical, iconsize: this.pinteresticonsize, url: this.pinteresturl }));
7575
- const messengerBtn = (index.h("sqh-share-button", { displayrule: this.messengerdisplayrule, text: this.messengertext, backgroundcolor: this.messengerbackgroundcolor, textcolor: this.messengertextcolor, icon: this.messengericon, class: this.messengerclassName, iconhorizontal: this.messengericonhorizontal, iconvertical: this.messengericonvertical, iconsize: this.messengericonsize, url: this.messengerurl }));
7576
- const lineBtn = (index.h("sqh-share-button", { displayrule: this.linedisplayrule, text: this.linetext, backgroundcolor: this.linebackgroundcolor, textcolor: this.linetextcolor, icon: this.lineicon, class: this.lineclassName, iconhorizontal: this.lineiconhorizontal, iconvertical: this.lineiconvertical, iconsize: this.lineiconsize, url: this.lineurl }));
7577
- return (!this.ishidden && (index.h("div", null, emailBtn, facebookBtn, twitterBtn, smsBtn, whatsappBtn, linkedinBtn, pinterestBtn, messengerBtn, lineBtn)));
7578
- }
7579
- };
7229
+ const ShareButtonContainer = class {
7230
+ constructor(hostRef) {
7231
+ index.registerInstance(this, hostRef);
7232
+ /**
7233
+ * @uiName Email Icon
7234
+ * @uiGroup Email
7235
+ */
7236
+ this.emailicon = "mail";
7237
+ /**
7238
+ * CSS class name for additional styling.
7239
+ *
7240
+ * @uiName Email Class Name
7241
+ * @uiGroup Email
7242
+ */
7243
+ this.emailclassName = "email-share";
7244
+ /**
7245
+ * @uiName Facebook Icon
7246
+ * @uiGroup Facebook
7247
+ */
7248
+ this.facebookicon = "facebook";
7249
+ /**
7250
+ * Number to horizontally align the facebook button icon
7251
+ *
7252
+ * @uiName Facebook Icon Horizontal
7253
+ * @uiGroup Facebook
7254
+ */
7255
+ this.facebookiconhorizontal = 9;
7256
+ /**
7257
+ * @uiName Facebook Icon Size
7258
+ * @uiGroup Facebook
7259
+ */
7260
+ this.facebookiconsize = 1.2;
7261
+ /**
7262
+ * @uiName X Icon
7263
+ * @uiGroup X
7264
+ */
7265
+ this.twittericon = "twitter";
7266
+ /**
7267
+ * Number to horizontally align the X button icon
7268
+ *
7269
+ * @uiName X Icon Horizontal
7270
+ * @uiGroup X
7271
+ */
7272
+ this.twittericonhorizontal = 9;
7273
+ /**
7274
+ * @uiName X Icon Size
7275
+ * @uiGroup X
7276
+ */
7277
+ this.twittericonsize = 1.2;
7278
+ /**
7279
+ * @uiName SMS Icon
7280
+ * @uiGroup SMS
7281
+ */
7282
+ this.smsicon = "chat";
7283
+ /**
7284
+ * @uiName WhatsApp Text Color
7285
+ * @uiGroup WhatsApp
7286
+ * @uiWidget color
7287
+ * @default #ffffff
7288
+ */
7289
+ this.whatsapptextcolor = "#fff";
7290
+ /**
7291
+ * @uiName WhatsApp Icon
7292
+ * @uiGroup WhatsApp
7293
+ */
7294
+ this.whatsappicon = "whatsapp";
7295
+ /**
7296
+ * Number to horizontally align the WhatsApp button icon
7297
+ *
7298
+ * @uiName WhatsApp Icon Horizontal
7299
+ * @uiGroup WhatsApp
7300
+ */
7301
+ this.whatsappiconhorizontal = 7;
7302
+ /**
7303
+ * Number to vertically align the WhatsApp button icon
7304
+ *
7305
+ * @uiName WhatsApp Icon Vertical
7306
+ * @uiGroup WhatsApp
7307
+ */
7308
+ this.whatsappiconvertical = 2;
7309
+ /**
7310
+ * @uiName WhatsApp Icon Size
7311
+ * @uiGroup WhatsApp
7312
+ */
7313
+ this.whatsappiconsize = 1.4;
7314
+ /**
7315
+ * @uiName Linkedin Icon
7316
+ * @uiGroup LinkedIn
7317
+ */
7318
+ this.linkedinicon = "linkedin";
7319
+ /**
7320
+ * @uiName Linkedin Icon Size
7321
+ * @uiGroup LinkedIn
7322
+ */
7323
+ this.linkediniconsize = 1.2;
7324
+ /**
7325
+ * @uiName Pinterest Icon
7326
+ * @uiGroup Pinterest
7327
+ */
7328
+ this.pinteresticon = "pinterest";
7329
+ /**
7330
+ * Number to horizontally align the Pinterest button icon
7331
+ *
7332
+ * @uiName Pinterest Icon Horizontal
7333
+ * @uiGroup Pinterest
7334
+ */
7335
+ this.pinteresticonhorizontal = 9;
7336
+ /**
7337
+ * Number to vertically align the Pinterest button icon
7338
+ *
7339
+ * @uiName Pinterest Icon Vertical
7340
+ * @uiGroup Pinterest
7341
+ */
7342
+ this.pinteresticonvertical = 4;
7343
+ /**
7344
+ * @uiName Pinterest Icon Size
7345
+ * @uiGroup Pinterest
7346
+ */
7347
+ this.pinteresticonsize = 1.2;
7348
+ /**
7349
+ * @uiName Messenger Icon
7350
+ * @uiGroup Messenger
7351
+ */
7352
+ this.messengericon = "messenger";
7353
+ /**
7354
+ * Number to horizontally align the Messenger button icon
7355
+ *
7356
+ * @uiName Messenger Icon Horizontal
7357
+ * @uiGroup Messenger
7358
+ */
7359
+ this.messengericonhorizontal = 7;
7360
+ /**
7361
+ * Number to vertically align the Messenger button icon
7362
+ *
7363
+ * @uiName Messenger Icon Vertical
7364
+ * @uiGroup Messenger
7365
+ */
7366
+ this.messengericonvertical = 3;
7367
+ /**
7368
+ * @uiName Messenger Icon Size
7369
+ * @uiGroup Messenger
7370
+ */
7371
+ this.messengericonsize = 1.4;
7372
+ /**
7373
+ * @uiName Line Icon
7374
+ * @uiGroup Line Messenger
7375
+ */
7376
+ this.lineicon = "line";
7377
+ /**
7378
+ * Number to horizontally align the Line button icon
7379
+ *
7380
+ * @uiName Line Icon Horizontal
7381
+ * @uiGroup Line Messenger
7382
+ */
7383
+ this.lineiconhorizontal = -2;
7384
+ /**
7385
+ * Number to vertically align the Line button icon
7386
+ *
7387
+ * @uiName Line Icon Vertical
7388
+ * @uiGroup Line Messenger
7389
+ */
7390
+ this.lineiconvertical = -5;
7391
+ /**
7392
+ * @uiName Line Icon Size
7393
+ * @uiGroup Line Messenger
7394
+ */
7395
+ this.lineiconsize = 2.2;
7396
+ }
7397
+ componentWillLoad() {
7398
+ if (!this.ishidden) {
7399
+ const mediums = [
7400
+ "EMAIL",
7401
+ "FACEBOOK",
7402
+ "TWITTER",
7403
+ "SMS",
7404
+ "WHATSAPP",
7405
+ "LINKEDIN",
7406
+ "PINTEREST",
7407
+ "FBMESSENGER",
7408
+ "LINEMESSENGER",
7409
+ ];
7410
+ return this.getMessageLinks(mediums);
7411
+ }
7412
+ }
7413
+ getMessageLinks(mediums) {
7414
+ return WidgetHost.API.graphql
7415
+ .getMessageLinks(mediums)
7416
+ .then((res) => {
7417
+ this.emailurl = res.EMAIL;
7418
+ this.facebookurl = res.FACEBOOK;
7419
+ this.twitterurl = res.TWITTER;
7420
+ this.smsurl = res.SMS;
7421
+ this.whatsappurl = res.WHATSAPP;
7422
+ this.linkedinurl = res.LINKEDIN;
7423
+ this.pinteresturl = res.PINTEREST;
7424
+ this.messengerurl = res.FBMESSENGER;
7425
+ this.lineurl = res.LINEMESSENGER;
7426
+ })
7427
+ .catch((e) => {
7428
+ this.onError(e);
7429
+ });
7430
+ }
7431
+ onError(e) {
7432
+ console.log("Error loading via GraphQL.", e);
7433
+ }
7434
+ render() {
7435
+ const emailBtn = (index.h("sqh-share-button", { displayrule: this.emaildisplayrule, text: this.emailtext, backgroundcolor: this.emailbackgroundcolor, textcolor: this.emailtextcolor, icon: this.emailicon, class: this.emailclassName, iconhorizontal: this.emailiconhorizontal, iconvertical: this.emailiconvertical, iconsize: this.emailiconsize, url: this.emailurl }));
7436
+ const facebookBtn = (index.h("sqh-share-button", { displayrule: this.facebookdisplayrule, text: this.facebooktext, backgroundcolor: this.facebookbackgroundcolor, textcolor: this.facebooktextcolor, icon: this.facebookicon, class: this.facebookclassName, iconhorizontal: this.facebookiconhorizontal, iconvertical: this.facebookiconvertical, iconsize: this.facebookiconsize, url: this.facebookurl }));
7437
+ const twitterBtn = (index.h("sqh-share-button", { displayrule: this.twitterdisplayrule, text: this.twittertext, backgroundcolor: this.twitterbackgroundcolor, textcolor: this.twittertextcolor, icon: this.twittericon, class: this.twitterclassName, iconhorizontal: this.twittericonhorizontal, iconvertical: this.twittericonvertical, iconsize: this.twittericonsize, url: this.twitterurl }));
7438
+ const smsBtn = (index.h("sqh-share-button", { displayrule: this.smsdisplayrule, text: this.smstext, backgroundcolor: this.smsbackgroundcolor, textcolor: this.smstextcolor, icon: this.smsicon, class: this.smsclassName, iconhorizontal: this.smsiconhorizontal, iconvertical: this.smsiconvertical, iconsize: this.smsiconsize, url: this.smsurl }));
7439
+ const whatsappBtn = (index.h("sqh-share-button", { displayrule: this.whatsappdisplayrule, text: this.whatsapptext, backgroundcolor: this.whatsappbackgroundcolor, textcolor: this.whatsapptextcolor, icon: this.whatsappicon, class: this.whatsappclassName, iconhorizontal: this.whatsappiconhorizontal, iconvertical: this.whatsappiconvertical, iconsize: this.whatsappiconsize, url: this.whatsappurl }));
7440
+ const linkedinBtn = (index.h("sqh-share-button", { displayrule: this.linkedindisplayrule, text: this.linkedintext, backgroundcolor: this.linkedinbackgroundcolor, textcolor: this.linkedintextcolor, icon: this.linkedinicon, class: this.linkedinclassName, iconhorizontal: this.linkediniconhorizontal, iconvertical: this.linkediniconvertical, iconsize: this.linkediniconsize, url: this.linkedinurl }));
7441
+ const pinterestBtn = (index.h("sqh-share-button", { displayrule: this.pinterestdisplayrule, text: this.pinteresttext, backgroundcolor: this.pinterestbackgroundcolor, textcolor: this.pinteresttextcolor, icon: this.pinteresticon, class: this.pinterestclassName, iconhorizontal: this.pinteresticonhorizontal, iconvertical: this.pinteresticonvertical, iconsize: this.pinteresticonsize, url: this.pinteresturl }));
7442
+ const messengerBtn = (index.h("sqh-share-button", { displayrule: this.messengerdisplayrule, text: this.messengertext, backgroundcolor: this.messengerbackgroundcolor, textcolor: this.messengertextcolor, icon: this.messengericon, class: this.messengerclassName, iconhorizontal: this.messengericonhorizontal, iconvertical: this.messengericonvertical, iconsize: this.messengericonsize, url: this.messengerurl }));
7443
+ const lineBtn = (index.h("sqh-share-button", { displayrule: this.linedisplayrule, text: this.linetext, backgroundcolor: this.linebackgroundcolor, textcolor: this.linetextcolor, icon: this.lineicon, class: this.lineclassName, iconhorizontal: this.lineiconhorizontal, iconvertical: this.lineiconvertical, iconsize: this.lineiconsize, url: this.lineurl }));
7444
+ return (!this.ishidden && (index.h("div", null, emailBtn, facebookBtn, twitterBtn, smsBtn, whatsappBtn, linkedinBtn, pinterestBtn, messengerBtn, lineBtn)));
7445
+ }
7446
+ };
7580
7447
  ShareButtonContainer.style = shareButtonContainerCss;
7581
7448
 
7582
7449
  const statComponentCss = "sqh-stat-component{text-align:center;width:140px;float:left}sqh-stat-component>div{padding:10px}sqh-stat-component .stat-value{white-space:nowrap;font-size:30px;line-height:20px;margin-top:20px;margin-bottom:8px;font-weight:300}sqh-stat-component .stat-description{text-transform:uppercase;font-size:12px}@media (max-width: 499px){sqh-stat-component{width:100%;text-align:left;background:#f2f2f2;border:1px solid #ddd}sqh-stat-component:first-child{border-radius:4px 4px 0 0}sqh-stat-component:last-child{border-radius:0 0 4px 4px}}@media (max-width: 499px){sqh-stat-component .stat-value{font-size:22px;float:left;width:60px;text-align:center;margin:0 10px 0 0}}@media (max-width: 499px){sqh-stat-component .stat-description{line-height:20px;padding-left:100px;overflow-wrap:break-word}}";
7583
7450
 
7584
- const StatComponent = class {
7585
- constructor(hostRef) {
7586
- index.registerInstance(this, hostRef);
7587
- this.statTypeUpdated = index.createEvent(this, "statTypeUpdated", 7);
7588
- this.statAdded = index.createEvent(this, "statAdded", 7);
7589
- }
7590
- componentWillLoad() {
7591
- this.statAddedHandler(this.elem);
7592
- }
7593
- stattypeHandler(newValue, oldValue) {
7594
- if (newValue !== oldValue)
7595
- this.statTypeUpdatedHandler(this.elem);
7596
- }
7597
- statAddedHandler(stat) {
7598
- this.statAdded.emit(stat);
7599
- }
7600
- statTypeUpdatedHandler(stat) {
7601
- this.statTypeUpdated.emit(stat);
7602
- }
7603
- render() {
7604
- const clz = css `
7605
- color: ${this.statcolor};
7606
- `;
7607
- return (!this.ishidden && (index.h("div", { class: clz }, index.h("div", { class: "stat-value" }, this.statvalue), index.h("div", { class: "stat-description" }, this.statdescription))));
7608
- }
7609
- get elem() { return index.getElement(this); }
7610
- static get watchers() { return {
7611
- "stattype": ["stattypeHandler"]
7612
- }; }
7613
- };
7451
+ const StatComponent = class {
7452
+ constructor(hostRef) {
7453
+ index.registerInstance(this, hostRef);
7454
+ this.statTypeUpdated = index.createEvent(this, "statTypeUpdated", 7);
7455
+ this.statAdded = index.createEvent(this, "statAdded", 7);
7456
+ }
7457
+ componentWillLoad() {
7458
+ this.statAddedHandler(this.elem);
7459
+ }
7460
+ stattypeHandler(newValue, oldValue) {
7461
+ if (newValue !== oldValue)
7462
+ this.statTypeUpdatedHandler(this.elem);
7463
+ }
7464
+ statAddedHandler(stat) {
7465
+ this.statAdded.emit(stat);
7466
+ }
7467
+ statTypeUpdatedHandler(stat) {
7468
+ this.statTypeUpdated.emit(stat);
7469
+ }
7470
+ render() {
7471
+ const clz = css `
7472
+ color: ${this.statcolor};
7473
+ `;
7474
+ return (!this.ishidden && (index.h("div", { class: clz }, index.h("div", { class: "stat-value" }, this.statvalue), index.h("div", { class: "stat-description" }, this.statdescription))));
7475
+ }
7476
+ get elem() { return index.getElement(this); }
7477
+ static get watchers() { return {
7478
+ "stattype": ["stattypeHandler"]
7479
+ }; }
7480
+ };
7614
7481
  StatComponent.style = statComponentCss;
7615
7482
 
7616
7483
  /**
@@ -7908,109 +7775,108 @@ function pathToRegexp(path, keys, options) {
7908
7775
 
7909
7776
  const statsContainerCss = "sqh-stats-container{display:-ms-flexbox;display:flex;-ms-flex-wrap:wrap;flex-wrap:wrap;-ms-flex-align:center;align-items:center;-ms-flex-pack:distribute;justify-content:space-around}@media (max-width: 499px){sqh-stats-container{-ms-flex-direction:column;flex-direction:column}sqh-stats-container div{-ms-flex-wrap:wrap;flex-wrap:wrap;width:100%}}";
7910
7777
 
7911
- const StatsContainer = class {
7912
- constructor(hostRef) {
7913
- index.registerInstance(this, hostRef);
7914
- /**
7915
- * Hide the component
7916
- *
7917
- * @uiName Is Hidden
7918
- */
7919
- this.ishidden = false;
7920
- this.statPaths = [
7921
- "/rewardBalance/:type/:unit/:valuetype?/:isGlobal?",
7922
- "/:statName",
7923
- ];
7924
- this.statPathRegexp = this.statPaths.map((path) => {
7925
- const keys = [];
7926
- const regexp = pathToRegexp(path, keys);
7927
- return { regexp, keys };
7928
- });
7929
- this.loading = true;
7930
- }
7931
- componentWillLoad() {
7932
- if (!this.ishidden) {
7933
- return WidgetHost.API.graphql
7934
- .getStats()
7935
- .then((res) => {
7936
- this.stats = {
7937
- referralsCount: res.referralsCount.totalCount,
7938
- referralsMonth: res.referralsMonth.totalCount,
7939
- referralsWeek: res.referralsWeek.totalCount,
7940
- rewardsCount: res.rewardsCount.totalCount,
7941
- rewardsMonth: res.rewardsMonth.totalCount,
7942
- rewardsWeek: res.rewardsWeek.totalCount,
7943
- rewardBalance: res.rewardBalances,
7944
- rewardBalanceGlobal: res.rewardBalancesGlobal,
7945
- };
7946
- this.loading = false;
7947
- })
7948
- .then(() => {
7949
- const children = Array.from(this.container.querySelectorAll("[stattype]"));
7950
- children.map((child) => {
7951
- this.setStatValue(child);
7952
- });
7953
- })
7954
- .catch((e) => {
7955
- this.onError(e);
7956
- });
7957
- }
7958
- }
7959
- statTypeUpdatedHandler(event) {
7960
- this.setStatValue(event.detail);
7961
- }
7962
- statAddedHandler(event) {
7963
- if (this.stats)
7964
- this.setStatValue(event.detail);
7965
- }
7966
- setStatValue(child) {
7967
- const path = child.getAttribute("stattype");
7968
- const stat = this.getStatFromPath(path);
7969
- child.setAttribute("statvalue", `${stat}`);
7970
- return child;
7971
- }
7972
- getStatFromPath(path) {
7973
- const statPath = this.statPathRegexp.find((stat) => stat.regexp.test(path));
7974
- if (!statPath)
7975
- return 0;
7976
- const { keys, regexp } = statPath;
7977
- const res = regexp.exec(path);
7978
- const statVariables = {};
7979
- keys.forEach((k, i) => (statVariables[k.name] = res[i + 1]));
7980
- return this.getStatValue(statVariables);
7981
- }
7982
- getStatValue(statVariables) {
7983
- if (statVariables.statName)
7984
- return this.stats[statVariables.statName] || 0;
7985
- return this.getRewardBalance(statVariables);
7986
- }
7987
- getRewardBalance(statVariables) {
7988
- const { type, unit, valuetype, isGlobal } = statVariables;
7989
- // passing in CASH/USD as CASH_USD into this webcomponent so pathToRegexp doesn't split it and it stays all in unit.
7990
- // this converts the _ back to / so it matches the unit from the backend.
7991
- // possibly change the unit in the backend to avoid this?
7992
- const newUnit = unit.replace(/_/, "/");
7993
- const rewardBalance = this.stats[isGlobal ? "rewardBalanceGlobal" : "rewardBalance"].find((rb) => rb.type === type && rb.unit === newUnit);
7994
- if (!rewardBalance)
7995
- return 0;
7996
- if (valuetype)
7997
- return rewardBalance[valuetype];
7998
- return rewardBalance.value;
7999
- }
8000
- onError(e) {
8001
- console.log("Error loading via GraphQL.", e);
8002
- this.loading = false;
8003
- }
8004
- render() {
8005
- const containerStyle = css `
8006
- display: ${this.ishidden ? "none" : "inherit"};
8007
- padding-top: ${this.paddingtop}px;
8008
- padding-bottom: ${this.paddingbottom}px;
8009
- `;
8010
- return (index.h("div", { class: containerStyle }, index.h("slot", null)));
8011
- }
8012
- get container() { return index.getElement(this); }
8013
- };
7778
+ const StatsContainer = class {
7779
+ constructor(hostRef) {
7780
+ index.registerInstance(this, hostRef);
7781
+ /**
7782
+ * @undocumented
7783
+ * @uiName Hide stats
7784
+ */
7785
+ this.ishidden = false;
7786
+ this.statPaths = [
7787
+ "/rewardBalance/:type/:unit/:valuetype?/:isGlobal?",
7788
+ "/:statName",
7789
+ ];
7790
+ this.statPathRegexp = this.statPaths.map((path) => {
7791
+ const keys = [];
7792
+ const regexp = pathToRegexp(path, keys);
7793
+ return { regexp, keys };
7794
+ });
7795
+ this.loading = true;
7796
+ }
7797
+ componentWillLoad() {
7798
+ if (!this.ishidden) {
7799
+ return WidgetHost.API.graphql
7800
+ .getStats()
7801
+ .then((res) => {
7802
+ this.stats = {
7803
+ referralsCount: res.referralsCount.totalCount,
7804
+ referralsMonth: res.referralsMonth.totalCount,
7805
+ referralsWeek: res.referralsWeek.totalCount,
7806
+ rewardsCount: res.rewardsCount.totalCount,
7807
+ rewardsMonth: res.rewardsMonth.totalCount,
7808
+ rewardsWeek: res.rewardsWeek.totalCount,
7809
+ rewardBalance: res.rewardBalances,
7810
+ rewardBalanceGlobal: res.rewardBalancesGlobal,
7811
+ };
7812
+ this.loading = false;
7813
+ })
7814
+ .then(() => {
7815
+ const children = Array.from(this.container.querySelectorAll("[stattype]"));
7816
+ children.map((child) => {
7817
+ this.setStatValue(child);
7818
+ });
7819
+ })
7820
+ .catch((e) => {
7821
+ this.onError(e);
7822
+ });
7823
+ }
7824
+ }
7825
+ statTypeUpdatedHandler(event) {
7826
+ this.setStatValue(event.detail);
7827
+ }
7828
+ statAddedHandler(event) {
7829
+ if (this.stats)
7830
+ this.setStatValue(event.detail);
7831
+ }
7832
+ setStatValue(child) {
7833
+ const path = child.getAttribute("stattype");
7834
+ const stat = this.getStatFromPath(path);
7835
+ child.setAttribute("statvalue", `${stat}`);
7836
+ return child;
7837
+ }
7838
+ getStatFromPath(path) {
7839
+ const statPath = this.statPathRegexp.find((stat) => stat.regexp.test(path));
7840
+ if (!statPath)
7841
+ return 0;
7842
+ const { keys, regexp } = statPath;
7843
+ const res = regexp.exec(path);
7844
+ const statVariables = {};
7845
+ keys.forEach((k, i) => (statVariables[k.name] = res[i + 1]));
7846
+ return this.getStatValue(statVariables);
7847
+ }
7848
+ getStatValue(statVariables) {
7849
+ if (statVariables.statName)
7850
+ return this.stats[statVariables.statName] || 0;
7851
+ return this.getRewardBalance(statVariables);
7852
+ }
7853
+ getRewardBalance(statVariables) {
7854
+ const { type, unit, valuetype, isGlobal } = statVariables;
7855
+ // passing in CASH/USD as CASH_USD into this webcomponent so pathToRegexp doesn't split it and it stays all in unit.
7856
+ // this converts the _ back to / so it matches the unit from the backend.
7857
+ // possibly change the unit in the backend to avoid this?
7858
+ const newUnit = unit.replace(/_/, "/");
7859
+ const rewardBalance = this.stats[isGlobal ? "rewardBalanceGlobal" : "rewardBalance"].find((rb) => rb.type === type && rb.unit === newUnit);
7860
+ if (!rewardBalance)
7861
+ return 0;
7862
+ if (valuetype)
7863
+ return rewardBalance[valuetype];
7864
+ return rewardBalance.value;
7865
+ }
7866
+ onError(e) {
7867
+ console.log("Error loading via GraphQL.", e);
7868
+ this.loading = false;
7869
+ }
7870
+ render() {
7871
+ const containerStyle = css `
7872
+ display: ${this.ishidden ? "none" : "inherit"};
7873
+ padding-top: ${this.paddingtop}px;
7874
+ padding-bottom: ${this.paddingbottom}px;
7875
+ `;
7876
+ return (index.h("div", { class: containerStyle }, index.h("slot", null)));
7877
+ }
7878
+ get container() { return index.getElement(this); }
7879
+ };
8014
7880
  StatsContainer.style = statsContainerCss;
8015
7881
 
8016
7882
  var marked = _commonjsHelpers.createCommonjsModule(function (module, exports) {
@@ -10611,37 +10477,38 @@ var marked = _commonjsHelpers.createCommonjsModule(function (module, exports) {
10611
10477
 
10612
10478
  const textComponentCss = "sqh-text-component{display:block}sqh-text-component p{margin:0}";
10613
10479
 
10614
- const TextComponent = class {
10615
- constructor(hostRef) {
10616
- index.registerInstance(this, hostRef);
10617
- }
10618
- render() {
10619
- 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;
10620
- const textStyle = css `
10621
- font-family: ${this.fontfamily || "inherit"};
10622
- font-size: ${this.fontsize ? this.fontsize + "px" : "inherit"};
10623
- text-align: ${this.textalign};
10624
- color: ${this.color || "inherit"};
10625
- padding-top: ${this.paddingtop ? this.paddingtop + "px" : "inherit"};
10626
- padding-bottom: ${this.paddingbottom
10627
- ? this.paddingbottom + "px"
10628
- : "inherit"};
10629
- overflow-wrap: break-word;
10630
- `;
10631
- const divStyle = css `
10632
- background: ${this.background
10633
- ? this.background.match(regex)
10634
- ? `url(${this.background}) no-repeat center center;`
10635
- : this.background
10636
- : "inherit"};
10637
- height: ${this.height || "inherit"};
10638
- background-size: contain;
10639
- `;
10640
- const content = this.ismarkdown ? (index.h("div", { innerHTML: marked(this.text) })) : (this.text);
10641
- return (!this.ishidden && (index.h("div", { class: divStyle }, index.h("p", { class: textStyle }, content))));
10642
- }
10643
- get textEl() { return index.getElement(this); }
10644
- };
10480
+ const TextComponent = class {
10481
+ constructor(hostRef) {
10482
+ index.registerInstance(this, hostRef);
10483
+ }
10484
+ render() {
10485
+ 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;
10486
+ const textStyle = css `
10487
+ font-family: ${this.fontfamily || "inherit"};
10488
+ font-size: ${this.fontsize ? this.fontsize + "px" : "inherit"};
10489
+ font-weight: ${this.fontweight ? this.fontweight : "inherit"};
10490
+ text-align: ${this.textalign};
10491
+ color: ${this.color || "inherit"};
10492
+ padding-top: ${this.paddingtop ? this.paddingtop + "px" : "inherit"};
10493
+ padding-bottom: ${this.paddingbottom
10494
+ ? this.paddingbottom + "px"
10495
+ : "inherit"};
10496
+ overflow-wrap: break-word;
10497
+ `;
10498
+ const divStyle = css `
10499
+ background: ${this.background
10500
+ ? this.background.match(regex)
10501
+ ? `url(${this.background}) no-repeat center center;`
10502
+ : this.background
10503
+ : "inherit"};
10504
+ height: ${this.height || "inherit"};
10505
+ background-size: contain;
10506
+ `;
10507
+ const content = this.ismarkdown ? (index.h("div", { innerHTML: marked(this.text) })) : (this.text);
10508
+ return (!this.ishidden && (index.h("div", { class: divStyle }, index.h("p", { class: textStyle }, content))));
10509
+ }
10510
+ get textEl() { return index.getElement(this); }
10511
+ };
10645
10512
  TextComponent.style = textComponentCss;
10646
10513
 
10647
10514
  exports.sqh_copy_button = CopyButton;