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