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