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