@saasquatch/vanilla-components 1.2.4-6 → 1.2.4-7

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 (87) hide show
  1. package/LICENSE +21 -21
  2. package/dist/cjs/{WidgetHost-71b013eb.js → WidgetHost-d7b870ce.js} +615 -615
  3. package/dist/cjs/sqh-close-button.cjs.entry.js +25 -25
  4. package/dist/cjs/sqh-copy-button_12.cjs.entry.js +1134 -1033
  5. package/dist/cjs/sqh-referral-code.cjs.entry.js +22 -22
  6. package/dist/cjs/sqh-rewards-actions.cjs.entry.js +26 -26
  7. package/dist/collection/components/close-button/close-button.js +70 -70
  8. package/dist/collection/components/copy-button/copy-button.js +389 -389
  9. package/dist/collection/components/copy-link-button/copy-link-button.js +236 -236
  10. package/dist/collection/components/global-container/global-container.js +170 -170
  11. package/dist/collection/components/image-component/image-component.js +178 -178
  12. package/dist/collection/components/partner-stat-component/partner-stat-component.js +199 -199
  13. package/dist/collection/components/referral-code/referral-code.js +36 -36
  14. package/dist/collection/components/referral-component/referral-component.js +255 -255
  15. package/dist/collection/components/referral-list/referral-list.js +935 -935
  16. package/dist/collection/components/rewards-actions/rewards-actions.js +105 -105
  17. package/dist/collection/components/share-button/share-button.js +310 -310
  18. package/dist/collection/components/share-button-container/share-button-container.js +2457 -2457
  19. package/dist/collection/components/stat-component/stat-component.js +200 -200
  20. package/dist/collection/components/stats-container/stats-container.js +210 -210
  21. package/dist/collection/components/text-component/text-component.js +283 -283
  22. package/dist/collection/entrypoint.js +32 -32
  23. package/dist/collection/global/global.js +4 -4
  24. package/dist/collection/services/FormatJs.js +15 -15
  25. package/dist/collection/services/WidgetHost.js +621 -621
  26. package/dist/collection/utilities.js +81 -81
  27. package/dist/esm/{WidgetHost-9c337319.js → WidgetHost-a27e693d.js} +615 -615
  28. package/dist/esm/polyfills/core-js.js +0 -0
  29. package/dist/esm/polyfills/dom.js +0 -0
  30. package/dist/esm/polyfills/es5-html-element.js +0 -0
  31. package/dist/esm/polyfills/index.js +0 -0
  32. package/dist/esm/polyfills/system.js +0 -0
  33. package/dist/esm/sqh-close-button.entry.js +25 -25
  34. package/dist/esm/sqh-copy-button_12.entry.js +1134 -1033
  35. package/dist/esm/sqh-referral-code.entry.js +22 -22
  36. package/dist/esm/sqh-rewards-actions.entry.js +26 -26
  37. package/dist/esm-es5/{WidgetHost-9c337319.js → WidgetHost-a27e693d.js} +9432 -9432
  38. package/dist/esm-es5/_commonjsHelpers-1d681858.js +17 -17
  39. package/dist/esm-es5/css-shim-a659079f.js +122 -122
  40. package/dist/esm-es5/dom-4061ceba.js +468 -468
  41. package/dist/esm-es5/en-be593af0.js +1471 -1471
  42. package/dist/esm-es5/index-8ea8b6d8.js +1758 -1758
  43. package/dist/esm-es5/loader.mjs +11 -11
  44. package/dist/esm-es5/sqh-close-button.entry.js +35 -35
  45. package/dist/esm-es5/sqh-copy-button_12.entry.js +9643 -9554
  46. package/dist/esm-es5/sqh-referral-code.entry.js +29 -29
  47. package/dist/esm-es5/sqh-rewards-actions.entry.js +31 -31
  48. package/dist/esm-es5/widget-components.mjs +6 -6
  49. package/dist/types/components/close-button/close-button.d.ts +18 -18
  50. package/dist/types/components/copy-button/copy-button.d.ts +93 -93
  51. package/dist/types/components/copy-link-button/copy-link-button.d.ts +55 -55
  52. package/dist/types/components/global-container/global-container.d.ts +43 -43
  53. package/dist/types/components/image-component/image-component.d.ts +46 -46
  54. package/dist/types/components/partner-stat-component/partner-stat-component.d.ts +52 -52
  55. package/dist/types/components/referral-code/referral-code.d.ts +12 -12
  56. package/dist/types/components/referral-component/referral-component.d.ts +46 -46
  57. package/dist/types/components/referral-list/referral-list.d.ts +242 -242
  58. package/dist/types/components/rewards-actions/rewards-actions.d.ts +25 -25
  59. package/dist/types/components/share-button/share-button.d.ts +82 -82
  60. package/dist/types/components/share-button-container/share-button-container.d.ts +629 -629
  61. package/dist/types/components/stat-component/stat-component.d.ts +50 -50
  62. package/dist/types/components/stats-container/stats-container.d.ts +47 -47
  63. package/dist/types/components/text-component/text-component.d.ts +70 -70
  64. package/dist/types/global/global.d.ts +4 -4
  65. package/dist/types/saasquatch.d.ts +103 -103
  66. package/dist/types/services/FormatJs.d.ts +7 -7
  67. package/dist/types/services/WidgetHost.d.ts +45 -45
  68. package/dist/types/utilities.d.ts +7 -7
  69. package/dist/widget-components/entrypoint.js +32 -32
  70. package/dist/widget-components/p-24fc4ba9.js +1 -1
  71. package/dist/widget-components/p-46109683.js +3 -3
  72. package/dist/widget-components/p-58be1132.system.js +1 -1
  73. package/dist/widget-components/{p-54ea7a00.entry.js → p-650d012d.entry.js} +1 -1
  74. package/dist/widget-components/p-908068c2.system.entry.js +1 -0
  75. package/dist/widget-components/{p-edd43dbc.js → p-9525bf4a.js} +0 -0
  76. package/dist/widget-components/{p-8e232564.system.js → p-9adc7c50.system.js} +0 -0
  77. package/dist/widget-components/{p-b17efca4.system.entry.js → p-c0cdba77.system.entry.js} +1 -1
  78. package/dist/widget-components/{p-366f1663.entry.js → p-d4b27c72.entry.js} +1 -1
  79. package/dist/widget-components/{p-d416634a.entry.js → p-d7059393.entry.js} +16 -16
  80. package/dist/widget-components/p-fba5ea7f.system.entry.js +8 -0
  81. package/dist/widget-components/widget-components.esm.js +1 -1
  82. package/dist/widget-components/widget-components.js +1 -1
  83. package/docs/raisins.json +1 -1
  84. package/package.json +96 -96
  85. package/readme.md +52 -52
  86. package/dist/widget-components/p-c8bc8c77.system.entry.js +0 -1
  87. package/dist/widget-components/p-d97c955d.system.entry.js +0 -8
@@ -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-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);
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);
88
88
  };
89
89
 
90
90
  /*
@@ -832,6 +832,21 @@ 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
+
835
850
  // https://github.com/thysultan/stylis.js/tree/master/plugins/rule-sheet
836
851
  // inlined to avoid umd wrapper and peerDep warnings/installing stylis
837
852
  // since we use stylis after closure compiler
@@ -906,6 +921,35 @@ var ruleSheet = function ruleSheet(context, content, selectors, parents, line, c
906
921
  }
907
922
  }
908
923
  };
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
+ });
909
953
 
910
954
  var createCache = function createCache(options) {
911
955
  if (options === undefined) options = {};
@@ -924,7 +968,7 @@ var createCache = function createCache(options) {
924
968
 
925
969
  var container;
926
970
 
927
- {
971
+ if (isBrowser) {
928
972
  container = options.container || document.head;
929
973
  var nodes = document.querySelectorAll("style[data-emotion-" + key + "]");
930
974
  Array.prototype.forEach.call(nodes, function (node) {
@@ -942,7 +986,7 @@ var createCache = function createCache(options) {
942
986
 
943
987
  var _insert;
944
988
 
945
- {
989
+ if (isBrowser) {
946
990
  stylis.use(options.stylisPlugins)(ruleSheet);
947
991
 
948
992
  _insert = function insert(selector, serialized, sheet, shouldCache) {
@@ -955,6 +999,54 @@ var createCache = function createCache(options) {
955
999
  cache.inserted[name] = true;
956
1000
  }
957
1001
  };
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
+ };
958
1050
  }
959
1051
 
960
1052
  var cache = {
@@ -1303,7 +1395,7 @@ var serializeStyles = function serializeStyles(args, registered, mergedProps) {
1303
1395
  };
1304
1396
  };
1305
1397
 
1306
- var isBrowser = "object" !== 'undefined';
1398
+ var isBrowser$1 = typeof document !== 'undefined';
1307
1399
  function getRegisteredStyles(registered, registeredStyles, classNames) {
1308
1400
  var rawClassName = '';
1309
1401
  classNames.split(' ').forEach(function (className) {
@@ -1327,18 +1419,27 @@ var insertStyles = function insertStyles(cache, serialized, isStringTag) {
1327
1419
  // in node since emotion-server relies on whether a style is in
1328
1420
  // the registered cache to know whether a style is global or not
1329
1421
  // also, note that this check will be dead code eliminated in the browser
1330
- isBrowser === false ) && cache.registered[className] === undefined) {
1422
+ isBrowser$1 === false && cache.compat !== undefined) && cache.registered[className] === undefined) {
1331
1423
  cache.registered[className] = serialized.styles;
1332
1424
  }
1333
1425
 
1334
1426
  if (cache.inserted[serialized.name] === undefined) {
1427
+ var stylesForSSR = '';
1335
1428
  var current = serialized;
1336
1429
 
1337
1430
  do {
1338
1431
  var maybeStyles = cache.insert("." + className, current, cache.sheet, true);
1339
1432
 
1433
+ if (!isBrowser$1 && maybeStyles !== undefined) {
1434
+ stylesForSSR += maybeStyles;
1435
+ }
1436
+
1340
1437
  current = current.next;
1341
1438
  } while (current !== undefined);
1439
+
1440
+ if (!isBrowser$1 && stylesForSSR.length !== 0) {
1441
+ return stylesForSSR;
1442
+ }
1342
1443
  }
1343
1444
  };
1344
1445
 
@@ -2451,226 +2552,226 @@ const Clipboard = _commonjsHelpers.unwrapExports(clipboard);
2451
2552
 
2452
2553
  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}";
2453
2554
 
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
- };
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
+ };
2525
2626
  CopyButton.style = copyButtonCss;
2526
2627
 
2527
2628
  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}}";
2528
2629
 
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
- };
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
+ };
2589
2690
  CopyLinkButton.style = copyLinkButtonCss;
2590
2691
 
2591
2692
  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)}}";
2592
2693
 
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://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 })));
2613
- }
2614
- };
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
+ };
2615
2716
  GlobalContainer.style = globalContainerCss;
2616
2717
 
2617
2718
  const imageComponentCss = "sqh-image-component{display:block}sqh-image-component div{position:relative}sqh-image-component img{max-width:100%;height:auto}";
2618
2719
 
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
- };
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
+ };
2640
2741
  ImageComponent.style = imageComponentCss;
2641
2742
 
2642
2743
  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}}";
2643
2744
 
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
- };
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
+ };
2674
2775
  PartnerStatComponent.style = partnerStatComponentCss;
2675
2776
 
2676
2777
  var TYPE;
@@ -6866,637 +6967,637 @@ RelativeFormat.thresholds = {
6866
6967
  'month-short': 11 // months to year
6867
6968
  };
6868
6969
 
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
- },
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
+ },
6880
6981
  };
6881
6982
 
6882
6983
  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}}";
6883
6984
 
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
- };
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
+ };
7010
7111
  ReferralComponent.style = referralComponentCss;
7011
7112
 
7012
7113
  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}";
7013
7114
 
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
- };
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
+ };
7164
7265
  ReferralList.style = referralListCss;
7165
7266
 
7166
7267
  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}}";
7167
7268
 
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
- };
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
+ };
7225
7326
  ShareButton.style = shareButtonCss;
7226
7327
 
7227
7328
  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}}";
7228
7329
 
7229
- const ShareButtonContainer = class {
7230
- constructor(hostRef) {
7231
- index.registerInstance(this, hostRef);
7232
- /**
7233
- * Email button icon
7234
- *
7235
- * @uiName Email Icon
7236
- * @uiGroup Email
7237
- */
7238
- this.emailicon = "mail";
7239
- /**
7240
- * CSS class name for additional styling.
7241
- *
7242
- * @uiName Email Class Name
7243
- * @uiGroup Email
7244
- */
7245
- this.emailclassName = "email-share";
7246
- /**
7247
- * Facebook button icon
7248
- *
7249
- * @uiName Facebook Icon
7250
- * @uiGroup Facebook
7251
- */
7252
- this.facebookicon = "facebook";
7253
- /**
7254
- * Number to horizontally align the facebook button icon
7255
- *
7256
- * @uiName Facebook Icon Horizontal
7257
- * @uiGroup Facebook
7258
- */
7259
- this.facebookiconhorizontal = 9;
7260
- /**
7261
- * @uiName Facebook Icon Size
7262
- * @uiGroup Facebook
7263
- */
7264
- this.facebookiconsize = 1.2;
7265
- /**
7266
- * Twitter button icon
7267
- *
7268
- * @uiName Twitter Icon
7269
- * @uiGroup Twitter
7270
- */
7271
- this.twittericon = "twitter";
7272
- /**
7273
- * Number to horizontally align the twitter button icon
7274
- *
7275
- * @uiName Twitter Icon Horizontal
7276
- * @uiGroup Twitter
7277
- */
7278
- this.twittericonhorizontal = 9;
7279
- /**
7280
- * @uiName Twitter Icon Size
7281
- * @uiGroup Twitter
7282
- */
7283
- this.twittericonsize = 1.2;
7284
- /**
7285
- * SMS button icon
7286
- *
7287
- * @uiName SMS Icon
7288
- * @uiGroup SMS
7289
- */
7290
- this.smsicon = "chat";
7291
- /**
7292
- * @uiName WhatsApp Text Color
7293
- * @uiGroup WhatsApp
7294
- * @uiWidget color
7295
- * @format color
7296
- * @default "#ffffff"
7297
- */
7298
- this.whatsapptextcolor = "#fff";
7299
- /**
7300
- * WhatsApp button icon
7301
- *
7302
- * @uiName WhatsApp Icon
7303
- * @uiGroup WhatsApp
7304
- */
7305
- this.whatsappicon = "whatsapp";
7306
- /**
7307
- * Number to horizontally align the WhatsApp button icon
7308
- *
7309
- * @uiName WhatsApp Icon Horizontal
7310
- * @uiGroup WhatsApp
7311
- */
7312
- this.whatsappiconhorizontal = 7;
7313
- /**
7314
- * Number to vertically align the WhatsApp button icon
7315
- *
7316
- * @uiName WhatsApp Icon Vertical
7317
- * @uiGroup WhatsApp
7318
- */
7319
- this.whatsappiconvertical = 2;
7320
- /**
7321
- * @uiName WhatsApp Icon Size
7322
- * @uiGroup WhatsApp
7323
- */
7324
- this.whatsappiconsize = 1.4;
7325
- /**
7326
- * Linkedin button icon
7327
- *
7328
- * @uiName Linkedin Icon
7329
- * @uiGroup LinkedIn
7330
- */
7331
- this.linkedinicon = "linkedin";
7332
- /**
7333
- * @uiName Linkedin Icon Size
7334
- * @uiGroup LinkedIn
7335
- */
7336
- this.linkediniconsize = 1.2;
7337
- /**
7338
- * Pinterest button icon
7339
- *
7340
- * @uiName Pinterest Icon
7341
- * @uiGroup Pinterest
7342
- */
7343
- this.pinteresticon = "pinterest";
7344
- /**
7345
- * Number to horizontally align the Pinterest button icon
7346
- *
7347
- * @uiName Pinterest Icon Horizontal
7348
- * @uiGroup Pinterest
7349
- */
7350
- this.pinteresticonhorizontal = 9;
7351
- /**
7352
- * Number to vertically align the Pinterest button icon
7353
- *
7354
- * @uiName Pinterest Icon Vertical
7355
- * @uiGroup Pinterest
7356
- */
7357
- this.pinteresticonvertical = 4;
7358
- /**
7359
- * @uiName Pinterest Icon Size
7360
- * @uiGroup Pinterest
7361
- */
7362
- this.pinteresticonsize = 1.2;
7363
- /**
7364
- * Messenger button icon
7365
- *
7366
- * @uiName Messenger Icon
7367
- * @uiGroup Messenger
7368
- */
7369
- this.messengericon = "messenger";
7370
- /**
7371
- * Number to horizontally align the Messenger button icon
7372
- *
7373
- * @uiName Messenger Icon Horizontal
7374
- * @uiGroup Messenger
7375
- */
7376
- this.messengericonhorizontal = 7;
7377
- /**
7378
- * Number to vertically align the Messenger button icon
7379
- *
7380
- * @uiName Messenger Icon Vertical
7381
- * @uiGroup Messenger
7382
- */
7383
- this.messengericonvertical = 3;
7384
- /**
7385
- * @uiName Messenger Icon Size
7386
- * @uiGroup Messenger
7387
- */
7388
- this.messengericonsize = 1.4;
7389
- /**
7390
- * Line button icon
7391
- *
7392
- * @uiName Line Icon
7393
- * @uiGroup Line Messenger
7394
- */
7395
- this.lineicon = "line";
7396
- /**
7397
- * Number to horizontally align the Line button icon
7398
- *
7399
- * @uiName Line Icon Horizontal
7400
- * @uiGroup Line Messenger
7401
- */
7402
- this.lineiconhorizontal = -2;
7403
- /**
7404
- * Number to vertically align the Line button icon
7405
- *
7406
- * @uiName Line Icon Vertical
7407
- * @uiGroup Line Messenger
7408
- */
7409
- this.lineiconvertical = -5;
7410
- /**
7411
- * @uiName Line Icon Size
7412
- * @uiGroup Line Messenger
7413
- */
7414
- this.lineiconsize = 2.2;
7415
- }
7416
- componentWillLoad() {
7417
- if (!this.ishidden) {
7418
- const mediums = [
7419
- "EMAIL",
7420
- "FACEBOOK",
7421
- "TWITTER",
7422
- "SMS",
7423
- "WHATSAPP",
7424
- "LINKEDIN",
7425
- "PINTEREST",
7426
- "FBMESSENGER",
7427
- "LINEMESSENGER",
7428
- ];
7429
- return this.getMessageLinks(mediums);
7430
- }
7431
- }
7432
- getMessageLinks(mediums) {
7433
- return WidgetHost.API.graphql
7434
- .getMessageLinks(mediums)
7435
- .then((res) => {
7436
- this.emailurl = res.EMAIL;
7437
- this.facebookurl = res.FACEBOOK;
7438
- this.twitterurl = res.TWITTER;
7439
- this.smsurl = res.SMS;
7440
- this.whatsappurl = res.WHATSAPP;
7441
- this.linkedinurl = res.LINKEDIN;
7442
- this.pinteresturl = res.PINTEREST;
7443
- this.messengerurl = res.FBMESSENGER;
7444
- this.lineurl = res.LINEMESSENGER;
7445
- })
7446
- .catch((e) => {
7447
- this.onError(e);
7448
- });
7449
- }
7450
- onError(e) {
7451
- console.log("Error loading via GraphQL.", e);
7452
- }
7453
- render() {
7454
- 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 }));
7455
- 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 }));
7456
- 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 }));
7457
- 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 }));
7458
- 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 }));
7459
- 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 }));
7460
- 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 }));
7461
- 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 }));
7462
- 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 }));
7463
- return (!this.ishidden && (index.h("div", null, emailBtn, facebookBtn, twitterBtn, smsBtn, whatsappBtn, linkedinBtn, pinterestBtn, messengerBtn, lineBtn)));
7464
- }
7465
- };
7330
+ const ShareButtonContainer = class {
7331
+ constructor(hostRef) {
7332
+ index.registerInstance(this, hostRef);
7333
+ /**
7334
+ * Email button icon
7335
+ *
7336
+ * @uiName Email Icon
7337
+ * @uiGroup Email
7338
+ */
7339
+ this.emailicon = "mail";
7340
+ /**
7341
+ * CSS class name for additional styling.
7342
+ *
7343
+ * @uiName Email Class Name
7344
+ * @uiGroup Email
7345
+ */
7346
+ this.emailclassName = "email-share";
7347
+ /**
7348
+ * Facebook button icon
7349
+ *
7350
+ * @uiName Facebook Icon
7351
+ * @uiGroup Facebook
7352
+ */
7353
+ this.facebookicon = "facebook";
7354
+ /**
7355
+ * Number to horizontally align the facebook button icon
7356
+ *
7357
+ * @uiName Facebook Icon Horizontal
7358
+ * @uiGroup Facebook
7359
+ */
7360
+ this.facebookiconhorizontal = 9;
7361
+ /**
7362
+ * @uiName Facebook Icon Size
7363
+ * @uiGroup Facebook
7364
+ */
7365
+ this.facebookiconsize = 1.2;
7366
+ /**
7367
+ * Twitter button icon
7368
+ *
7369
+ * @uiName Twitter Icon
7370
+ * @uiGroup Twitter
7371
+ */
7372
+ this.twittericon = "twitter";
7373
+ /**
7374
+ * Number to horizontally align the twitter button icon
7375
+ *
7376
+ * @uiName Twitter Icon Horizontal
7377
+ * @uiGroup Twitter
7378
+ */
7379
+ this.twittericonhorizontal = 9;
7380
+ /**
7381
+ * @uiName Twitter Icon Size
7382
+ * @uiGroup Twitter
7383
+ */
7384
+ this.twittericonsize = 1.2;
7385
+ /**
7386
+ * SMS button icon
7387
+ *
7388
+ * @uiName SMS Icon
7389
+ * @uiGroup SMS
7390
+ */
7391
+ this.smsicon = "chat";
7392
+ /**
7393
+ * @uiName WhatsApp Text Color
7394
+ * @uiGroup WhatsApp
7395
+ * @uiWidget color
7396
+ * @format color
7397
+ * @default "#ffffff"
7398
+ */
7399
+ this.whatsapptextcolor = "#fff";
7400
+ /**
7401
+ * WhatsApp button icon
7402
+ *
7403
+ * @uiName WhatsApp Icon
7404
+ * @uiGroup WhatsApp
7405
+ */
7406
+ this.whatsappicon = "whatsapp";
7407
+ /**
7408
+ * Number to horizontally align the WhatsApp button icon
7409
+ *
7410
+ * @uiName WhatsApp Icon Horizontal
7411
+ * @uiGroup WhatsApp
7412
+ */
7413
+ this.whatsappiconhorizontal = 7;
7414
+ /**
7415
+ * Number to vertically align the WhatsApp button icon
7416
+ *
7417
+ * @uiName WhatsApp Icon Vertical
7418
+ * @uiGroup WhatsApp
7419
+ */
7420
+ this.whatsappiconvertical = 2;
7421
+ /**
7422
+ * @uiName WhatsApp Icon Size
7423
+ * @uiGroup WhatsApp
7424
+ */
7425
+ this.whatsappiconsize = 1.4;
7426
+ /**
7427
+ * Linkedin button icon
7428
+ *
7429
+ * @uiName Linkedin Icon
7430
+ * @uiGroup LinkedIn
7431
+ */
7432
+ this.linkedinicon = "linkedin";
7433
+ /**
7434
+ * @uiName Linkedin Icon Size
7435
+ * @uiGroup LinkedIn
7436
+ */
7437
+ this.linkediniconsize = 1.2;
7438
+ /**
7439
+ * Pinterest button icon
7440
+ *
7441
+ * @uiName Pinterest Icon
7442
+ * @uiGroup Pinterest
7443
+ */
7444
+ this.pinteresticon = "pinterest";
7445
+ /**
7446
+ * Number to horizontally align the Pinterest button icon
7447
+ *
7448
+ * @uiName Pinterest Icon Horizontal
7449
+ * @uiGroup Pinterest
7450
+ */
7451
+ this.pinteresticonhorizontal = 9;
7452
+ /**
7453
+ * Number to vertically align the Pinterest button icon
7454
+ *
7455
+ * @uiName Pinterest Icon Vertical
7456
+ * @uiGroup Pinterest
7457
+ */
7458
+ this.pinteresticonvertical = 4;
7459
+ /**
7460
+ * @uiName Pinterest Icon Size
7461
+ * @uiGroup Pinterest
7462
+ */
7463
+ this.pinteresticonsize = 1.2;
7464
+ /**
7465
+ * Messenger button icon
7466
+ *
7467
+ * @uiName Messenger Icon
7468
+ * @uiGroup Messenger
7469
+ */
7470
+ this.messengericon = "messenger";
7471
+ /**
7472
+ * Number to horizontally align the Messenger button icon
7473
+ *
7474
+ * @uiName Messenger Icon Horizontal
7475
+ * @uiGroup Messenger
7476
+ */
7477
+ this.messengericonhorizontal = 7;
7478
+ /**
7479
+ * Number to vertically align the Messenger button icon
7480
+ *
7481
+ * @uiName Messenger Icon Vertical
7482
+ * @uiGroup Messenger
7483
+ */
7484
+ this.messengericonvertical = 3;
7485
+ /**
7486
+ * @uiName Messenger Icon Size
7487
+ * @uiGroup Messenger
7488
+ */
7489
+ this.messengericonsize = 1.4;
7490
+ /**
7491
+ * Line button icon
7492
+ *
7493
+ * @uiName Line Icon
7494
+ * @uiGroup Line Messenger
7495
+ */
7496
+ this.lineicon = "line";
7497
+ /**
7498
+ * Number to horizontally align the Line button icon
7499
+ *
7500
+ * @uiName Line Icon Horizontal
7501
+ * @uiGroup Line Messenger
7502
+ */
7503
+ this.lineiconhorizontal = -2;
7504
+ /**
7505
+ * Number to vertically align the Line button icon
7506
+ *
7507
+ * @uiName Line Icon Vertical
7508
+ * @uiGroup Line Messenger
7509
+ */
7510
+ this.lineiconvertical = -5;
7511
+ /**
7512
+ * @uiName Line Icon Size
7513
+ * @uiGroup Line Messenger
7514
+ */
7515
+ this.lineiconsize = 2.2;
7516
+ }
7517
+ componentWillLoad() {
7518
+ if (!this.ishidden) {
7519
+ const mediums = [
7520
+ "EMAIL",
7521
+ "FACEBOOK",
7522
+ "TWITTER",
7523
+ "SMS",
7524
+ "WHATSAPP",
7525
+ "LINKEDIN",
7526
+ "PINTEREST",
7527
+ "FBMESSENGER",
7528
+ "LINEMESSENGER",
7529
+ ];
7530
+ return this.getMessageLinks(mediums);
7531
+ }
7532
+ }
7533
+ getMessageLinks(mediums) {
7534
+ return WidgetHost.API.graphql
7535
+ .getMessageLinks(mediums)
7536
+ .then((res) => {
7537
+ this.emailurl = res.EMAIL;
7538
+ this.facebookurl = res.FACEBOOK;
7539
+ this.twitterurl = res.TWITTER;
7540
+ this.smsurl = res.SMS;
7541
+ this.whatsappurl = res.WHATSAPP;
7542
+ this.linkedinurl = res.LINKEDIN;
7543
+ this.pinteresturl = res.PINTEREST;
7544
+ this.messengerurl = res.FBMESSENGER;
7545
+ this.lineurl = res.LINEMESSENGER;
7546
+ })
7547
+ .catch((e) => {
7548
+ this.onError(e);
7549
+ });
7550
+ }
7551
+ onError(e) {
7552
+ console.log("Error loading via GraphQL.", e);
7553
+ }
7554
+ render() {
7555
+ 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 }));
7556
+ 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 }));
7557
+ 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 }));
7558
+ 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 }));
7559
+ 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 }));
7560
+ 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 }));
7561
+ 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 }));
7562
+ 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 }));
7563
+ 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 }));
7564
+ return (!this.ishidden && (index.h("div", null, emailBtn, facebookBtn, twitterBtn, smsBtn, whatsappBtn, linkedinBtn, pinterestBtn, messengerBtn, lineBtn)));
7565
+ }
7566
+ };
7466
7567
  ShareButtonContainer.style = shareButtonContainerCss;
7467
7568
 
7468
7569
  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}}";
7469
7570
 
7470
- const StatComponent = class {
7471
- constructor(hostRef) {
7472
- index.registerInstance(this, hostRef);
7473
- this.statTypeUpdated = index.createEvent(this, "statTypeUpdated", 7);
7474
- this.statAdded = index.createEvent(this, "statAdded", 7);
7475
- }
7476
- componentWillLoad() {
7477
- this.statAddedHandler(this.elem);
7478
- }
7479
- stattypeHandler(newValue, oldValue) {
7480
- if (newValue !== oldValue)
7481
- this.statTypeUpdatedHandler(this.elem);
7482
- }
7483
- statAddedHandler(stat) {
7484
- this.statAdded.emit(stat);
7485
- }
7486
- statTypeUpdatedHandler(stat) {
7487
- this.statTypeUpdated.emit(stat);
7488
- }
7489
- render() {
7490
- const clz = css `
7491
- color: ${this.statcolor};
7492
- `;
7493
- return (!this.ishidden && (index.h("div", { class: clz }, index.h("div", { class: "stat-value" }, this.statvalue), index.h("div", { class: "stat-description" }, this.statdescription))));
7494
- }
7495
- get elem() { return index.getElement(this); }
7496
- static get watchers() { return {
7497
- "stattype": ["stattypeHandler"]
7498
- }; }
7499
- };
7571
+ const StatComponent = class {
7572
+ constructor(hostRef) {
7573
+ index.registerInstance(this, hostRef);
7574
+ this.statTypeUpdated = index.createEvent(this, "statTypeUpdated", 7);
7575
+ this.statAdded = index.createEvent(this, "statAdded", 7);
7576
+ }
7577
+ componentWillLoad() {
7578
+ this.statAddedHandler(this.elem);
7579
+ }
7580
+ stattypeHandler(newValue, oldValue) {
7581
+ if (newValue !== oldValue)
7582
+ this.statTypeUpdatedHandler(this.elem);
7583
+ }
7584
+ statAddedHandler(stat) {
7585
+ this.statAdded.emit(stat);
7586
+ }
7587
+ statTypeUpdatedHandler(stat) {
7588
+ this.statTypeUpdated.emit(stat);
7589
+ }
7590
+ render() {
7591
+ const clz = css `
7592
+ color: ${this.statcolor};
7593
+ `;
7594
+ return (!this.ishidden && (index.h("div", { class: clz }, index.h("div", { class: "stat-value" }, this.statvalue), index.h("div", { class: "stat-description" }, this.statdescription))));
7595
+ }
7596
+ get elem() { return index.getElement(this); }
7597
+ static get watchers() { return {
7598
+ "stattype": ["stattypeHandler"]
7599
+ }; }
7600
+ };
7500
7601
  StatComponent.style = statComponentCss;
7501
7602
 
7502
7603
  /**
@@ -7794,108 +7895,108 @@ function pathToRegexp(path, keys, options) {
7794
7895
 
7795
7896
  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%}}";
7796
7897
 
7797
- const StatsContainer = class {
7798
- constructor(hostRef) {
7799
- index.registerInstance(this, hostRef);
7800
- /**
7801
- * @undocumented
7802
- * @uiName Is Hidden
7803
- */
7804
- this.ishidden = false;
7805
- this.statPaths = [
7806
- "/rewardBalance/:type/:unit/:valuetype?/:isGlobal?",
7807
- "/:statName",
7808
- ];
7809
- this.statPathRegexp = this.statPaths.map((path) => {
7810
- const keys = [];
7811
- const regexp = pathToRegexp(path, keys);
7812
- return { regexp, keys };
7813
- });
7814
- this.loading = true;
7815
- }
7816
- componentWillLoad() {
7817
- if (!this.ishidden) {
7818
- return WidgetHost.API.graphql
7819
- .getStats()
7820
- .then((res) => {
7821
- this.stats = {
7822
- referralsCount: res.referralsCount.totalCount,
7823
- referralsMonth: res.referralsMonth.totalCount,
7824
- referralsWeek: res.referralsWeek.totalCount,
7825
- rewardsCount: res.rewardsCount.totalCount,
7826
- rewardsMonth: res.rewardsMonth.totalCount,
7827
- rewardsWeek: res.rewardsWeek.totalCount,
7828
- rewardBalance: res.rewardBalances,
7829
- rewardBalanceGlobal: res.rewardBalancesGlobal,
7830
- };
7831
- this.loading = false;
7832
- })
7833
- .then(() => {
7834
- const children = Array.from(this.container.querySelectorAll("[stattype]"));
7835
- children.map((child) => {
7836
- this.setStatValue(child);
7837
- });
7838
- })
7839
- .catch((e) => {
7840
- this.onError(e);
7841
- });
7842
- }
7843
- }
7844
- statTypeUpdatedHandler(event) {
7845
- this.setStatValue(event.detail);
7846
- }
7847
- statAddedHandler(event) {
7848
- if (this.stats)
7849
- this.setStatValue(event.detail);
7850
- }
7851
- setStatValue(child) {
7852
- const path = child.getAttribute("stattype");
7853
- const stat = this.getStatFromPath(path);
7854
- child.setAttribute("statvalue", `${stat}`);
7855
- return child;
7856
- }
7857
- getStatFromPath(path) {
7858
- const statPath = this.statPathRegexp.find((stat) => stat.regexp.test(path));
7859
- if (!statPath)
7860
- return 0;
7861
- const { keys, regexp } = statPath;
7862
- const res = regexp.exec(path);
7863
- const statVariables = {};
7864
- keys.forEach((k, i) => (statVariables[k.name] = res[i + 1]));
7865
- return this.getStatValue(statVariables);
7866
- }
7867
- getStatValue(statVariables) {
7868
- if (statVariables.statName)
7869
- return this.stats[statVariables.statName] || 0;
7870
- return this.getRewardBalance(statVariables);
7871
- }
7872
- getRewardBalance(statVariables) {
7873
- const { type, unit, valuetype, isGlobal } = statVariables;
7874
- // passing in CASH/USD as CASH_USD into this webcomponent so pathToRegexp doesn't split it and it stays all in unit.
7875
- // this converts the _ back to / so it matches the unit from the backend.
7876
- // possibly change the unit in the backend to avoid this?
7877
- const newUnit = unit.replace(/_/, "/");
7878
- const rewardBalance = this.stats[isGlobal ? "rewardBalanceGlobal" : "rewardBalance"].find((rb) => rb.type === type && rb.unit === newUnit);
7879
- if (!rewardBalance)
7880
- return 0;
7881
- if (valuetype)
7882
- return rewardBalance[valuetype];
7883
- return rewardBalance.value;
7884
- }
7885
- onError(e) {
7886
- console.log("Error loading via GraphQL.", e);
7887
- this.loading = false;
7888
- }
7889
- render() {
7890
- const containerStyle = css `
7891
- display: ${this.ishidden ? "none" : "inherit"};
7892
- padding-top: ${this.paddingtop}px;
7893
- padding-bottom: ${this.paddingbottom}px;
7894
- `;
7895
- return (index.h("div", { class: containerStyle }, index.h("slot", null)));
7896
- }
7897
- get container() { return index.getElement(this); }
7898
- };
7898
+ const StatsContainer = class {
7899
+ constructor(hostRef) {
7900
+ index.registerInstance(this, hostRef);
7901
+ /**
7902
+ * @undocumented
7903
+ * @uiName Is Hidden
7904
+ */
7905
+ this.ishidden = false;
7906
+ this.statPaths = [
7907
+ "/rewardBalance/:type/:unit/:valuetype?/:isGlobal?",
7908
+ "/:statName",
7909
+ ];
7910
+ this.statPathRegexp = this.statPaths.map((path) => {
7911
+ const keys = [];
7912
+ const regexp = pathToRegexp(path, keys);
7913
+ return { regexp, keys };
7914
+ });
7915
+ this.loading = true;
7916
+ }
7917
+ componentWillLoad() {
7918
+ if (!this.ishidden) {
7919
+ return WidgetHost.API.graphql
7920
+ .getStats()
7921
+ .then((res) => {
7922
+ this.stats = {
7923
+ referralsCount: res.referralsCount.totalCount,
7924
+ referralsMonth: res.referralsMonth.totalCount,
7925
+ referralsWeek: res.referralsWeek.totalCount,
7926
+ rewardsCount: res.rewardsCount.totalCount,
7927
+ rewardsMonth: res.rewardsMonth.totalCount,
7928
+ rewardsWeek: res.rewardsWeek.totalCount,
7929
+ rewardBalance: res.rewardBalances,
7930
+ rewardBalanceGlobal: res.rewardBalancesGlobal,
7931
+ };
7932
+ this.loading = false;
7933
+ })
7934
+ .then(() => {
7935
+ const children = Array.from(this.container.querySelectorAll("[stattype]"));
7936
+ children.map((child) => {
7937
+ this.setStatValue(child);
7938
+ });
7939
+ })
7940
+ .catch((e) => {
7941
+ this.onError(e);
7942
+ });
7943
+ }
7944
+ }
7945
+ statTypeUpdatedHandler(event) {
7946
+ this.setStatValue(event.detail);
7947
+ }
7948
+ statAddedHandler(event) {
7949
+ if (this.stats)
7950
+ this.setStatValue(event.detail);
7951
+ }
7952
+ setStatValue(child) {
7953
+ const path = child.getAttribute("stattype");
7954
+ const stat = this.getStatFromPath(path);
7955
+ child.setAttribute("statvalue", `${stat}`);
7956
+ return child;
7957
+ }
7958
+ getStatFromPath(path) {
7959
+ const statPath = this.statPathRegexp.find((stat) => stat.regexp.test(path));
7960
+ if (!statPath)
7961
+ return 0;
7962
+ const { keys, regexp } = statPath;
7963
+ const res = regexp.exec(path);
7964
+ const statVariables = {};
7965
+ keys.forEach((k, i) => (statVariables[k.name] = res[i + 1]));
7966
+ return this.getStatValue(statVariables);
7967
+ }
7968
+ getStatValue(statVariables) {
7969
+ if (statVariables.statName)
7970
+ return this.stats[statVariables.statName] || 0;
7971
+ return this.getRewardBalance(statVariables);
7972
+ }
7973
+ getRewardBalance(statVariables) {
7974
+ const { type, unit, valuetype, isGlobal } = statVariables;
7975
+ // passing in CASH/USD as CASH_USD into this webcomponent so pathToRegexp doesn't split it and it stays all in unit.
7976
+ // this converts the _ back to / so it matches the unit from the backend.
7977
+ // possibly change the unit in the backend to avoid this?
7978
+ const newUnit = unit.replace(/_/, "/");
7979
+ const rewardBalance = this.stats[isGlobal ? "rewardBalanceGlobal" : "rewardBalance"].find((rb) => rb.type === type && rb.unit === newUnit);
7980
+ if (!rewardBalance)
7981
+ return 0;
7982
+ if (valuetype)
7983
+ return rewardBalance[valuetype];
7984
+ return rewardBalance.value;
7985
+ }
7986
+ onError(e) {
7987
+ console.log("Error loading via GraphQL.", e);
7988
+ this.loading = false;
7989
+ }
7990
+ render() {
7991
+ const containerStyle = css `
7992
+ display: ${this.ishidden ? "none" : "inherit"};
7993
+ padding-top: ${this.paddingtop}px;
7994
+ padding-bottom: ${this.paddingbottom}px;
7995
+ `;
7996
+ return (index.h("div", { class: containerStyle }, index.h("slot", null)));
7997
+ }
7998
+ get container() { return index.getElement(this); }
7999
+ };
7899
8000
  StatsContainer.style = statsContainerCss;
7900
8001
 
7901
8002
  var marked = _commonjsHelpers.createCommonjsModule(function (module, exports) {
@@ -10496,37 +10597,37 @@ var marked = _commonjsHelpers.createCommonjsModule(function (module, exports) {
10496
10597
 
10497
10598
  const textComponentCss = "sqh-text-component{display:block}sqh-text-component p{margin:0}";
10498
10599
 
10499
- const TextComponent = class {
10500
- constructor(hostRef) {
10501
- index.registerInstance(this, hostRef);
10502
- }
10503
- render() {
10504
- 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;
10505
- const textStyle = css `
10506
- font-family: ${this.fontfamily || "inherit"};
10507
- font-size: ${this.fontsize ? this.fontsize + "px" : "inherit"};
10508
- text-align: ${this.textalign};
10509
- color: ${this.color || "inherit"};
10510
- padding-top: ${this.paddingtop ? this.paddingtop + "px" : "inherit"};
10511
- padding-bottom: ${this.paddingbottom
10512
- ? this.paddingbottom + "px"
10513
- : "inherit"};
10514
- overflow-wrap: break-word;
10515
- `;
10516
- const divStyle = css `
10517
- background: ${this.background
10518
- ? this.background.match(regex)
10519
- ? `url(${this.background}) no-repeat center center;`
10520
- : this.background
10521
- : "inherit"};
10522
- height: ${this.height || "inherit"};
10523
- background-size: contain;
10524
- `;
10525
- const content = this.ismarkdown ? (index.h("div", { innerHTML: marked(this.text) })) : (this.text);
10526
- return (!this.ishidden && (index.h("div", { class: divStyle }, index.h("p", { class: textStyle }, content))));
10527
- }
10528
- get textEl() { return index.getElement(this); }
10529
- };
10600
+ const TextComponent = class {
10601
+ constructor(hostRef) {
10602
+ index.registerInstance(this, hostRef);
10603
+ }
10604
+ render() {
10605
+ 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;
10606
+ const textStyle = css `
10607
+ font-family: ${this.fontfamily || "inherit"};
10608
+ font-size: ${this.fontsize ? this.fontsize + "px" : "inherit"};
10609
+ text-align: ${this.textalign};
10610
+ color: ${this.color || "inherit"};
10611
+ padding-top: ${this.paddingtop ? this.paddingtop + "px" : "inherit"};
10612
+ padding-bottom: ${this.paddingbottom
10613
+ ? this.paddingbottom + "px"
10614
+ : "inherit"};
10615
+ overflow-wrap: break-word;
10616
+ `;
10617
+ const divStyle = css `
10618
+ background: ${this.background
10619
+ ? this.background.match(regex)
10620
+ ? `url(${this.background}) no-repeat center center;`
10621
+ : this.background
10622
+ : "inherit"};
10623
+ height: ${this.height || "inherit"};
10624
+ background-size: contain;
10625
+ `;
10626
+ const content = this.ismarkdown ? (index.h("div", { innerHTML: marked(this.text) })) : (this.text);
10627
+ return (!this.ishidden && (index.h("div", { class: divStyle }, index.h("p", { class: textStyle }, content))));
10628
+ }
10629
+ get textEl() { return index.getElement(this); }
10630
+ };
10530
10631
  TextComponent.style = textComponentCss;
10531
10632
 
10532
10633
  exports.sqh_copy_button = CopyButton;