@saasquatch/vanilla-components 1.2.4 → 1.2.5-1

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 (84) hide show
  1. package/dist/cjs/{WidgetHost-d7b870ce.js → WidgetHost-fce29ef5.js} +420 -420
  2. package/dist/cjs/sqh-close-button.cjs.entry.js +25 -25
  3. package/dist/cjs/sqh-copy-button_12.cjs.entry.js +870 -971
  4. package/dist/cjs/sqh-referral-code.cjs.entry.js +22 -22
  5. package/dist/cjs/sqh-rewards-actions.cjs.entry.js +26 -26
  6. package/dist/collection/components/close-button/close-button.js +68 -68
  7. package/dist/collection/components/copy-button/copy-button.js +358 -358
  8. package/dist/collection/components/copy-link-button/copy-link-button.js +215 -215
  9. package/dist/collection/components/global-container/global-container.js +151 -151
  10. package/dist/collection/components/image-component/image-component.js +165 -165
  11. package/dist/collection/components/partner-stat-component/partner-stat-component.js +194 -194
  12. package/dist/collection/components/referral-code/referral-code.js +36 -36
  13. package/dist/collection/components/referral-component/referral-component.js +255 -255
  14. package/dist/collection/components/referral-list/referral-list.js +860 -860
  15. package/dist/collection/components/rewards-actions/rewards-actions.js +105 -105
  16. package/dist/collection/components/share-button/share-button.js +282 -282
  17. package/dist/collection/components/share-button-container/share-button-container.js +2384 -2384
  18. package/dist/collection/components/stat-component/stat-component.js +194 -194
  19. package/dist/collection/components/stats-container/stats-container.js +206 -206
  20. package/dist/collection/components/text-component/text-component.js +291 -291
  21. package/dist/collection/global/global.js +4 -4
  22. package/dist/collection/services/FormatJs.js +15 -15
  23. package/dist/collection/services/WidgetHost.js +426 -426
  24. package/dist/collection/utilities.js +81 -81
  25. package/dist/esm/{WidgetHost-a27e693d.js → WidgetHost-903fb7cc.js} +420 -420
  26. package/dist/esm/polyfills/core-js.js +0 -0
  27. package/dist/esm/polyfills/dom.js +0 -0
  28. package/dist/esm/polyfills/es5-html-element.js +0 -0
  29. package/dist/esm/polyfills/index.js +0 -0
  30. package/dist/esm/polyfills/system.js +0 -0
  31. package/dist/esm/sqh-close-button.entry.js +25 -25
  32. package/dist/esm/sqh-copy-button_12.entry.js +870 -971
  33. package/dist/esm/sqh-referral-code.entry.js +22 -22
  34. package/dist/esm/sqh-rewards-actions.entry.js +26 -26
  35. package/dist/esm-es5/{WidgetHost-a27e693d.js → WidgetHost-903fb7cc.js} +9432 -9432
  36. package/dist/esm-es5/_commonjsHelpers-1d681858.js +17 -17
  37. package/dist/esm-es5/css-shim-a659079f.js +122 -122
  38. package/dist/esm-es5/dom-4061ceba.js +468 -468
  39. package/dist/esm-es5/en-be593af0.js +1471 -1471
  40. package/dist/esm-es5/index-8ea8b6d8.js +1758 -1758
  41. package/dist/esm-es5/loader.mjs +11 -11
  42. package/dist/esm-es5/sqh-close-button.entry.js +35 -35
  43. package/dist/esm-es5/sqh-copy-button_12.entry.js +9535 -9624
  44. package/dist/esm-es5/sqh-referral-code.entry.js +29 -29
  45. package/dist/esm-es5/sqh-rewards-actions.entry.js +31 -31
  46. package/dist/esm-es5/widget-components.mjs +6 -6
  47. package/dist/types/components/close-button/close-button.d.ts +16 -16
  48. package/dist/types/components/copy-button/copy-button.d.ts +90 -90
  49. package/dist/types/components/copy-link-button/copy-link-button.d.ts +53 -53
  50. package/dist/types/components/global-container/global-container.d.ts +39 -39
  51. package/dist/types/components/image-component/image-component.d.ts +45 -45
  52. package/dist/types/components/partner-stat-component/partner-stat-component.d.ts +51 -51
  53. package/dist/types/components/referral-code/referral-code.d.ts +12 -12
  54. package/dist/types/components/referral-component/referral-component.d.ts +46 -46
  55. package/dist/types/components/referral-list/referral-list.d.ts +234 -234
  56. package/dist/types/components/rewards-actions/rewards-actions.d.ts +25 -25
  57. package/dist/types/components/share-button/share-button.d.ts +77 -77
  58. package/dist/types/components/share-button-container/share-button-container.d.ts +593 -593
  59. package/dist/types/components/stat-component/stat-component.d.ts +48 -48
  60. package/dist/types/components/stats-container/stats-container.d.ts +47 -47
  61. package/dist/types/components/text-component/text-component.d.ts +74 -74
  62. package/dist/types/components.d.ts +4 -4
  63. package/dist/types/global/global.d.ts +4 -4
  64. package/dist/types/services/FormatJs.d.ts +7 -7
  65. package/dist/types/services/WidgetHost.d.ts +45 -45
  66. package/dist/types/utilities.d.ts +7 -7
  67. package/dist/widget-components/{p-650d012d.entry.js → p-131a5c4a.entry.js} +1 -1
  68. package/dist/widget-components/p-1b8f2cfc.system.entry.js +8 -0
  69. package/dist/widget-components/p-24fc4ba9.js +1 -1
  70. package/dist/widget-components/p-46109683.js +3 -3
  71. package/dist/widget-components/{p-d4b27c72.entry.js → p-50ae8f2b.entry.js} +1 -1
  72. package/dist/widget-components/p-58be1132.system.js +1 -1
  73. package/dist/widget-components/{p-0bfec452.entry.js → p-8baa34a0.entry.js} +16 -16
  74. package/dist/widget-components/{p-c0cdba77.system.entry.js → p-b9fcb846.system.entry.js} +1 -1
  75. package/dist/widget-components/p-da180bcd.system.entry.js +1 -0
  76. package/dist/widget-components/{p-9adc7c50.system.js → p-e692beaf.system.js} +0 -0
  77. package/dist/widget-components/{p-9525bf4a.js → p-ffeb02d1.js} +0 -0
  78. package/dist/widget-components/widget-components.esm.js +1 -1
  79. package/dist/widget-components/widget-components.js +1 -1
  80. package/docs/raisins.json +1 -1
  81. package/package.json +1 -1
  82. package/CHANGELOG.md +0 -163
  83. package/dist/widget-components/p-796dc228.system.entry.js +0 -8
  84. package/dist/widget-components/p-908068c2.system.entry.js +0 -1
@@ -1,86 +1,86 @@
1
1
  import { r as registerInstance, h, c as createEvent, g as getElement } from './index-8ea8b6d8.js';
2
2
  import { c as createCommonjsModule, a as commonjsGlobal, u as unwrapExports } from './_commonjsHelpers-1d681858.js';
3
- import { A as API } from './WidgetHost-a27e693d.js';
4
-
5
- /////////////////////////////////////
6
- ////// ////
7
- ///// Color Utility Functions /////
8
- //// //////
9
- /////////////////////////////////////
10
- const cutHex = (hex) => {
11
- return hex.charAt(0) == "#" ? hex.substring(1) : hex;
12
- };
13
- const cutRgb = (rgb) => {
14
- return rgb.substring(4, rgb.length - 1);
15
- };
16
- const hexToRgb = (hex) => {
17
- const noHex = cutHex(hex);
18
- const r = parseInt(noHex.substring(0, 2), 16);
19
- const g = parseInt(noHex.substring(2, 4), 16);
20
- const b = parseInt(noHex.substring(4, 6), 16);
21
- return `rgb(${r}, ${g}, ${b})`;
22
- };
23
- const isHex = (string) => {
24
- return !!string.match(/^#[0-9a-f]{6}$/i);
25
- };
26
- const isRgb = (string) => {
27
- const rgbArray = cutRgb(string).split(", ");
28
- if (rgbArray.length !== 3)
29
- return false;
30
- return rgbArray.every((x) => parseInt(x) >= 0 && parseInt(x) <= 255);
31
- };
32
- const shadeColor = (color, percent) => {
33
- if (!isHex(color) && !isRgb(color))
34
- return;
35
- const rgb = isHex(color) ? hexToRgb(color) : color;
36
- const decimalPercent = percent / 100;
37
- const shadedArray = cutRgb(rgb)
38
- .split(", ")
39
- .map((n) => {
40
- return Math.floor(parseInt(n) * (1 - decimalPercent));
41
- });
42
- return `rgb(${shadedArray.join(", ")})`;
43
- };
44
- /////////////////////
45
- ////// ////
46
- ///// Exports /////
47
- //// //////
48
- /////////////////////
49
- const hasClass = (el, className) => {
50
- if (el.classList)
51
- return el.classList.contains(className);
52
- else
53
- return !!el.className.match(new RegExp("(\\s|^)" + className + "(\\s|$)"));
54
- };
55
- const addClass = (el, className) => {
56
- if (el.classList) {
57
- el.classList.add(className);
58
- }
59
- else if (!hasClass(el, className)) {
60
- el.className += " " + className;
61
- }
62
- };
63
- const removeClass = (el, className) => {
64
- if (el.classList) {
65
- el.classList.remove(className);
66
- }
67
- else if (hasClass(el, className)) {
68
- const reg = new RegExp("(\\s|^)" + className + "(\\s|$)");
69
- el.className = el.className.replace(reg, " ");
70
- }
71
- };
72
- const detectMobileSafari = () => {
73
- return /iP(ad|hone|od).+Version\/[\d\.]+.*Safari/i.test(window.navigator.userAgent);
74
- };
75
- const detectMobileChrome = () => {
76
- return window.navigator.userAgent.match("CriOS");
77
- };
78
- // @ts-ignore
79
- // https://gist.github.com/jed/982883
80
- const uuid = function b(a = undefined) {
81
- return a
82
- ? (a ^ ((Math.random() * 16) >> (a / 4))).toString(16)
83
- : ([1e7] + -1e3 + -4e3 + -8e3 + -1e11).replace(/[018]/g, b);
3
+ import { A as API } from './WidgetHost-903fb7cc.js';
4
+
5
+ /////////////////////////////////////
6
+ ////// ////
7
+ ///// Color Utility Functions /////
8
+ //// //////
9
+ /////////////////////////////////////
10
+ const cutHex = (hex) => {
11
+ return hex.charAt(0) == "#" ? hex.substring(1) : hex;
12
+ };
13
+ const cutRgb = (rgb) => {
14
+ return rgb.substring(4, rgb.length - 1);
15
+ };
16
+ const hexToRgb = (hex) => {
17
+ const noHex = cutHex(hex);
18
+ const r = parseInt(noHex.substring(0, 2), 16);
19
+ const g = parseInt(noHex.substring(2, 4), 16);
20
+ const b = parseInt(noHex.substring(4, 6), 16);
21
+ return `rgb(${r}, ${g}, ${b})`;
22
+ };
23
+ const isHex = (string) => {
24
+ return !!string.match(/^#[0-9a-f]{6}$/i);
25
+ };
26
+ const isRgb = (string) => {
27
+ const rgbArray = cutRgb(string).split(", ");
28
+ if (rgbArray.length !== 3)
29
+ return false;
30
+ return rgbArray.every((x) => parseInt(x) >= 0 && parseInt(x) <= 255);
31
+ };
32
+ const shadeColor = (color, percent) => {
33
+ if (!isHex(color) && !isRgb(color))
34
+ return;
35
+ const rgb = isHex(color) ? hexToRgb(color) : color;
36
+ const decimalPercent = percent / 100;
37
+ const shadedArray = cutRgb(rgb)
38
+ .split(", ")
39
+ .map((n) => {
40
+ return Math.floor(parseInt(n) * (1 - decimalPercent));
41
+ });
42
+ return `rgb(${shadedArray.join(", ")})`;
43
+ };
44
+ /////////////////////
45
+ ////// ////
46
+ ///// Exports /////
47
+ //// //////
48
+ /////////////////////
49
+ const hasClass = (el, className) => {
50
+ if (el.classList)
51
+ return el.classList.contains(className);
52
+ else
53
+ return !!el.className.match(new RegExp("(\\s|^)" + className + "(\\s|$)"));
54
+ };
55
+ const addClass = (el, className) => {
56
+ if (el.classList) {
57
+ el.classList.add(className);
58
+ }
59
+ else if (!hasClass(el, className)) {
60
+ el.className += " " + className;
61
+ }
62
+ };
63
+ const removeClass = (el, className) => {
64
+ if (el.classList) {
65
+ el.classList.remove(className);
66
+ }
67
+ else if (hasClass(el, className)) {
68
+ const reg = new RegExp("(\\s|^)" + className + "(\\s|$)");
69
+ el.className = el.className.replace(reg, " ");
70
+ }
71
+ };
72
+ const detectMobileSafari = () => {
73
+ return /iP(ad|hone|od).+Version\/[\d\.]+.*Safari/i.test(window.navigator.userAgent);
74
+ };
75
+ const detectMobileChrome = () => {
76
+ return window.navigator.userAgent.match("CriOS");
77
+ };
78
+ // @ts-ignore
79
+ // https://gist.github.com/jed/982883
80
+ const uuid = function b(a = undefined) {
81
+ return a
82
+ ? (a ^ ((Math.random() * 16) >> (a / 4))).toString(16)
83
+ : ([1e7] + -1e3 + -4e3 + -8e3 + -1e11).replace(/[018]/g, b);
84
84
  };
85
85
 
86
86
  /*
@@ -828,21 +828,6 @@ function stylis_min (W) {
828
828
  return B;
829
829
  }
830
830
 
831
- var weakMemoize = function weakMemoize(func) {
832
- // $FlowFixMe flow doesn't include all non-primitive types as allowed for weakmaps
833
- var cache = new WeakMap();
834
- return function (arg) {
835
- if (cache.has(arg)) {
836
- // $FlowFixMe
837
- return cache.get(arg);
838
- }
839
-
840
- var ret = func(arg);
841
- cache.set(arg, ret);
842
- return ret;
843
- };
844
- };
845
-
846
831
  // https://github.com/thysultan/stylis.js/tree/master/plugins/rule-sheet
847
832
  // inlined to avoid umd wrapper and peerDep warnings/installing stylis
848
833
  // since we use stylis after closure compiler
@@ -917,35 +902,6 @@ var ruleSheet = function ruleSheet(context, content, selectors, parents, line, c
917
902
  }
918
903
  }
919
904
  };
920
- var removeLabel = function removeLabel(context, content) {
921
- if (context === 1 && // charcode for l
922
- content.charCodeAt(0) === 108 && // charcode for b
923
- content.charCodeAt(2) === 98 // this ignores label
924
- ) {
925
- return '';
926
- }
927
- };
928
-
929
- var isBrowser = typeof document !== 'undefined';
930
- var rootServerStylisCache = {};
931
- var getServerStylisCache = isBrowser ? undefined : weakMemoize(function () {
932
- var getCache = weakMemoize(function () {
933
- return {};
934
- });
935
- var prefixTrueCache = {};
936
- var prefixFalseCache = {};
937
- return function (prefix) {
938
- if (prefix === undefined || prefix === true) {
939
- return prefixTrueCache;
940
- }
941
-
942
- if (prefix === false) {
943
- return prefixFalseCache;
944
- }
945
-
946
- return getCache(prefix);
947
- };
948
- });
949
905
 
950
906
  var createCache = function createCache(options) {
951
907
  if (options === undefined) options = {};
@@ -964,7 +920,7 @@ var createCache = function createCache(options) {
964
920
 
965
921
  var container;
966
922
 
967
- if (isBrowser) {
923
+ {
968
924
  container = options.container || document.head;
969
925
  var nodes = document.querySelectorAll("style[data-emotion-" + key + "]");
970
926
  Array.prototype.forEach.call(nodes, function (node) {
@@ -982,7 +938,7 @@ var createCache = function createCache(options) {
982
938
 
983
939
  var _insert;
984
940
 
985
- if (isBrowser) {
941
+ {
986
942
  stylis.use(options.stylisPlugins)(ruleSheet);
987
943
 
988
944
  _insert = function insert(selector, serialized, sheet, shouldCache) {
@@ -995,54 +951,6 @@ var createCache = function createCache(options) {
995
951
  cache.inserted[name] = true;
996
952
  }
997
953
  };
998
- } else {
999
- stylis.use(removeLabel);
1000
- var serverStylisCache = rootServerStylisCache;
1001
-
1002
- if (options.stylisPlugins || options.prefix !== undefined) {
1003
- stylis.use(options.stylisPlugins); // $FlowFixMe
1004
-
1005
- serverStylisCache = getServerStylisCache(options.stylisPlugins || rootServerStylisCache)(options.prefix);
1006
- }
1007
-
1008
- var getRules = function getRules(selector, serialized) {
1009
- var name = serialized.name;
1010
-
1011
- if (serverStylisCache[name] === undefined) {
1012
- serverStylisCache[name] = stylis(selector, serialized.styles);
1013
- }
1014
-
1015
- return serverStylisCache[name];
1016
- };
1017
-
1018
- _insert = function _insert(selector, serialized, sheet, shouldCache) {
1019
- var name = serialized.name;
1020
- var rules = getRules(selector, serialized);
1021
-
1022
- if (cache.compat === undefined) {
1023
- // in regular mode, we don't set the styles on the inserted cache
1024
- // since we don't need to and that would be wasting memory
1025
- // we return them so that they are rendered in a style tag
1026
- if (shouldCache) {
1027
- cache.inserted[name] = true;
1028
- }
1029
-
1030
- return rules;
1031
- } else {
1032
- // in compat mode, we put the styles on the inserted cache so
1033
- // that emotion-server can pull out the styles
1034
- // except when we don't want to cache it which was in Global but now
1035
- // is nowhere but we don't want to do a major right now
1036
- // and just in case we're going to leave the case here
1037
- // it's also not affecting client side bundle size
1038
- // so it's really not a big deal
1039
- if (shouldCache) {
1040
- cache.inserted[name] = rules;
1041
- } else {
1042
- return rules;
1043
- }
1044
- }
1045
- };
1046
954
  }
1047
955
 
1048
956
  var cache = {
@@ -1391,7 +1299,7 @@ var serializeStyles = function serializeStyles(args, registered, mergedProps) {
1391
1299
  };
1392
1300
  };
1393
1301
 
1394
- var isBrowser$1 = typeof document !== 'undefined';
1302
+ var isBrowser = "object" !== 'undefined';
1395
1303
  function getRegisteredStyles(registered, registeredStyles, classNames) {
1396
1304
  var rawClassName = '';
1397
1305
  classNames.split(' ').forEach(function (className) {
@@ -1415,27 +1323,18 @@ var insertStyles = function insertStyles(cache, serialized, isStringTag) {
1415
1323
  // in node since emotion-server relies on whether a style is in
1416
1324
  // the registered cache to know whether a style is global or not
1417
1325
  // also, note that this check will be dead code eliminated in the browser
1418
- isBrowser$1 === false && cache.compat !== undefined) && cache.registered[className] === undefined) {
1326
+ isBrowser === false ) && cache.registered[className] === undefined) {
1419
1327
  cache.registered[className] = serialized.styles;
1420
1328
  }
1421
1329
 
1422
1330
  if (cache.inserted[serialized.name] === undefined) {
1423
- var stylesForSSR = '';
1424
1331
  var current = serialized;
1425
1332
 
1426
1333
  do {
1427
1334
  var maybeStyles = cache.insert("." + className, current, cache.sheet, true);
1428
1335
 
1429
- if (!isBrowser$1 && maybeStyles !== undefined) {
1430
- stylesForSSR += maybeStyles;
1431
- }
1432
-
1433
1336
  current = current.next;
1434
1337
  } while (current !== undefined);
1435
-
1436
- if (!isBrowser$1 && stylesForSSR.length !== 0) {
1437
- return stylesForSSR;
1438
- }
1439
1338
  }
1440
1339
  };
1441
1340
 
@@ -2548,49 +2447,49 @@ const Clipboard = unwrapExports(clipboard);
2548
2447
 
2549
2448
  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}";
2550
2449
 
2551
- const CopyButton = class {
2552
- constructor(hostRef) {
2553
- registerInstance(this, hostRef);
2554
- }
2555
- componentWillLoad() {
2556
- if (!this.ishidden) {
2557
- return API.graphql
2558
- .getFueltankCode(this.rewardkey)
2559
- .then((res) => {
2560
- const fuelTank = res.rewards.data.length > 0
2561
- ? res.rewards.data[0].fuelTankCode
2562
- : null;
2563
- this.fueltankcode =
2564
- fuelTank || res.referredByReferral.referrerUser.referralCode;
2565
- })
2566
- .catch((e) => {
2567
- this.onError(e);
2568
- });
2569
- }
2570
- }
2571
- onError(e) {
2572
- console.log("Error loading via GraphQL.", e);
2573
- }
2574
- notify(clipboardNotification, notificationText) {
2575
- const notification = document.getElementById(clipboardNotification.slice(1));
2576
- notification.textContent = notificationText;
2577
- addClass(notification, "in");
2578
- setTimeout(() => {
2579
- removeClass(notification, "in");
2580
- }, 1400);
2581
- }
2582
- notifySuccess(e) {
2583
- this.notify(e.trigger.dataset.clipboardNotification, this.copysuccess);
2584
- }
2585
- notifyFailure(e) {
2586
- this.notify(e.trigger.dataset.clipboardNotification, this.copyfailure);
2587
- }
2588
- componentDidLoad() {
2589
- const clipboard = new Clipboard("button");
2590
- clipboard.on("success", this.notifySuccess.bind(this));
2591
- clipboard.on("error", this.notifyFailure.bind(this));
2592
- }
2593
- render() {
2450
+ const CopyButton = class {
2451
+ constructor(hostRef) {
2452
+ registerInstance(this, hostRef);
2453
+ }
2454
+ componentWillLoad() {
2455
+ if (!this.ishidden) {
2456
+ return API.graphql
2457
+ .getFueltankCode(this.rewardkey)
2458
+ .then((res) => {
2459
+ const fuelTank = res.rewards.data.length > 0
2460
+ ? res.rewards.data[0].fuelTankCode
2461
+ : null;
2462
+ this.fueltankcode =
2463
+ fuelTank || res.referredByReferral.referrerUser.referralCode;
2464
+ })
2465
+ .catch((e) => {
2466
+ this.onError(e);
2467
+ });
2468
+ }
2469
+ }
2470
+ onError(e) {
2471
+ console.log("Error loading via GraphQL.", e);
2472
+ }
2473
+ notify(clipboardNotification, notificationText) {
2474
+ const notification = document.getElementById(clipboardNotification.slice(1));
2475
+ notification.textContent = notificationText;
2476
+ addClass(notification, "in");
2477
+ setTimeout(() => {
2478
+ removeClass(notification, "in");
2479
+ }, 1400);
2480
+ }
2481
+ notifySuccess(e) {
2482
+ this.notify(e.trigger.dataset.clipboardNotification, this.copysuccess);
2483
+ }
2484
+ notifyFailure(e) {
2485
+ this.notify(e.trigger.dataset.clipboardNotification, this.copyfailure);
2486
+ }
2487
+ componentDidLoad() {
2488
+ const clipboard = new Clipboard("button");
2489
+ clipboard.on("success", this.notifySuccess.bind(this));
2490
+ clipboard.on("error", this.notifyFailure.bind(this));
2491
+ }
2492
+ render() {
2594
2493
  const style = css `
2595
2494
  max-width: ${this.width}px;
2596
2495
  background-color: ${this.backgroundcolor};
@@ -2608,61 +2507,61 @@ const CopyButton = class {
2608
2507
  &:focus {
2609
2508
  color: ${this.textcolor};
2610
2509
  }
2611
- `;
2510
+ `;
2612
2511
  const code = css `
2613
2512
  text-align: center;
2614
2513
  font-weight: bold;
2615
2514
  font-size: ${this.codefontsize};
2616
2515
  color: ${this.codefontcolor};
2617
- `;
2618
- const classes = [`sqh-copy-button`, style].join(" ");
2619
- return (!this.ishidden && (h("div", null, h("div", { class: code }, this.fueltankcode), h("div", { class: "sqh-align-button" }, h("span", { class: "label fade", id: "squatch-copy-notification" }, this.copysuccess), h("button", { class: classes, "data-clipboard-text": this.fueltankcode, "data-clipboard-notification": "#squatch-copy-notification" }, this.text)))));
2620
- }
2621
- };
2516
+ `;
2517
+ const classes = [`sqh-copy-button`, style].join(" ");
2518
+ return (!this.ishidden && (h("div", null, h("div", { class: code }, this.fueltankcode), h("div", { class: "sqh-align-button" }, h("span", { class: "label fade", id: "squatch-copy-notification" }, this.copysuccess), h("button", { class: classes, "data-clipboard-text": this.fueltankcode, "data-clipboard-notification": "#squatch-copy-notification" }, this.text)))));
2519
+ }
2520
+ };
2622
2521
  CopyButton.style = copyButtonCss;
2623
2522
 
2624
2523
  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}}";
2625
2524
 
2626
- const CopyLinkButton = class {
2627
- constructor(hostRef) {
2628
- registerInstance(this, hostRef);
2629
- }
2630
- componentWillLoad() {
2631
- if (!this.ishidden) {
2632
- return API.graphql
2633
- .getShareLink()
2634
- .then((res) => {
2635
- this.sharelink = res;
2636
- })
2637
- .catch((e) => {
2638
- this.onError(e);
2639
- });
2640
- }
2641
- }
2642
- onError(e) {
2643
- console.log("Error loading via GraphQL.", e);
2644
- }
2645
- notify(clipboardNotification, notificationText) {
2646
- const notification = document.getElementById(clipboardNotification.slice(1));
2647
- notification.textContent = notificationText;
2648
- addClass(notification, "in");
2649
- setTimeout(() => {
2650
- removeClass(notification, "in");
2651
- }, 1400);
2652
- API.analytics.shareEvent("DIRECT");
2653
- }
2654
- notifySuccess(e) {
2655
- this.notify(e.trigger.dataset.clipboardNotification, this.copysuccess);
2656
- }
2657
- notifyFailure(e) {
2658
- this.notify(e.trigger.dataset.clipboardNotification, this.copyfailure);
2659
- }
2660
- componentDidLoad() {
2661
- const clipboard = new Clipboard("[data-clipboard-target]");
2662
- clipboard.on("success", this.notifySuccess.bind(this));
2663
- clipboard.on("error", this.notifyFailure.bind(this));
2664
- }
2665
- render() {
2525
+ const CopyLinkButton = class {
2526
+ constructor(hostRef) {
2527
+ registerInstance(this, hostRef);
2528
+ }
2529
+ componentWillLoad() {
2530
+ if (!this.ishidden) {
2531
+ return API.graphql
2532
+ .getShareLink()
2533
+ .then((res) => {
2534
+ this.sharelink = res;
2535
+ })
2536
+ .catch((e) => {
2537
+ this.onError(e);
2538
+ });
2539
+ }
2540
+ }
2541
+ onError(e) {
2542
+ console.log("Error loading via GraphQL.", e);
2543
+ }
2544
+ notify(clipboardNotification, notificationText) {
2545
+ const notification = document.getElementById(clipboardNotification.slice(1));
2546
+ notification.textContent = notificationText;
2547
+ addClass(notification, "in");
2548
+ setTimeout(() => {
2549
+ removeClass(notification, "in");
2550
+ }, 1400);
2551
+ API.analytics.shareEvent("DIRECT");
2552
+ }
2553
+ notifySuccess(e) {
2554
+ this.notify(e.trigger.dataset.clipboardNotification, this.copysuccess);
2555
+ }
2556
+ notifyFailure(e) {
2557
+ this.notify(e.trigger.dataset.clipboardNotification, this.copyfailure);
2558
+ }
2559
+ componentDidLoad() {
2560
+ const clipboard = new Clipboard("[data-clipboard-target]");
2561
+ clipboard.on("success", this.notifySuccess.bind(this));
2562
+ clipboard.on("error", this.notifyFailure.bind(this));
2563
+ }
2564
+ render() {
2666
2565
  const myStyle = css `
2667
2566
  background-color: ${this.buttoncolor};
2668
2567
  border: 1px solid ${this.buttoncolor};
@@ -2678,96 +2577,96 @@ const CopyLinkButton = class {
2678
2577
  &:focus {
2679
2578
  color: ${this.textcolor};
2680
2579
  }
2681
- `;
2682
- const buttonClass = [`sqh-copy-btn icon-btn`, myStyle].join(" ");
2683
- return (!this.ishidden && (h("div", { class: "input-group" }, h("input", { id: "squatch-share-link", value: this.sharelink, readonly: "readonly" }), h("span", { class: "label fade", id: "squatch-share-notification" }, this.copysuccess), h("span", { class: "input-group-btn" }, h("button", { class: buttonClass, "data-clipboard-target": "#squatch-share-link", "data-clipboard-notification": "#squatch-share-notification" }, h("i", { class: "icon icon-link" }), h("span", { class: "hidden-sm" }, this.text))))));
2684
- }
2685
- };
2580
+ `;
2581
+ const buttonClass = [`sqh-copy-btn icon-btn`, myStyle].join(" ");
2582
+ return (!this.ishidden && (h("div", { class: "input-group" }, h("input", { id: "squatch-share-link", value: this.sharelink, readonly: "readonly" }), h("span", { class: "label fade", id: "squatch-share-notification" }, this.copysuccess), h("span", { class: "input-group-btn" }, h("button", { class: buttonClass, "data-clipboard-target": "#squatch-share-link", "data-clipboard-notification": "#squatch-share-notification" }, h("i", { class: "icon icon-link" }), h("span", { class: "hidden-sm" }, this.text))))));
2583
+ }
2584
+ };
2686
2585
  CopyLinkButton.style = copyLinkButtonCss;
2687
2586
 
2688
2587
  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)}}";
2689
2588
 
2690
- const GlobalContainer = class {
2691
- constructor(hostRef) {
2692
- registerInstance(this, hostRef);
2693
- }
2694
- LoadingState(props) {
2589
+ const GlobalContainer = class {
2590
+ constructor(hostRef) {
2591
+ registerInstance(this, hostRef);
2592
+ }
2593
+ LoadingState(props) {
2695
2594
  const style = css `
2696
2595
  background-color: ${props.loadingcolor || "#439B76"};
2697
- `;
2698
- return (h("div", { class: "container-loading" }, h("div", { class: "loading-icon" }, h("div", { class: `bar1 ${style}` }), h("div", { class: `bar2 ${style}` }), h("div", { class: `bar3 ${style}` }), h("div", { class: `bar4 ${style}` }), h("div", { class: `bar5 ${style}` }))));
2699
- }
2700
- render() {
2596
+ `;
2597
+ return (h("div", { class: "container-loading" }, h("div", { class: "loading-icon" }, h("div", { class: `bar1 ${style}` }), h("div", { class: `bar2 ${style}` }), h("div", { class: `bar3 ${style}` }), h("div", { class: `bar4 ${style}` }), h("div", { class: `bar5 ${style}` }))));
2598
+ }
2599
+ render() {
2701
2600
  const style = css `
2702
2601
  background-color: ${this.background};
2703
2602
  font-family: ${this.fontfamily};
2704
2603
  position: relative;
2705
2604
  max-width: ${this.maxwidth};
2706
- `;
2707
- const robotoFont = (h("link", { href: "https://fonts.googleapis.com/css?family=Roboto:400,700&display=swap", rel: "stylesheet" }));
2708
- const artifaktFont = (h("link", { href: "https://static-dc.autodesk.net/etc/designs/v201903181748/templates-general/structure/fonts/artifakt/clientlibs/artifakt.css", rel: "stylesheet" }));
2709
- return (h("div", { class: style }, this.fontfamily == "Roboto" ? robotoFont : "", this.fontfamily == "Artifakt Element" ? artifaktFont : "", h("slot", null), this.poweredby ? (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")) : (""), h(this.LoadingState, { loadingcolor: this.loadingcolor })));
2710
- }
2711
- };
2605
+ `;
2606
+ const robotoFont = (h("link", { href: "https://fonts.googleapis.com/css?family=Roboto:400,700&display=swap", rel: "stylesheet" }));
2607
+ const artifaktFont = (h("link", { href: "https://static-dc.autodesk.net/etc/designs/v201903181748/templates-general/structure/fonts/artifakt/clientlibs/artifakt.css", rel: "stylesheet" }));
2608
+ return (h("div", { class: style }, this.fontfamily == "Roboto" ? robotoFont : "", this.fontfamily == "Artifakt Element" ? artifaktFont : "", h("slot", null), this.poweredby ? (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")) : (""), h(this.LoadingState, { loadingcolor: this.loadingcolor })));
2609
+ }
2610
+ };
2712
2611
  GlobalContainer.style = globalContainerCss;
2713
2612
 
2714
2613
  const imageComponentCss = "sqh-image-component{display:block}sqh-image-component div{position:relative}sqh-image-component img{max-width:100%;height:auto}";
2715
2614
 
2716
- const ImageComponent = class {
2717
- constructor(hostRef) {
2718
- registerInstance(this, hostRef);
2719
- }
2720
- render() {
2721
- const imageString = this.url;
2615
+ const ImageComponent = class {
2616
+ constructor(hostRef) {
2617
+ registerInstance(this, hostRef);
2618
+ }
2619
+ render() {
2620
+ const imageString = this.url;
2722
2621
  const alignment = css `
2723
2622
  {
2724
2623
  text-align: ${this.alignment};
2725
2624
  }
2726
- `;
2625
+ `;
2727
2626
  const myStyle = css `
2728
2627
  {
2729
2628
  width: ${this.width}px;
2730
2629
  border-radius: ${this.borderradius}px;
2731
2630
  ${this.css}
2732
2631
  }
2733
- `;
2734
- return (!this.ishidden && (h("div", { class: alignment }, h("img", { src: imageString, class: myStyle }))));
2735
- }
2736
- };
2632
+ `;
2633
+ return (!this.ishidden && (h("div", { class: alignment }, h("img", { src: imageString, class: myStyle }))));
2634
+ }
2635
+ };
2737
2636
  ImageComponent.style = imageComponentCss;
2738
2637
 
2739
2638
  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}}";
2740
2639
 
2741
- const PartnerStatComponent = class {
2742
- constructor(hostRef) {
2743
- registerInstance(this, hostRef);
2744
- this.statTypeUpdated = createEvent(this, "statTypeUpdated", 7);
2745
- this.statAdded = createEvent(this, "statAdded", 7);
2746
- }
2747
- componentWillLoad() {
2748
- this.statAddedHandler(this.elem);
2749
- }
2750
- stattypeHandler(newValue, oldValue) {
2751
- if (newValue !== oldValue)
2752
- this.statTypeUpdatedHandler(this.elem);
2753
- }
2754
- statAddedHandler(stat) {
2755
- this.statAdded.emit(stat);
2756
- }
2757
- statTypeUpdatedHandler(stat) {
2758
- this.statTypeUpdated.emit(stat);
2759
- }
2760
- render() {
2640
+ const PartnerStatComponent = class {
2641
+ constructor(hostRef) {
2642
+ registerInstance(this, hostRef);
2643
+ this.statTypeUpdated = createEvent(this, "statTypeUpdated", 7);
2644
+ this.statAdded = createEvent(this, "statAdded", 7);
2645
+ }
2646
+ componentWillLoad() {
2647
+ this.statAddedHandler(this.elem);
2648
+ }
2649
+ stattypeHandler(newValue, oldValue) {
2650
+ if (newValue !== oldValue)
2651
+ this.statTypeUpdatedHandler(this.elem);
2652
+ }
2653
+ statAddedHandler(stat) {
2654
+ this.statAdded.emit(stat);
2655
+ }
2656
+ statTypeUpdatedHandler(stat) {
2657
+ this.statTypeUpdated.emit(stat);
2658
+ }
2659
+ render() {
2761
2660
  const clz = css `
2762
2661
  color: ${this.statcolor};
2763
- `;
2764
- return (!this.ishidden && (h("div", { class: clz }, h("div", { class: "stat-value" }, this.statvalue), h("div", { class: "stat-description" }, this.statdescription))));
2765
- }
2766
- get elem() { return getElement(this); }
2767
- static get watchers() { return {
2768
- "stattype": ["stattypeHandler"]
2769
- }; }
2770
- };
2662
+ `;
2663
+ return (!this.ishidden && (h("div", { class: clz }, h("div", { class: "stat-value" }, this.statvalue), h("div", { class: "stat-description" }, this.statdescription))));
2664
+ }
2665
+ get elem() { return getElement(this); }
2666
+ static get watchers() { return {
2667
+ "stattype": ["stattypeHandler"]
2668
+ }; }
2669
+ };
2771
2670
  PartnerStatComponent.style = partnerStatComponentCss;
2772
2671
 
2773
2672
  var TYPE;
@@ -6963,227 +6862,227 @@ RelativeFormat.thresholds = {
6963
6862
  'month-short': 11 // months to year
6964
6863
  };
6965
6864
 
6966
- const FormatJS = {
6967
- format(msg, values, userLocale) {
6968
- var locale = (userLocale || "en-US").replace("_", "-");
6969
- var format = new IntlMessageFormat(msg, locale);
6970
- return format.format(values);
6971
- },
6972
- formatRelative(value, userLocale) {
6973
- var locale = (userLocale || "en-US").replace("_", "-");
6974
- var relative = new RelativeFormat(locale);
6975
- return relative.format(value);
6976
- },
6865
+ const FormatJS = {
6866
+ format(msg, values, userLocale) {
6867
+ var locale = (userLocale || "en-US").replace("_", "-");
6868
+ var format = new IntlMessageFormat(msg, locale);
6869
+ return format.format(values);
6870
+ },
6871
+ formatRelative(value, userLocale) {
6872
+ var locale = (userLocale || "en-US").replace("_", "-");
6873
+ var relative = new RelativeFormat(locale);
6874
+ return relative.format(value);
6875
+ },
6977
6876
  };
6978
6877
 
6979
6878
  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}}";
6980
6879
 
6981
- const ReferralComponent = class {
6982
- constructor(hostRef) {
6983
- registerInstance(this, hostRef);
6984
- }
6985
- getName() {
6986
- const referral = this.referral;
6987
- const referredByReferral = this.referral;
6988
- // Referred User
6989
- if (referral.referredUser) {
6990
- return referral.referredUser.firstName || this.unknownuser;
6991
- }
6992
- // Referrer User
6993
- if (referredByReferral.referrerUser) {
6994
- return referredByReferral.referrerUser.firstName || this.unknownuser;
6995
- }
6996
- return this.unknownuser;
6997
- }
6998
- getIcon() {
6999
- if ((this.referraltype === "converted" || this.referraltype === "referrer") &&
7000
- !this.rewardIsExpired() &&
7001
- !this.rewardIsCancelled()) {
7002
- return `icon-ok-circled`;
7003
- }
7004
- return `icon-attention`;
7005
- }
7006
- getContent(formatVariables) {
7007
- // When reward is expired and Expired Content was set
7008
- if (this.rewardIsExpired() && this.referralvariables.expiredcontent) {
7009
- return FormatJS.format(this.referralvariables.expiredcontent, formatVariables, this.locale);
7010
- }
7011
- // When reward is cancelled and Cancelled Content was set
7012
- if (this.rewardIsCancelled() && this.referralvariables.cancelledcontent) {
7013
- return FormatJS.format(this.referralvariables.cancelledcontent, formatVariables, this.locale);
7014
- }
7015
- if (this.referraltype) {
7016
- return FormatJS.format(this.referralvariables[`${this.referraltype}content`], formatVariables, this.locale);
7017
- }
7018
- return ``;
7019
- }
7020
- rewardIsExpired() {
7021
- const { rewards } = this.referral;
7022
- const hasExpiry = rewards.length == 1 && rewards[0].statuses;
7023
- const isExpired = hasExpiry && rewards[0].statuses.indexOf("EXPIRED") > -1;
7024
- return isExpired;
7025
- }
7026
- rewardIsCancelled() {
7027
- const { rewards } = this.referral;
7028
- const hasStatuses = rewards.length == 1 && rewards[0].statuses;
7029
- const isCancelled = hasStatuses && rewards[0].statuses.indexOf("CANCELLED") > -1;
7030
- return isCancelled;
7031
- }
7032
- rewardIsRedeemed() {
7033
- const { rewards } = this.referral;
7034
- const hasStatuses = rewards.length == 1 && rewards[0].statuses;
7035
- const isRedeemed = hasStatuses && rewards[0].statuses.indexOf("REDEEMED") > -1;
7036
- return isRedeemed;
7037
- }
7038
- getValue() {
7039
- const { rewards } = this.referral;
7040
- const referrer = this.referralvariables.referrervalue;
7041
- const pending = this.referralvariables.pendingvalue;
7042
- // When we have no reward values to show
7043
- if (rewards.length == 0) {
7044
- return this.referraltype === "referrer" ||
7045
- this.referraltype === "converted"
7046
- ? referrer
7047
- : pending;
7048
- }
7049
- // When we want to use the first reward pretty value
7050
- if (rewards.length > 0 && this.referralvariables.usefirstreward) {
7051
- return rewards[rewards.length - 1].prettyValue || rewards[0].prettyValue;
7052
- }
7053
- // Use last reward pretty value
7054
- return rewards[0].prettyValue;
7055
- }
7056
- getValueContent(formatVariables) {
7057
- const { rewards } = this.referral;
7058
- // When the reward is pending and there are no other rewards
7059
- if (!rewards.length)
7060
- return "";
7061
- if (rewards.length == 1) {
7062
- // Expired content only applies when there is 1 reward in the referral
7063
- if (this.rewardIsExpired())
7064
- return FormatJS.format(this.referralvariables.expiredvalue, formatVariables, this.locale);
7065
- // Cancelled content only applies when there is 1 reward in the referral
7066
- if (this.rewardIsCancelled())
7067
- return FormatJS.format(this.referralvariables.cancelledvalue, formatVariables, this.locale);
7068
- // Redeemed content only applies when there is 1 reward in the referral
7069
- if (this.rewardIsRedeemed())
7070
- return FormatJS.format(this.referralvariables.redeemedvalue || "Redeemed", formatVariables, this.locale);
7071
- // Expiry date only shown if there is 1 reward with dateExpires set in the referral
7072
- if (this.referralvariables.showexpiry && rewards[0].dateExpires) {
7073
- const expiryDate = FormatJS.formatRelative(rewards[0].dateExpires, this.locale);
7074
- return FormatJS.format(this.referralvariables.expiresvalue || `Expires ${expiryDate}`, Object.assign(Object.assign({}, formatVariables), { expiryDate }), this.locale);
7075
- }
7076
- return "";
7077
- }
7078
- return FormatJS.format(this.referralvariables.valuecontent, formatVariables, this.locale);
7079
- }
7080
- getNote() {
7081
- const { rewards } = this.referral;
7082
- const note = rewards[0] && rewards[0].meta && rewards[0].meta.message;
7083
- return note || "";
7084
- }
7085
- render() {
7086
- const { dateReferralStarted, rewards } = this.referral;
7087
- const formatVariables = {
7088
- date: FormatJS.formatRelative(dateReferralStarted, this.locale),
7089
- extrarewards: rewards.length - 1,
7090
- };
7091
- const name = this.getName();
7092
- const icon = this.getIcon();
7093
- const content = this.getContent(formatVariables);
7094
- const value = this.getValue();
7095
- const valuecontent = this.getValueContent(formatVariables);
7096
- const customernote = this.getNote();
7097
- return (h("div", { class: "squatch-referrals-row" }, h("div", null, h("div", { class: "squatch-referrals-heading" }, name), h("div", { class: "squatch-referrals-description" }, content), this.referralvariables.shownotes && customernote && (h("div", { class: "squatch-referrals-description squatch-customer-note", title: customernote }, customernote))), h("i", { class: `icon squatch-referrals-icon ${icon} ${this.rewardIsExpired() && "expired"} ${this.rewardIsCancelled() && "cancelled"}` }), h("div", { class: "sqh-column-two" }, h("div", { class: `squatch-referrals-value ${this.rewardIsCancelled() && "cancelled"} ${rewards.length > 0
7098
- ? this.rewardIsExpired()
7099
- ? "expired"
7100
- : ""
7101
- : this.referraltype === "referrer" ||
7102
- this.referraltype === "converted"
7103
- ? "referrer"
7104
- : "pending"}` }, value), h("div", { class: `squatch-value-contents ${this.rewardIsExpired() && "expired"} ${this.rewardIsCancelled() && "cancelled"}` }, valuecontent))));
7105
- }
7106
- };
6880
+ const ReferralComponent = class {
6881
+ constructor(hostRef) {
6882
+ registerInstance(this, hostRef);
6883
+ }
6884
+ getName() {
6885
+ const referral = this.referral;
6886
+ const referredByReferral = this.referral;
6887
+ // Referred User
6888
+ if (referral.referredUser) {
6889
+ return referral.referredUser.firstName || this.unknownuser;
6890
+ }
6891
+ // Referrer User
6892
+ if (referredByReferral.referrerUser) {
6893
+ return referredByReferral.referrerUser.firstName || this.unknownuser;
6894
+ }
6895
+ return this.unknownuser;
6896
+ }
6897
+ getIcon() {
6898
+ if ((this.referraltype === "converted" || this.referraltype === "referrer") &&
6899
+ !this.rewardIsExpired() &&
6900
+ !this.rewardIsCancelled()) {
6901
+ return `icon-ok-circled`;
6902
+ }
6903
+ return `icon-attention`;
6904
+ }
6905
+ getContent(formatVariables) {
6906
+ // When reward is expired and Expired Content was set
6907
+ if (this.rewardIsExpired() && this.referralvariables.expiredcontent) {
6908
+ return FormatJS.format(this.referralvariables.expiredcontent, formatVariables, this.locale);
6909
+ }
6910
+ // When reward is cancelled and Cancelled Content was set
6911
+ if (this.rewardIsCancelled() && this.referralvariables.cancelledcontent) {
6912
+ return FormatJS.format(this.referralvariables.cancelledcontent, formatVariables, this.locale);
6913
+ }
6914
+ if (this.referraltype) {
6915
+ return FormatJS.format(this.referralvariables[`${this.referraltype}content`], formatVariables, this.locale);
6916
+ }
6917
+ return ``;
6918
+ }
6919
+ rewardIsExpired() {
6920
+ const { rewards } = this.referral;
6921
+ const hasExpiry = rewards.length == 1 && rewards[0].statuses;
6922
+ const isExpired = hasExpiry && rewards[0].statuses.indexOf("EXPIRED") > -1;
6923
+ return isExpired;
6924
+ }
6925
+ rewardIsCancelled() {
6926
+ const { rewards } = this.referral;
6927
+ const hasStatuses = rewards.length == 1 && rewards[0].statuses;
6928
+ const isCancelled = hasStatuses && rewards[0].statuses.indexOf("CANCELLED") > -1;
6929
+ return isCancelled;
6930
+ }
6931
+ rewardIsRedeemed() {
6932
+ const { rewards } = this.referral;
6933
+ const hasStatuses = rewards.length == 1 && rewards[0].statuses;
6934
+ const isRedeemed = hasStatuses && rewards[0].statuses.indexOf("REDEEMED") > -1;
6935
+ return isRedeemed;
6936
+ }
6937
+ getValue() {
6938
+ const { rewards } = this.referral;
6939
+ const referrer = this.referralvariables.referrervalue;
6940
+ const pending = this.referralvariables.pendingvalue;
6941
+ // When we have no reward values to show
6942
+ if (rewards.length == 0) {
6943
+ return this.referraltype === "referrer" ||
6944
+ this.referraltype === "converted"
6945
+ ? referrer
6946
+ : pending;
6947
+ }
6948
+ // When we want to use the first reward pretty value
6949
+ if (rewards.length > 0 && this.referralvariables.usefirstreward) {
6950
+ return rewards[rewards.length - 1].prettyValue || rewards[0].prettyValue;
6951
+ }
6952
+ // Use last reward pretty value
6953
+ return rewards[0].prettyValue;
6954
+ }
6955
+ getValueContent(formatVariables) {
6956
+ const { rewards } = this.referral;
6957
+ // When the reward is pending and there are no other rewards
6958
+ if (!rewards.length)
6959
+ return "";
6960
+ if (rewards.length == 1) {
6961
+ // Expired content only applies when there is 1 reward in the referral
6962
+ if (this.rewardIsExpired())
6963
+ return FormatJS.format(this.referralvariables.expiredvalue, formatVariables, this.locale);
6964
+ // Cancelled content only applies when there is 1 reward in the referral
6965
+ if (this.rewardIsCancelled())
6966
+ return FormatJS.format(this.referralvariables.cancelledvalue, formatVariables, this.locale);
6967
+ // Redeemed content only applies when there is 1 reward in the referral
6968
+ if (this.rewardIsRedeemed())
6969
+ return FormatJS.format(this.referralvariables.redeemedvalue || "Redeemed", formatVariables, this.locale);
6970
+ // Expiry date only shown if there is 1 reward with dateExpires set in the referral
6971
+ if (this.referralvariables.showexpiry && rewards[0].dateExpires) {
6972
+ const expiryDate = FormatJS.formatRelative(rewards[0].dateExpires, this.locale);
6973
+ return FormatJS.format(this.referralvariables.expiresvalue || `Expires ${expiryDate}`, Object.assign(Object.assign({}, formatVariables), { expiryDate }), this.locale);
6974
+ }
6975
+ return "";
6976
+ }
6977
+ return FormatJS.format(this.referralvariables.valuecontent, formatVariables, this.locale);
6978
+ }
6979
+ getNote() {
6980
+ const { rewards } = this.referral;
6981
+ const note = rewards[0] && rewards[0].meta && rewards[0].meta.message;
6982
+ return note || "";
6983
+ }
6984
+ render() {
6985
+ const { dateReferralStarted, rewards } = this.referral;
6986
+ const formatVariables = {
6987
+ date: FormatJS.formatRelative(dateReferralStarted, this.locale),
6988
+ extrarewards: rewards.length - 1,
6989
+ };
6990
+ const name = this.getName();
6991
+ const icon = this.getIcon();
6992
+ const content = this.getContent(formatVariables);
6993
+ const value = this.getValue();
6994
+ const valuecontent = this.getValueContent(formatVariables);
6995
+ const customernote = this.getNote();
6996
+ return (h("div", { class: "squatch-referrals-row" }, h("div", null, h("div", { class: "squatch-referrals-heading" }, name), h("div", { class: "squatch-referrals-description" }, content), this.referralvariables.shownotes && customernote && (h("div", { class: "squatch-referrals-description squatch-customer-note", title: customernote }, customernote))), h("i", { class: `icon squatch-referrals-icon ${icon} ${this.rewardIsExpired() && "expired"} ${this.rewardIsCancelled() && "cancelled"}` }), h("div", { class: "sqh-column-two" }, h("div", { class: `squatch-referrals-value ${this.rewardIsCancelled() && "cancelled"} ${rewards.length > 0
6997
+ ? this.rewardIsExpired()
6998
+ ? "expired"
6999
+ : ""
7000
+ : this.referraltype === "referrer" ||
7001
+ this.referraltype === "converted"
7002
+ ? "referrer"
7003
+ : "pending"}` }, value), h("div", { class: `squatch-value-contents ${this.rewardIsExpired() && "expired"} ${this.rewardIsCancelled() && "cancelled"}` }, valuecontent))));
7004
+ }
7005
+ };
7107
7006
  ReferralComponent.style = referralComponentCss;
7108
7007
 
7109
7008
  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}";
7110
7009
 
7111
- const ReferralList = class {
7112
- constructor(hostRef) {
7113
- registerInstance(this, hostRef);
7114
- this.offset = 0;
7115
- this.loading = true;
7116
- }
7117
- componentWillLoad() {
7118
- if (!this.ishidden) {
7119
- return this.getReferrals(this.showreferrer)
7120
- .then((res) => {
7121
- this.referrals = res.referrals.data;
7122
- this.referredBy = res.referredByReferral;
7123
- this.referralsCount = res.referrals.totalCount;
7124
- this.loading = false;
7125
- this.locale = res.locale;
7126
- })
7127
- .catch((e) => {
7128
- this.onError(e);
7129
- });
7130
- }
7131
- }
7132
- getReferrals(showReferrer, offset = 0) {
7133
- return API.graphql.getReferrals(showReferrer, offset);
7134
- }
7135
- paginate(offset, event) {
7136
- if (this.loading)
7137
- return null;
7138
- let { referralsCount } = this;
7139
- if (this.showreferrer && this.referredBy)
7140
- referralsCount++;
7141
- if (offset >= referralsCount || offset < 0)
7142
- return null;
7143
- this.loading = true;
7144
- const { target } = event;
7145
- target.innerText = "...";
7146
- this.getReferrals(this.showreferrer, offset).then((res) => {
7147
- target.innerText =
7148
- offset > this.offset ? this.paginatemore : this.paginateless;
7149
- this.referrals = res.referrals.data;
7150
- this.offset = offset;
7151
- this.loading = false;
7152
- });
7153
- }
7154
- onError(e) {
7155
- console.error(e);
7156
- this.loading = false;
7157
- }
7158
- render() {
7159
- let referredByRow;
7160
- let referralsRow;
7161
- const referralvariables = {
7162
- usefirstreward: this.usefirstreward,
7163
- referrercontent: this.referrercontent,
7164
- convertedcontent: this.convertedcontent,
7165
- pendingcontent: this.pendingcontent,
7166
- pendingvalue: this.pendingvalue,
7167
- referrervalue: this.referrervalue,
7168
- valuecontent: this.valuecontent,
7169
- expiredcontent: this.expiredcontent,
7170
- expiredvalue: this.expiredvalue,
7171
- expiresvalue: this.expiresvalue,
7172
- redeemedvalue: this.redeemedvalue,
7173
- showexpiry: this.showexpiry,
7174
- shownotes: this.shownotes,
7175
- cancelledvalue: this.cancelledvalue,
7176
- cancelledcontent: this.cancelledcontent,
7177
- };
7178
- if (this.referrals) {
7179
- referralsRow = this.referrals.map((ref) => {
7180
- const referraltype = ref.rewards.length > 0 || ref.dateConverted ? "converted" : "pending";
7181
- return (h("sqh-referral-component", { id: uuid(), referral: ref, referralvariables: referralvariables, referraltype: referraltype, unknownuser: this.unknownuser, locale: this.internationalization ? this.locale : "en-US" }));
7182
- });
7183
- }
7184
- if (this.referrals.length < 3 && this.referredBy && this.showreferrer) {
7185
- referredByRow = (h("sqh-referral-component", { id: uuid(), referral: this.referredBy, referralvariables: referralvariables, referraltype: "referrer", unknownuser: this.unknownuser, locale: this.internationalization ? this.locale : "en-US" }));
7186
- }
7010
+ const ReferralList = class {
7011
+ constructor(hostRef) {
7012
+ registerInstance(this, hostRef);
7013
+ this.offset = 0;
7014
+ this.loading = true;
7015
+ }
7016
+ componentWillLoad() {
7017
+ if (!this.ishidden) {
7018
+ return this.getReferrals(this.showreferrer)
7019
+ .then((res) => {
7020
+ this.referrals = res.referrals.data;
7021
+ this.referredBy = res.referredByReferral;
7022
+ this.referralsCount = res.referrals.totalCount;
7023
+ this.loading = false;
7024
+ this.locale = res.locale;
7025
+ })
7026
+ .catch((e) => {
7027
+ this.onError(e);
7028
+ });
7029
+ }
7030
+ }
7031
+ getReferrals(showReferrer, offset = 0) {
7032
+ return API.graphql.getReferrals(showReferrer, offset);
7033
+ }
7034
+ paginate(offset, event) {
7035
+ if (this.loading)
7036
+ return null;
7037
+ let { referralsCount } = this;
7038
+ if (this.showreferrer && this.referredBy)
7039
+ referralsCount++;
7040
+ if (offset >= referralsCount || offset < 0)
7041
+ return null;
7042
+ this.loading = true;
7043
+ const { target } = event;
7044
+ target.innerText = "...";
7045
+ this.getReferrals(this.showreferrer, offset).then((res) => {
7046
+ target.innerText =
7047
+ offset > this.offset ? this.paginatemore : this.paginateless;
7048
+ this.referrals = res.referrals.data;
7049
+ this.offset = offset;
7050
+ this.loading = false;
7051
+ });
7052
+ }
7053
+ onError(e) {
7054
+ console.error(e);
7055
+ this.loading = false;
7056
+ }
7057
+ render() {
7058
+ let referredByRow;
7059
+ let referralsRow;
7060
+ const referralvariables = {
7061
+ usefirstreward: this.usefirstreward,
7062
+ referrercontent: this.referrercontent,
7063
+ convertedcontent: this.convertedcontent,
7064
+ pendingcontent: this.pendingcontent,
7065
+ pendingvalue: this.pendingvalue,
7066
+ referrervalue: this.referrervalue,
7067
+ valuecontent: this.valuecontent,
7068
+ expiredcontent: this.expiredcontent,
7069
+ expiredvalue: this.expiredvalue,
7070
+ expiresvalue: this.expiresvalue,
7071
+ redeemedvalue: this.redeemedvalue,
7072
+ showexpiry: this.showexpiry,
7073
+ shownotes: this.shownotes,
7074
+ cancelledvalue: this.cancelledvalue,
7075
+ cancelledcontent: this.cancelledcontent,
7076
+ };
7077
+ if (this.referrals) {
7078
+ referralsRow = this.referrals.map((ref) => {
7079
+ const referraltype = ref.rewards.length > 0 || ref.dateConverted ? "converted" : "pending";
7080
+ return (h("sqh-referral-component", { id: uuid(), referral: ref, referralvariables: referralvariables, referraltype: referraltype, unknownuser: this.unknownuser, locale: this.internationalization ? this.locale : "en-US" }));
7081
+ });
7082
+ }
7083
+ if (this.referrals.length < 3 && this.referredBy && this.showreferrer) {
7084
+ referredByRow = (h("sqh-referral-component", { id: uuid(), referral: this.referredBy, referralvariables: referralvariables, referraltype: "referrer", unknownuser: this.unknownuser, locale: this.internationalization ? this.locale : "en-US" }));
7085
+ }
7187
7086
  const clz = css `
7188
7087
  .squatch-referrals-icon.icon-ok-circled {
7189
7088
  color: ${this.rewardcolor};
@@ -7231,64 +7130,64 @@ const ReferralList = class {
7231
7130
  .squatch-referrals-scroll-action {
7232
7131
  font-family: ${"inherit"};
7233
7132
  }
7234
- `;
7235
- const totalReferralsCount = this.showreferrer && this.referredBy
7236
- ? this.referralsCount + 1
7237
- : this.referralsCount;
7238
- return !this.ishidden && totalReferralsCount > 0 ? (
7239
- // Referral List when not hidden and 1 or more referrals
7133
+ `;
7134
+ const totalReferralsCount = this.showreferrer && this.referredBy
7135
+ ? this.referralsCount + 1
7136
+ : this.referralsCount;
7137
+ return !this.ishidden && totalReferralsCount > 0 ? (
7138
+ // Referral List when not hidden and 1 or more referrals
7240
7139
  h("div", { class: `squatch-referrals ${clz}` }, h("div", { class: "squatch-referrals-scroll-container" }, referralsRow, referredByRow), h("div", { class: "squatch-referrals-scroll-action-container" }, h("button", { class: `
7241
- squatch-referrals-scroll-action previous ${this.loading
7242
- ? "disabled"
7243
- : this.offset === 0
7244
- ? "disabled"
7140
+ squatch-referrals-scroll-action previous ${this.loading
7141
+ ? "disabled"
7142
+ : this.offset === 0
7143
+ ? "disabled"
7245
7144
  : ""}
7246
7145
  `, onClick: (event) => this.paginate(this.offset - 3, event) }, this.paginateless), h("button", { class: `
7247
- squatch-referrals-scroll-action view-more ${this.loading
7248
- ? "disabled"
7249
- : this.showreferrer && this.referredBy
7250
- ? this.offset >= this.referralsCount - 2
7251
- ? "disabled"
7252
- : ""
7253
- : this.offset >= this.referralsCount - 3
7254
- ? "disabled"
7146
+ squatch-referrals-scroll-action view-more ${this.loading
7147
+ ? "disabled"
7148
+ : this.showreferrer && this.referredBy
7149
+ ? this.offset >= this.referralsCount - 2
7150
+ ? "disabled"
7151
+ : ""
7152
+ : this.offset >= this.referralsCount - 3
7153
+ ? "disabled"
7255
7154
  : ""}
7256
- `, "view-more": true, onClick: (event) => this.paginate(this.offset + 3, event) }, this.paginatemore)))) : (
7257
- // 'No Referrals Yet' button if this.referralCount < 1
7258
- h("div", { class: "squatch-referrals-scroll-action-container" }, h("button", { disabled: true, class: "squatch-no-referrals-yet" }, this.noreferralsyet)));
7259
- }
7260
- };
7155
+ `, "view-more": true, onClick: (event) => this.paginate(this.offset + 3, event) }, this.paginatemore)))) : (
7156
+ // 'No Referrals Yet' button if this.referralCount < 1
7157
+ h("div", { class: "squatch-referrals-scroll-action-container" }, h("button", { disabled: true, class: "squatch-no-referrals-yet" }, this.noreferralsyet)));
7158
+ }
7159
+ };
7261
7160
  ReferralList.style = referralListCss;
7262
7161
 
7263
7162
  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}}";
7264
7163
 
7265
- const ShareButton = class {
7266
- constructor(hostRef) {
7267
- registerInstance(this, hostRef);
7268
- }
7269
- clickHandler(e) {
7270
- if (window["widgetIdent"].env === "demo") {
7271
- e.preventDefault();
7272
- return;
7273
- }
7274
- // checking for null on closest 'a' tag makes click handler avoid firing when margin is clicked
7275
- var anchor = e.target.closest("a");
7276
- if (anchor !== null && this.buttonClassName !== "email-share") {
7277
- e.preventDefault();
7278
- const url = this.url;
7279
- const target = "_blank";
7280
- const features = "status=0,width=680,height=580";
7281
- window.open(url, target, features);
7282
- }
7283
- }
7284
- componentDidLoad() {
7285
- let el = this.button;
7286
- el.addEventListener("click", this.clickHandler.bind(this), false);
7287
- }
7288
- render() {
7289
- const isMobileiOS = detectMobileSafari() || detectMobileChrome();
7290
- const target = isMobileiOS ? "_parent" : "_blank";
7291
- const iconClass = `icon icon-${this.icon}`;
7164
+ const ShareButton = class {
7165
+ constructor(hostRef) {
7166
+ registerInstance(this, hostRef);
7167
+ }
7168
+ clickHandler(e) {
7169
+ if (window["widgetIdent"].env === "demo") {
7170
+ e.preventDefault();
7171
+ return;
7172
+ }
7173
+ // checking for null on closest 'a' tag makes click handler avoid firing when margin is clicked
7174
+ var anchor = e.target.closest("a");
7175
+ if (anchor !== null && this.buttonClassName !== "email-share") {
7176
+ e.preventDefault();
7177
+ const url = this.url;
7178
+ const target = "_blank";
7179
+ const features = "status=0,width=680,height=580";
7180
+ window.open(url, target, features);
7181
+ }
7182
+ }
7183
+ componentDidLoad() {
7184
+ let el = this.button;
7185
+ el.addEventListener("click", this.clickHandler.bind(this), false);
7186
+ }
7187
+ render() {
7188
+ const isMobileiOS = detectMobileSafari() || detectMobileChrome();
7189
+ const target = isMobileiOS ? "_parent" : "_blank";
7190
+ const iconClass = `icon icon-${this.icon}`;
7292
7191
  const style = css `
7293
7192
  background-color: ${this.backgroundcolor};
7294
7193
  border: 1px solid ${this.backgroundcolor};
@@ -7308,273 +7207,273 @@ const ShareButton = class {
7308
7207
  top: ${this.iconvertical}px;
7309
7208
  font-size: ${this.iconsize}em;
7310
7209
  }
7311
- `;
7312
- const classes = [
7313
- `squatch-share-btn`,
7314
- this.buttonClassName,
7315
- this.displayrule,
7316
- style,
7317
- ].join(" ");
7318
- return (h("a", { class: classes, href: this.url, target: target }, h("i", { class: iconClass }), h("span", { class: "share-btn-text" }, this.text)));
7319
- }
7320
- get button() { return getElement(this); }
7321
- };
7210
+ `;
7211
+ const classes = [
7212
+ `squatch-share-btn`,
7213
+ this.buttonClassName,
7214
+ this.displayrule,
7215
+ style,
7216
+ ].join(" ");
7217
+ return (h("a", { class: classes, href: this.url, target: target }, h("i", { class: iconClass }), h("span", { class: "share-btn-text" }, this.text)));
7218
+ }
7219
+ get button() { return getElement(this); }
7220
+ };
7322
7221
  ShareButton.style = shareButtonCss;
7323
7222
 
7324
7223
  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}}";
7325
7224
 
7326
- const ShareButtonContainer = class {
7327
- constructor(hostRef) {
7328
- registerInstance(this, hostRef);
7329
- /**
7330
- * @uiName Email Icon
7331
- * @uiGroup Email
7332
- */
7333
- this.emailicon = "mail";
7334
- /**
7335
- * CSS class name for additional styling.
7336
- *
7337
- * @uiName Email Class Name
7338
- * @uiGroup Email
7339
- */
7340
- this.emailclassName = "email-share";
7341
- /**
7342
- * @uiName Facebook Icon
7343
- * @uiGroup Facebook
7344
- */
7345
- this.facebookicon = "facebook";
7346
- /**
7347
- * Number to horizontally align the facebook button icon
7348
- *
7349
- * @uiName Facebook Icon Horizontal
7350
- * @uiGroup Facebook
7351
- */
7352
- this.facebookiconhorizontal = 9;
7353
- /**
7354
- * @uiName Facebook Icon Size
7355
- * @uiGroup Facebook
7356
- */
7357
- this.facebookiconsize = 1.2;
7358
- /**
7359
- * @uiName Twitter Icon
7360
- * @uiGroup Twitter
7361
- */
7362
- this.twittericon = "twitter";
7363
- /**
7364
- * Number to horizontally align the twitter button icon
7365
- *
7366
- * @uiName Twitter Icon Horizontal
7367
- * @uiGroup Twitter
7368
- */
7369
- this.twittericonhorizontal = 9;
7370
- /**
7371
- * @uiName Twitter Icon Size
7372
- * @uiGroup Twitter
7373
- */
7374
- this.twittericonsize = 1.2;
7375
- /**
7376
- * @uiName SMS Icon
7377
- * @uiGroup SMS
7378
- */
7379
- this.smsicon = "chat";
7380
- /**
7381
- * @uiName WhatsApp Text Color
7382
- * @uiGroup WhatsApp
7383
- * @uiWidget color
7384
- * @default #ffffff
7385
- */
7386
- this.whatsapptextcolor = "#fff";
7387
- /**
7388
- * @uiName WhatsApp Icon
7389
- * @uiGroup WhatsApp
7390
- */
7391
- this.whatsappicon = "whatsapp";
7392
- /**
7393
- * Number to horizontally align the WhatsApp button icon
7394
- *
7395
- * @uiName WhatsApp Icon Horizontal
7396
- * @uiGroup WhatsApp
7397
- */
7398
- this.whatsappiconhorizontal = 7;
7399
- /**
7400
- * Number to vertically align the WhatsApp button icon
7401
- *
7402
- * @uiName WhatsApp Icon Vertical
7403
- * @uiGroup WhatsApp
7404
- */
7405
- this.whatsappiconvertical = 2;
7406
- /**
7407
- * @uiName WhatsApp Icon Size
7408
- * @uiGroup WhatsApp
7409
- */
7410
- this.whatsappiconsize = 1.4;
7411
- /**
7412
- * @uiName Linkedin Icon
7413
- * @uiGroup LinkedIn
7414
- */
7415
- this.linkedinicon = "linkedin";
7416
- /**
7417
- * @uiName Linkedin Icon Size
7418
- * @uiGroup LinkedIn
7419
- */
7420
- this.linkediniconsize = 1.2;
7421
- /**
7422
- * @uiName Pinterest Icon
7423
- * @uiGroup Pinterest
7424
- */
7425
- this.pinteresticon = "pinterest";
7426
- /**
7427
- * Number to horizontally align the Pinterest button icon
7428
- *
7429
- * @uiName Pinterest Icon Horizontal
7430
- * @uiGroup Pinterest
7431
- */
7432
- this.pinteresticonhorizontal = 9;
7433
- /**
7434
- * Number to vertically align the Pinterest button icon
7435
- *
7436
- * @uiName Pinterest Icon Vertical
7437
- * @uiGroup Pinterest
7438
- */
7439
- this.pinteresticonvertical = 4;
7440
- /**
7441
- * @uiName Pinterest Icon Size
7442
- * @uiGroup Pinterest
7443
- */
7444
- this.pinteresticonsize = 1.2;
7445
- /**
7446
- * @uiName Messenger Icon
7447
- * @uiGroup Messenger
7448
- */
7449
- this.messengericon = "messenger";
7450
- /**
7451
- * Number to horizontally align the Messenger button icon
7452
- *
7453
- * @uiName Messenger Icon Horizontal
7454
- * @uiGroup Messenger
7455
- */
7456
- this.messengericonhorizontal = 7;
7457
- /**
7458
- * Number to vertically align the Messenger button icon
7459
- *
7460
- * @uiName Messenger Icon Vertical
7461
- * @uiGroup Messenger
7462
- */
7463
- this.messengericonvertical = 3;
7464
- /**
7465
- * @uiName Messenger Icon Size
7466
- * @uiGroup Messenger
7467
- */
7468
- this.messengericonsize = 1.4;
7469
- /**
7470
- * @uiName Line Icon
7471
- * @uiGroup Line Messenger
7472
- */
7473
- this.lineicon = "line";
7474
- /**
7475
- * Number to horizontally align the Line button icon
7476
- *
7477
- * @uiName Line Icon Horizontal
7478
- * @uiGroup Line Messenger
7479
- */
7480
- this.lineiconhorizontal = -2;
7481
- /**
7482
- * Number to vertically align the Line button icon
7483
- *
7484
- * @uiName Line Icon Vertical
7485
- * @uiGroup Line Messenger
7486
- */
7487
- this.lineiconvertical = -5;
7488
- /**
7489
- * @uiName Line Icon Size
7490
- * @uiGroup Line Messenger
7491
- */
7492
- this.lineiconsize = 2.2;
7493
- }
7494
- componentWillLoad() {
7495
- if (!this.ishidden) {
7496
- const mediums = [
7497
- "EMAIL",
7498
- "FACEBOOK",
7499
- "TWITTER",
7500
- "SMS",
7501
- "WHATSAPP",
7502
- "LINKEDIN",
7503
- "PINTEREST",
7504
- "FBMESSENGER",
7505
- "LINEMESSENGER",
7506
- ];
7507
- return this.getMessageLinks(mediums);
7508
- }
7509
- }
7510
- getMessageLinks(mediums) {
7511
- return API.graphql
7512
- .getMessageLinks(mediums)
7513
- .then((res) => {
7514
- this.emailurl = res.EMAIL;
7515
- this.facebookurl = res.FACEBOOK;
7516
- this.twitterurl = res.TWITTER;
7517
- this.smsurl = res.SMS;
7518
- this.whatsappurl = res.WHATSAPP;
7519
- this.linkedinurl = res.LINKEDIN;
7520
- this.pinteresturl = res.PINTEREST;
7521
- this.messengerurl = res.FBMESSENGER;
7522
- this.lineurl = res.LINEMESSENGER;
7523
- })
7524
- .catch((e) => {
7525
- this.onError(e);
7526
- });
7527
- }
7528
- onError(e) {
7529
- console.log("Error loading via GraphQL.", e);
7530
- }
7531
- render() {
7532
- const emailBtn = (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 }));
7533
- const facebookBtn = (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 }));
7534
- const twitterBtn = (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 }));
7535
- const smsBtn = (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 }));
7536
- const whatsappBtn = (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 }));
7537
- const linkedinBtn = (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 }));
7538
- const pinterestBtn = (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 }));
7539
- const messengerBtn = (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 }));
7540
- const lineBtn = (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 }));
7541
- return (!this.ishidden && (h("div", null, emailBtn, facebookBtn, twitterBtn, smsBtn, whatsappBtn, linkedinBtn, pinterestBtn, messengerBtn, lineBtn)));
7542
- }
7543
- };
7225
+ const ShareButtonContainer = class {
7226
+ constructor(hostRef) {
7227
+ registerInstance(this, hostRef);
7228
+ /**
7229
+ * @uiName Email Icon
7230
+ * @uiGroup Email
7231
+ */
7232
+ this.emailicon = "mail";
7233
+ /**
7234
+ * CSS class name for additional styling.
7235
+ *
7236
+ * @uiName Email Class Name
7237
+ * @uiGroup Email
7238
+ */
7239
+ this.emailclassName = "email-share";
7240
+ /**
7241
+ * @uiName Facebook Icon
7242
+ * @uiGroup Facebook
7243
+ */
7244
+ this.facebookicon = "facebook";
7245
+ /**
7246
+ * Number to horizontally align the facebook button icon
7247
+ *
7248
+ * @uiName Facebook Icon Horizontal
7249
+ * @uiGroup Facebook
7250
+ */
7251
+ this.facebookiconhorizontal = 9;
7252
+ /**
7253
+ * @uiName Facebook Icon Size
7254
+ * @uiGroup Facebook
7255
+ */
7256
+ this.facebookiconsize = 1.2;
7257
+ /**
7258
+ * @uiName Twitter Icon
7259
+ * @uiGroup Twitter
7260
+ */
7261
+ this.twittericon = "twitter";
7262
+ /**
7263
+ * Number to horizontally align the twitter button icon
7264
+ *
7265
+ * @uiName Twitter Icon Horizontal
7266
+ * @uiGroup Twitter
7267
+ */
7268
+ this.twittericonhorizontal = 9;
7269
+ /**
7270
+ * @uiName Twitter Icon Size
7271
+ * @uiGroup Twitter
7272
+ */
7273
+ this.twittericonsize = 1.2;
7274
+ /**
7275
+ * @uiName SMS Icon
7276
+ * @uiGroup SMS
7277
+ */
7278
+ this.smsicon = "chat";
7279
+ /**
7280
+ * @uiName WhatsApp Text Color
7281
+ * @uiGroup WhatsApp
7282
+ * @uiWidget color
7283
+ * @default #ffffff
7284
+ */
7285
+ this.whatsapptextcolor = "#fff";
7286
+ /**
7287
+ * @uiName WhatsApp Icon
7288
+ * @uiGroup WhatsApp
7289
+ */
7290
+ this.whatsappicon = "whatsapp";
7291
+ /**
7292
+ * Number to horizontally align the WhatsApp button icon
7293
+ *
7294
+ * @uiName WhatsApp Icon Horizontal
7295
+ * @uiGroup WhatsApp
7296
+ */
7297
+ this.whatsappiconhorizontal = 7;
7298
+ /**
7299
+ * Number to vertically align the WhatsApp button icon
7300
+ *
7301
+ * @uiName WhatsApp Icon Vertical
7302
+ * @uiGroup WhatsApp
7303
+ */
7304
+ this.whatsappiconvertical = 2;
7305
+ /**
7306
+ * @uiName WhatsApp Icon Size
7307
+ * @uiGroup WhatsApp
7308
+ */
7309
+ this.whatsappiconsize = 1.4;
7310
+ /**
7311
+ * @uiName Linkedin Icon
7312
+ * @uiGroup LinkedIn
7313
+ */
7314
+ this.linkedinicon = "linkedin";
7315
+ /**
7316
+ * @uiName Linkedin Icon Size
7317
+ * @uiGroup LinkedIn
7318
+ */
7319
+ this.linkediniconsize = 1.2;
7320
+ /**
7321
+ * @uiName Pinterest Icon
7322
+ * @uiGroup Pinterest
7323
+ */
7324
+ this.pinteresticon = "pinterest";
7325
+ /**
7326
+ * Number to horizontally align the Pinterest button icon
7327
+ *
7328
+ * @uiName Pinterest Icon Horizontal
7329
+ * @uiGroup Pinterest
7330
+ */
7331
+ this.pinteresticonhorizontal = 9;
7332
+ /**
7333
+ * Number to vertically align the Pinterest button icon
7334
+ *
7335
+ * @uiName Pinterest Icon Vertical
7336
+ * @uiGroup Pinterest
7337
+ */
7338
+ this.pinteresticonvertical = 4;
7339
+ /**
7340
+ * @uiName Pinterest Icon Size
7341
+ * @uiGroup Pinterest
7342
+ */
7343
+ this.pinteresticonsize = 1.2;
7344
+ /**
7345
+ * @uiName Messenger Icon
7346
+ * @uiGroup Messenger
7347
+ */
7348
+ this.messengericon = "messenger";
7349
+ /**
7350
+ * Number to horizontally align the Messenger button icon
7351
+ *
7352
+ * @uiName Messenger Icon Horizontal
7353
+ * @uiGroup Messenger
7354
+ */
7355
+ this.messengericonhorizontal = 7;
7356
+ /**
7357
+ * Number to vertically align the Messenger button icon
7358
+ *
7359
+ * @uiName Messenger Icon Vertical
7360
+ * @uiGroup Messenger
7361
+ */
7362
+ this.messengericonvertical = 3;
7363
+ /**
7364
+ * @uiName Messenger Icon Size
7365
+ * @uiGroup Messenger
7366
+ */
7367
+ this.messengericonsize = 1.4;
7368
+ /**
7369
+ * @uiName Line Icon
7370
+ * @uiGroup Line Messenger
7371
+ */
7372
+ this.lineicon = "line";
7373
+ /**
7374
+ * Number to horizontally align the Line button icon
7375
+ *
7376
+ * @uiName Line Icon Horizontal
7377
+ * @uiGroup Line Messenger
7378
+ */
7379
+ this.lineiconhorizontal = -2;
7380
+ /**
7381
+ * Number to vertically align the Line button icon
7382
+ *
7383
+ * @uiName Line Icon Vertical
7384
+ * @uiGroup Line Messenger
7385
+ */
7386
+ this.lineiconvertical = -5;
7387
+ /**
7388
+ * @uiName Line Icon Size
7389
+ * @uiGroup Line Messenger
7390
+ */
7391
+ this.lineiconsize = 2.2;
7392
+ }
7393
+ componentWillLoad() {
7394
+ if (!this.ishidden) {
7395
+ const mediums = [
7396
+ "EMAIL",
7397
+ "FACEBOOK",
7398
+ "TWITTER",
7399
+ "SMS",
7400
+ "WHATSAPP",
7401
+ "LINKEDIN",
7402
+ "PINTEREST",
7403
+ "FBMESSENGER",
7404
+ "LINEMESSENGER",
7405
+ ];
7406
+ return this.getMessageLinks(mediums);
7407
+ }
7408
+ }
7409
+ getMessageLinks(mediums) {
7410
+ return API.graphql
7411
+ .getMessageLinks(mediums)
7412
+ .then((res) => {
7413
+ this.emailurl = res.EMAIL;
7414
+ this.facebookurl = res.FACEBOOK;
7415
+ this.twitterurl = res.TWITTER;
7416
+ this.smsurl = res.SMS;
7417
+ this.whatsappurl = res.WHATSAPP;
7418
+ this.linkedinurl = res.LINKEDIN;
7419
+ this.pinteresturl = res.PINTEREST;
7420
+ this.messengerurl = res.FBMESSENGER;
7421
+ this.lineurl = res.LINEMESSENGER;
7422
+ })
7423
+ .catch((e) => {
7424
+ this.onError(e);
7425
+ });
7426
+ }
7427
+ onError(e) {
7428
+ console.log("Error loading via GraphQL.", e);
7429
+ }
7430
+ render() {
7431
+ const emailBtn = (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 }));
7432
+ const facebookBtn = (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 }));
7433
+ const twitterBtn = (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 }));
7434
+ const smsBtn = (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 }));
7435
+ const whatsappBtn = (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 }));
7436
+ const linkedinBtn = (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 }));
7437
+ const pinterestBtn = (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 }));
7438
+ const messengerBtn = (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 }));
7439
+ const lineBtn = (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 }));
7440
+ return (!this.ishidden && (h("div", null, emailBtn, facebookBtn, twitterBtn, smsBtn, whatsappBtn, linkedinBtn, pinterestBtn, messengerBtn, lineBtn)));
7441
+ }
7442
+ };
7544
7443
  ShareButtonContainer.style = shareButtonContainerCss;
7545
7444
 
7546
7445
  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}}";
7547
7446
 
7548
- const StatComponent = class {
7549
- constructor(hostRef) {
7550
- registerInstance(this, hostRef);
7551
- this.statTypeUpdated = createEvent(this, "statTypeUpdated", 7);
7552
- this.statAdded = createEvent(this, "statAdded", 7);
7553
- }
7554
- componentWillLoad() {
7555
- this.statAddedHandler(this.elem);
7556
- }
7557
- stattypeHandler(newValue, oldValue) {
7558
- if (newValue !== oldValue)
7559
- this.statTypeUpdatedHandler(this.elem);
7560
- }
7561
- statAddedHandler(stat) {
7562
- this.statAdded.emit(stat);
7563
- }
7564
- statTypeUpdatedHandler(stat) {
7565
- this.statTypeUpdated.emit(stat);
7566
- }
7567
- render() {
7447
+ const StatComponent = class {
7448
+ constructor(hostRef) {
7449
+ registerInstance(this, hostRef);
7450
+ this.statTypeUpdated = createEvent(this, "statTypeUpdated", 7);
7451
+ this.statAdded = createEvent(this, "statAdded", 7);
7452
+ }
7453
+ componentWillLoad() {
7454
+ this.statAddedHandler(this.elem);
7455
+ }
7456
+ stattypeHandler(newValue, oldValue) {
7457
+ if (newValue !== oldValue)
7458
+ this.statTypeUpdatedHandler(this.elem);
7459
+ }
7460
+ statAddedHandler(stat) {
7461
+ this.statAdded.emit(stat);
7462
+ }
7463
+ statTypeUpdatedHandler(stat) {
7464
+ this.statTypeUpdated.emit(stat);
7465
+ }
7466
+ render() {
7568
7467
  const clz = css `
7569
7468
  color: ${this.statcolor};
7570
- `;
7571
- return (!this.ishidden && (h("div", { class: clz }, h("div", { class: "stat-value" }, this.statvalue), h("div", { class: "stat-description" }, this.statdescription))));
7572
- }
7573
- get elem() { return getElement(this); }
7574
- static get watchers() { return {
7575
- "stattype": ["stattypeHandler"]
7576
- }; }
7577
- };
7469
+ `;
7470
+ return (!this.ishidden && (h("div", { class: clz }, h("div", { class: "stat-value" }, this.statvalue), h("div", { class: "stat-description" }, this.statdescription))));
7471
+ }
7472
+ get elem() { return getElement(this); }
7473
+ static get watchers() { return {
7474
+ "stattype": ["stattypeHandler"]
7475
+ }; }
7476
+ };
7578
7477
  StatComponent.style = statComponentCss;
7579
7478
 
7580
7479
  /**
@@ -7872,108 +7771,108 @@ function pathToRegexp(path, keys, options) {
7872
7771
 
7873
7772
  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%}}";
7874
7773
 
7875
- const StatsContainer = class {
7876
- constructor(hostRef) {
7877
- registerInstance(this, hostRef);
7878
- /**
7879
- * @undocumented
7880
- * @uiName Hide stats
7881
- */
7882
- this.ishidden = false;
7883
- this.statPaths = [
7884
- "/rewardBalance/:type/:unit/:valuetype?/:isGlobal?",
7885
- "/:statName",
7886
- ];
7887
- this.statPathRegexp = this.statPaths.map((path) => {
7888
- const keys = [];
7889
- const regexp = pathToRegexp(path, keys);
7890
- return { regexp, keys };
7891
- });
7892
- this.loading = true;
7893
- }
7894
- componentWillLoad() {
7895
- if (!this.ishidden) {
7896
- return API.graphql
7897
- .getStats()
7898
- .then((res) => {
7899
- this.stats = {
7900
- referralsCount: res.referralsCount.totalCount,
7901
- referralsMonth: res.referralsMonth.totalCount,
7902
- referralsWeek: res.referralsWeek.totalCount,
7903
- rewardsCount: res.rewardsCount.totalCount,
7904
- rewardsMonth: res.rewardsMonth.totalCount,
7905
- rewardsWeek: res.rewardsWeek.totalCount,
7906
- rewardBalance: res.rewardBalances,
7907
- rewardBalanceGlobal: res.rewardBalancesGlobal,
7908
- };
7909
- this.loading = false;
7910
- })
7911
- .then(() => {
7912
- const children = Array.from(this.container.querySelectorAll("[stattype]"));
7913
- children.map((child) => {
7914
- this.setStatValue(child);
7915
- });
7916
- })
7917
- .catch((e) => {
7918
- this.onError(e);
7919
- });
7920
- }
7921
- }
7922
- statTypeUpdatedHandler(event) {
7923
- this.setStatValue(event.detail);
7924
- }
7925
- statAddedHandler(event) {
7926
- if (this.stats)
7927
- this.setStatValue(event.detail);
7928
- }
7929
- setStatValue(child) {
7930
- const path = child.getAttribute("stattype");
7931
- const stat = this.getStatFromPath(path);
7932
- child.setAttribute("statvalue", `${stat}`);
7933
- return child;
7934
- }
7935
- getStatFromPath(path) {
7936
- const statPath = this.statPathRegexp.find((stat) => stat.regexp.test(path));
7937
- if (!statPath)
7938
- return 0;
7939
- const { keys, regexp } = statPath;
7940
- const res = regexp.exec(path);
7941
- const statVariables = {};
7942
- keys.forEach((k, i) => (statVariables[k.name] = res[i + 1]));
7943
- return this.getStatValue(statVariables);
7944
- }
7945
- getStatValue(statVariables) {
7946
- if (statVariables.statName)
7947
- return this.stats[statVariables.statName] || 0;
7948
- return this.getRewardBalance(statVariables);
7949
- }
7950
- getRewardBalance(statVariables) {
7951
- const { type, unit, valuetype, isGlobal } = statVariables;
7952
- // passing in CASH/USD as CASH_USD into this webcomponent so pathToRegexp doesn't split it and it stays all in unit.
7953
- // this converts the _ back to / so it matches the unit from the backend.
7954
- // possibly change the unit in the backend to avoid this?
7955
- const newUnit = unit.replace(/_/, "/");
7956
- const rewardBalance = this.stats[isGlobal ? "rewardBalanceGlobal" : "rewardBalance"].find((rb) => rb.type === type && rb.unit === newUnit);
7957
- if (!rewardBalance)
7958
- return 0;
7959
- if (valuetype)
7960
- return rewardBalance[valuetype];
7961
- return rewardBalance.value;
7962
- }
7963
- onError(e) {
7964
- console.log("Error loading via GraphQL.", e);
7965
- this.loading = false;
7966
- }
7967
- render() {
7774
+ const StatsContainer = class {
7775
+ constructor(hostRef) {
7776
+ registerInstance(this, hostRef);
7777
+ /**
7778
+ * @undocumented
7779
+ * @uiName Hide stats
7780
+ */
7781
+ this.ishidden = false;
7782
+ this.statPaths = [
7783
+ "/rewardBalance/:type/:unit/:valuetype?/:isGlobal?",
7784
+ "/:statName",
7785
+ ];
7786
+ this.statPathRegexp = this.statPaths.map((path) => {
7787
+ const keys = [];
7788
+ const regexp = pathToRegexp(path, keys);
7789
+ return { regexp, keys };
7790
+ });
7791
+ this.loading = true;
7792
+ }
7793
+ componentWillLoad() {
7794
+ if (!this.ishidden) {
7795
+ return API.graphql
7796
+ .getStats()
7797
+ .then((res) => {
7798
+ this.stats = {
7799
+ referralsCount: res.referralsCount.totalCount,
7800
+ referralsMonth: res.referralsMonth.totalCount,
7801
+ referralsWeek: res.referralsWeek.totalCount,
7802
+ rewardsCount: res.rewardsCount.totalCount,
7803
+ rewardsMonth: res.rewardsMonth.totalCount,
7804
+ rewardsWeek: res.rewardsWeek.totalCount,
7805
+ rewardBalance: res.rewardBalances,
7806
+ rewardBalanceGlobal: res.rewardBalancesGlobal,
7807
+ };
7808
+ this.loading = false;
7809
+ })
7810
+ .then(() => {
7811
+ const children = Array.from(this.container.querySelectorAll("[stattype]"));
7812
+ children.map((child) => {
7813
+ this.setStatValue(child);
7814
+ });
7815
+ })
7816
+ .catch((e) => {
7817
+ this.onError(e);
7818
+ });
7819
+ }
7820
+ }
7821
+ statTypeUpdatedHandler(event) {
7822
+ this.setStatValue(event.detail);
7823
+ }
7824
+ statAddedHandler(event) {
7825
+ if (this.stats)
7826
+ this.setStatValue(event.detail);
7827
+ }
7828
+ setStatValue(child) {
7829
+ const path = child.getAttribute("stattype");
7830
+ const stat = this.getStatFromPath(path);
7831
+ child.setAttribute("statvalue", `${stat}`);
7832
+ return child;
7833
+ }
7834
+ getStatFromPath(path) {
7835
+ const statPath = this.statPathRegexp.find((stat) => stat.regexp.test(path));
7836
+ if (!statPath)
7837
+ return 0;
7838
+ const { keys, regexp } = statPath;
7839
+ const res = regexp.exec(path);
7840
+ const statVariables = {};
7841
+ keys.forEach((k, i) => (statVariables[k.name] = res[i + 1]));
7842
+ return this.getStatValue(statVariables);
7843
+ }
7844
+ getStatValue(statVariables) {
7845
+ if (statVariables.statName)
7846
+ return this.stats[statVariables.statName] || 0;
7847
+ return this.getRewardBalance(statVariables);
7848
+ }
7849
+ getRewardBalance(statVariables) {
7850
+ const { type, unit, valuetype, isGlobal } = statVariables;
7851
+ // passing in CASH/USD as CASH_USD into this webcomponent so pathToRegexp doesn't split it and it stays all in unit.
7852
+ // this converts the _ back to / so it matches the unit from the backend.
7853
+ // possibly change the unit in the backend to avoid this?
7854
+ const newUnit = unit.replace(/_/, "/");
7855
+ const rewardBalance = this.stats[isGlobal ? "rewardBalanceGlobal" : "rewardBalance"].find((rb) => rb.type === type && rb.unit === newUnit);
7856
+ if (!rewardBalance)
7857
+ return 0;
7858
+ if (valuetype)
7859
+ return rewardBalance[valuetype];
7860
+ return rewardBalance.value;
7861
+ }
7862
+ onError(e) {
7863
+ console.log("Error loading via GraphQL.", e);
7864
+ this.loading = false;
7865
+ }
7866
+ render() {
7968
7867
  const containerStyle = css `
7969
7868
  display: ${this.ishidden ? "none" : "inherit"};
7970
7869
  padding-top: ${this.paddingtop}px;
7971
7870
  padding-bottom: ${this.paddingbottom}px;
7972
- `;
7973
- return (h("div", { class: containerStyle }, h("slot", null)));
7974
- }
7975
- get container() { return getElement(this); }
7976
- };
7871
+ `;
7872
+ return (h("div", { class: containerStyle }, h("slot", null)));
7873
+ }
7874
+ get container() { return getElement(this); }
7875
+ };
7977
7876
  StatsContainer.style = statsContainerCss;
7978
7877
 
7979
7878
  var marked = createCommonjsModule(function (module, exports) {
@@ -10574,12 +10473,12 @@ var marked = createCommonjsModule(function (module, exports) {
10574
10473
 
10575
10474
  const textComponentCss = "sqh-text-component{display:block}sqh-text-component p{margin:0}";
10576
10475
 
10577
- const TextComponent = class {
10578
- constructor(hostRef) {
10579
- registerInstance(this, hostRef);
10580
- }
10581
- render() {
10582
- 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;
10476
+ const TextComponent = class {
10477
+ constructor(hostRef) {
10478
+ registerInstance(this, hostRef);
10479
+ }
10480
+ render() {
10481
+ 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;
10583
10482
  const textStyle = css `
10584
10483
  font-family: ${this.fontfamily || "inherit"};
10585
10484
  font-size: ${this.fontsize ? this.fontsize + "px" : "inherit"};
@@ -10587,25 +10486,25 @@ const TextComponent = class {
10587
10486
  text-align: ${this.textalign};
10588
10487
  color: ${this.color || "inherit"};
10589
10488
  padding-top: ${this.paddingtop ? this.paddingtop + "px" : "inherit"};
10590
- padding-bottom: ${this.paddingbottom
10591
- ? this.paddingbottom + "px"
10489
+ padding-bottom: ${this.paddingbottom
10490
+ ? this.paddingbottom + "px"
10592
10491
  : "inherit"};
10593
10492
  overflow-wrap: break-word;
10594
- `;
10493
+ `;
10595
10494
  const divStyle = css `
10596
- background: ${this.background
10597
- ? this.background.match(regex)
10598
- ? `url(${this.background}) no-repeat center center;`
10599
- : this.background
10495
+ background: ${this.background
10496
+ ? this.background.match(regex)
10497
+ ? `url(${this.background}) no-repeat center center;`
10498
+ : this.background
10600
10499
  : "inherit"};
10601
10500
  height: ${this.height || "inherit"};
10602
10501
  background-size: contain;
10603
- `;
10604
- const content = this.ismarkdown ? (h("div", { innerHTML: marked(this.text) })) : (this.text);
10605
- return (!this.ishidden && (h("div", { class: divStyle }, h("p", { class: textStyle }, content))));
10606
- }
10607
- get textEl() { return getElement(this); }
10608
- };
10502
+ `;
10503
+ const content = this.ismarkdown ? (h("div", { innerHTML: marked(this.text) })) : (this.text);
10504
+ return (!this.ishidden && (h("div", { class: divStyle }, h("p", { class: textStyle }, content))));
10505
+ }
10506
+ get textEl() { return getElement(this); }
10507
+ };
10609
10508
  TextComponent.style = textComponentCss;
10610
10509
 
10611
10510
  export { CopyButton as sqh_copy_button, CopyLinkButton as sqh_copy_link_button, GlobalContainer as sqh_global_container, ImageComponent as sqh_image_component, PartnerStatComponent as sqh_partner_stat_component, ReferralComponent as sqh_referral_component, ReferralList as sqh_referral_list, ShareButton as sqh_share_button, ShareButtonContainer as sqh_share_button_container, StatComponent as sqh_stat_component, StatsContainer as sqh_stats_container, TextComponent as sqh_text_component };