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