genesys-spark-chart-components 4.12.1-beta.1 → 4.29.1-beta.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 +2 -2
- package/dist/cjs/app-globals-3a1e7e63.js +5 -0
- package/dist/cjs/genesys-chart-webcomponents.cjs.js +5 -3
- package/dist/cjs/gux-chart-column-beta.cjs.entry.js +124 -123
- package/dist/cjs/gux-chart-donut-beta.cjs.entry.js +213 -212
- package/dist/cjs/gux-chart-line-beta.cjs.entry.js +120 -119
- package/dist/cjs/gux-chart-pie-beta.cjs.entry.js +96 -95
- package/dist/cjs/gux-chart-scatter-plot-beta.cjs.entry.js +126 -125
- package/dist/cjs/gux-visualization-beta.cjs.entry.js +213 -213
- package/dist/cjs/{index-1e13a15f.js → index-a4712860.js} +185 -63
- package/dist/cjs/loader.cjs.js +4 -2
- package/dist/cjs/log-error-28c7064e.js +21 -0
- package/dist/cjs/{usage-30f04ec3.js → usage-c351d7fb.js} +63 -63
- package/dist/collection/collection-manifest.json +2 -2
- package/dist/collection/components/beta/gux-chart-column/gux-chart-column.js +324 -324
- package/dist/collection/components/beta/gux-chart-column/gux-chart-column.locale.js +88 -88
- package/dist/collection/components/beta/gux-chart-column/tests/gux-column-chart.spec.js +16 -16
- package/dist/collection/components/beta/gux-chart-donut/gux-chart-donut.js +550 -550
- package/dist/collection/components/beta/gux-chart-donut/tests/gux-chart-donut.spec.js +5 -5
- package/dist/collection/components/beta/gux-chart-line/gux-chart-line.js +375 -375
- package/dist/collection/components/beta/gux-chart-line/gux-chart-line.locale.js +88 -88
- package/dist/collection/components/beta/gux-chart-line/tests/gux-chart-line.e2e.js +13 -13
- package/dist/collection/components/beta/gux-chart-line/tests/gux-chart-line.spec.js +16 -16
- package/dist/collection/components/beta/gux-chart-pie/gux-chart-pie.js +266 -266
- package/dist/collection/components/beta/gux-chart-pie/tests/gux-chart-pie.spec.js +5 -5
- package/dist/collection/components/beta/gux-chart-scatter-plot/gux-chart-scatter-plot.js +347 -347
- package/dist/collection/components/beta/gux-chart-scatter-plot/tests/gux-chart-scatter-plot.spec.js +27 -27
- package/dist/collection/components/beta/gux-visualization/gux-visualization.js +133 -133
- package/dist/collection/components/beta/gux-visualization/gux-visualization.locale.js +88 -88
- package/dist/collection/components/beta/gux-visualization/tests/gux-visualization.e2e.js +25 -25
- package/dist/collection/components/beta/gux-visualization/tests/gux-visualization.spec.js +26 -26
- package/dist/collection/i18n/fetchResources.js +7 -7
- package/dist/collection/i18n/index.js +56 -56
- package/dist/collection/test/axeConfig.js +4 -4
- package/dist/collection/test/e2eTestUtils.js +14 -14
- package/dist/collection/test/specTestUtils.js +5 -5
- package/dist/collection/utils/dom/get-closest-element.js +12 -12
- package/dist/collection/utils/error/log-error.js +2 -2
- package/dist/collection/utils/theme/color-palette.js +10 -10
- package/dist/collection/utils/tracking/usage.js +47 -47
- package/dist/collection/utils/tracking/usage.spec.js +108 -108
- package/dist/esm/app-globals-0f993ce5.js +3 -0
- package/dist/esm/genesys-chart-webcomponents.js +6 -4
- package/dist/esm/gux-chart-column-beta.entry.js +124 -123
- package/dist/esm/gux-chart-donut-beta.entry.js +213 -212
- package/dist/esm/gux-chart-line-beta.entry.js +120 -119
- package/dist/esm/gux-chart-pie-beta.entry.js +96 -95
- package/dist/esm/gux-chart-scatter-plot-beta.entry.js +126 -125
- package/dist/esm/gux-visualization-beta.entry.js +213 -213
- package/dist/esm/{index-701d93cf.js → index-82fd7406.js} +185 -63
- package/dist/esm/loader.js +5 -3
- package/dist/esm/log-error-ff9bdda4.js +18 -0
- package/dist/esm/{usage-61eee3bd.js → usage-6655c04e.js} +63 -63
- package/dist/genesys-chart-webcomponents/genesys-chart-webcomponents.css +1 -1
- package/dist/genesys-chart-webcomponents/genesys-chart-webcomponents.esm.js +1 -1
- package/dist/genesys-chart-webcomponents/p-1bc0cc3a.js +2 -0
- package/dist/genesys-chart-webcomponents/{p-d4a346df.entry.js → p-291b128b.entry.js} +1 -1
- package/dist/genesys-chart-webcomponents/p-51f2502a.entry.js +11 -0
- package/dist/genesys-chart-webcomponents/{p-137f5b8f.entry.js → p-64f0b385.entry.js} +1 -1
- package/dist/genesys-chart-webcomponents/{p-b5179379.entry.js → p-65020b8a.entry.js} +1 -1
- package/dist/genesys-chart-webcomponents/{p-d9928f8c.entry.js → p-83283e73.entry.js} +1 -1
- package/dist/genesys-chart-webcomponents/p-e1255160.js +1 -0
- package/dist/genesys-chart-webcomponents/{p-c3aa8578.entry.js → p-e42dd3ba.entry.js} +1 -1
- package/dist/genesys-chart-webcomponents/{p-97c45977.js → p-f6832775.js} +1 -1
- package/dist/stencil-wrapper.js +1 -1
- package/dist/types/components/beta/gux-chart-column/gux-chart-column.d.ts +45 -45
- package/dist/types/components/beta/gux-chart-column/gux-chart-column.locale.d.ts +20 -20
- package/dist/types/components/beta/gux-chart-donut/gux-chart-donut.d.ts +30 -30
- package/dist/types/components/beta/gux-chart-line/gux-chart-line.d.ts +44 -44
- package/dist/types/components/beta/gux-chart-line/gux-chart-line.locale.d.ts +20 -20
- package/dist/types/components/beta/gux-chart-pie/gux-chart-pie.d.ts +19 -19
- package/dist/types/components/beta/gux-chart-scatter-plot/gux-chart-scatter-plot.d.ts +48 -48
- package/dist/types/components/beta/gux-visualization/gux-visualization.d.ts +13 -13
- package/dist/types/components/beta/gux-visualization/gux-visualization.locale.d.ts +20 -20
- package/dist/types/components.d.ts +12 -0
- package/dist/types/i18n/fetchResources.d.ts +3 -3
- package/dist/types/i18n/index.d.ts +1 -1
- package/dist/types/stencil-public-runtime.d.ts +10 -0
- package/dist/types/stencil-wrapper.d.ts +1 -1
- package/dist/types/test/axeConfig.d.ts +4 -4
- package/dist/types/test/e2eTestUtils.d.ts +4 -4
- package/dist/types/test/jestMatcherUtils.d.ts +4 -4
- package/dist/types/utils/tracking/usage.d.ts +11 -11
- package/package.json +24 -24
- package/dist/cjs/log-error-c46b4b4c.js +0 -21
- package/dist/component-specs.json +0 -187
- package/dist/esm/log-error-0fc61f6f.js +0 -18
- package/dist/genesys-chart-webcomponents/p-3e4b3dbc.js +0 -2
- package/dist/genesys-chart-webcomponents/p-b901e9e0.entry.js +0 -11
- /package/dist/genesys-chart-webcomponents/{p-82f0ea01.js → p-f50e3789.js} +0 -0
|
@@ -2,11 +2,11 @@ import { getAssetPath } from "@stencil/core";
|
|
|
2
2
|
const resourceCache = {};
|
|
3
3
|
export const determineFetchUrl = (locale = 'en') => getAssetPath(`i18n/genesys-webcomponents.i18n.${locale}.json`);
|
|
4
4
|
export const fetchResources = async (componentName, locale) => {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
5
|
+
if (!resourceCache[locale]) {
|
|
6
|
+
const url = determineFetchUrl(locale);
|
|
7
|
+
const response = await fetch(url);
|
|
8
|
+
const resources = await response.json();
|
|
9
|
+
resourceCache[locale] = resources;
|
|
10
|
+
}
|
|
11
|
+
return resourceCache[locale][componentName];
|
|
12
12
|
};
|
|
@@ -5,69 +5,69 @@ import locales from "./locales.json";
|
|
|
5
5
|
import { getClosestElement } from "../utils/dom/get-closest-element";
|
|
6
6
|
const DEFAULT_LOCALE = 'en';
|
|
7
7
|
export async function buildI18nForComponent(component, defaultResources, parentComponent) {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
}
|
|
14
|
-
const intlFormats = Object.entries(resources).reduce((map, [key, val]) => {
|
|
15
|
-
map.set(key, new IntlMessageFormat(val, locale));
|
|
16
|
-
return map;
|
|
17
|
-
}, new Map());
|
|
18
|
-
const defaultFormats = Object.entries(defaultResources).reduce((map, [key, val]) => {
|
|
19
|
-
map.set(key, new IntlMessageFormat(val, DEFAULT_LOCALE));
|
|
20
|
-
return map;
|
|
21
|
-
}, new Map());
|
|
22
|
-
return (resourceKey, context) => {
|
|
23
|
-
var _a, _b;
|
|
24
|
-
let i18nString = (_a = intlFormats.get(resourceKey)) === null || _a === void 0 ? void 0 : _a.format(context);
|
|
25
|
-
if (!i18nString) {
|
|
26
|
-
i18nString = (_b = defaultFormats.get(resourceKey)) === null || _b === void 0 ? void 0 : _b.format(context);
|
|
27
|
-
console.warn(`No localized string available for "${resourceKey}-${i18nString}" for "${locale}" locale. Falling back to English translation.`);
|
|
8
|
+
let resources = defaultResources;
|
|
9
|
+
let locale = 'en';
|
|
10
|
+
if (component !== undefined) {
|
|
11
|
+
locale = getDesiredLocale(component);
|
|
12
|
+
resources = await getComponentI18nResources(component, defaultResources, locale, parentComponent);
|
|
28
13
|
}
|
|
29
|
-
|
|
30
|
-
|
|
14
|
+
const intlFormats = Object.entries(resources).reduce((map, [key, val]) => {
|
|
15
|
+
map.set(key, new IntlMessageFormat(val, locale));
|
|
16
|
+
return map;
|
|
17
|
+
}, new Map());
|
|
18
|
+
const defaultFormats = Object.entries(defaultResources).reduce((map, [key, val]) => {
|
|
19
|
+
map.set(key, new IntlMessageFormat(val, DEFAULT_LOCALE));
|
|
20
|
+
return map;
|
|
21
|
+
}, new Map());
|
|
22
|
+
return (resourceKey, context) => {
|
|
23
|
+
var _a, _b;
|
|
24
|
+
let i18nString = (_a = intlFormats.get(resourceKey)) === null || _a === void 0 ? void 0 : _a.format(context);
|
|
25
|
+
if (!i18nString) {
|
|
26
|
+
i18nString = (_b = defaultFormats.get(resourceKey)) === null || _b === void 0 ? void 0 : _b.format(context);
|
|
27
|
+
console.warn(`No localized string available for "${resourceKey}-${i18nString}" for "${locale}" locale. Falling back to English translation.`);
|
|
28
|
+
}
|
|
29
|
+
return i18nString;
|
|
30
|
+
};
|
|
31
31
|
}
|
|
32
32
|
export async function getComponentI18nResources(component, defaultResources, locale, parentComponent) {
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
}
|
|
39
|
-
else if (locale !== DEFAULT_LOCALE) {
|
|
40
|
-
try {
|
|
41
|
-
resources = await fetchResources(componentName, locale);
|
|
33
|
+
const componentName = parentComponent ||
|
|
34
|
+
component.tagName.toLocaleLowerCase().replace(/-beta$/, '');
|
|
35
|
+
let resources;
|
|
36
|
+
if (component['i18n-resources']) {
|
|
37
|
+
resources = component['i18n-resources'];
|
|
42
38
|
}
|
|
43
|
-
|
|
44
|
-
|
|
39
|
+
else if (locale !== DEFAULT_LOCALE) {
|
|
40
|
+
try {
|
|
41
|
+
resources = await fetchResources(componentName, locale);
|
|
42
|
+
}
|
|
43
|
+
catch (_) {
|
|
44
|
+
resources = null;
|
|
45
|
+
}
|
|
45
46
|
}
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
return resources;
|
|
47
|
+
if (!resources) {
|
|
48
|
+
resources = defaultResources;
|
|
49
|
+
}
|
|
50
|
+
return resources;
|
|
51
51
|
}
|
|
52
52
|
export function getDesiredLocale(element) {
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
53
|
+
const locale = findLocaleInDom(element);
|
|
54
|
+
const lang = locale.split(/[_-]/)[0];
|
|
55
|
+
if (locales.indexOf(locale) >= 0) {
|
|
56
|
+
return locale;
|
|
57
|
+
}
|
|
58
|
+
else if (locales.indexOf(lang) >= 0) {
|
|
59
|
+
return lang;
|
|
60
|
+
}
|
|
61
|
+
else {
|
|
62
|
+
return DEFAULT_LOCALE;
|
|
63
|
+
}
|
|
64
64
|
}
|
|
65
65
|
function findLocaleInDom(element) {
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
66
|
+
const closestElement = getClosestElement('[lang]', element);
|
|
67
|
+
if (closestElement && closestElement.lang) {
|
|
68
|
+
return closestElement.lang.toLowerCase();
|
|
69
|
+
}
|
|
70
|
+
else {
|
|
71
|
+
return DEFAULT_LOCALE;
|
|
72
|
+
}
|
|
73
73
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// config for axe-core automated testing in e2e tests
|
|
2
2
|
export const axeConfig = {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
3
|
+
runOnly: {
|
|
4
|
+
type: 'tags',
|
|
5
|
+
values: ['wcag2a', 'wcag2aa', 'wcag21a', 'wcag21aa']
|
|
6
|
+
}
|
|
7
7
|
};
|
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
import { newE2EPage } from "@stencil/core/testing";
|
|
2
2
|
import { axeConfig } from "./axeConfig";
|
|
3
3
|
export async function a11yCheck(page, axeExclusions = [], axeScanContext = '') {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
4
|
+
const axeScanDetails = {
|
|
5
|
+
axeExclusions,
|
|
6
|
+
axeScanContext
|
|
7
|
+
};
|
|
8
|
+
const axeResults = await page.evaluate(`window.axe.run('body > *', ${JSON.stringify(axeConfig)})`);
|
|
9
|
+
// eslint-disable-next-line
|
|
10
|
+
expect(axeResults.violations).toHaveNoViolations(axeScanDetails);
|
|
11
11
|
}
|
|
12
12
|
export async function newSparkE2EPage({ html }, lang = 'en') {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
13
|
+
const page = await newE2EPage();
|
|
14
|
+
await page.setContent(`<div lang=${lang}>${html}</div>`);
|
|
15
|
+
await page.addScriptTag({
|
|
16
|
+
path: '../../node_modules/axe-core/axe.min.js'
|
|
17
|
+
});
|
|
18
|
+
await page.waitForChanges();
|
|
19
|
+
return page;
|
|
20
20
|
}
|
|
@@ -2,9 +2,9 @@ import { newSpecPage as stencilSpecPage } from "@stencil/core/testing";
|
|
|
2
2
|
import MutationObserver from "mutation-observer";
|
|
3
3
|
import ResizeObserver from "resize-observer-polyfill";
|
|
4
4
|
export async function newSpecPage(opts) {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
5
|
+
global.MutationObserver = MutationObserver;
|
|
6
|
+
global.ResizeObserver = ResizeObserver;
|
|
7
|
+
global.InputEvent = Event;
|
|
8
|
+
const page = await stencilSpecPage(opts);
|
|
9
|
+
return page;
|
|
10
10
|
}
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
export function getClosestElement(selector, baseElement = this) {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
function closest(element) {
|
|
3
|
+
if (!element || element === document || element === window) {
|
|
4
|
+
return null;
|
|
5
|
+
}
|
|
6
|
+
if (element.assignedSlot) {
|
|
7
|
+
element = element.assignedSlot;
|
|
8
|
+
}
|
|
9
|
+
const found = element.closest(selector);
|
|
10
|
+
return found
|
|
11
|
+
? found
|
|
12
|
+
: closest(element.getRootNode().host);
|
|
5
13
|
}
|
|
6
|
-
|
|
7
|
-
element = element.assignedSlot;
|
|
8
|
-
}
|
|
9
|
-
const found = element.closest(selector);
|
|
10
|
-
return found
|
|
11
|
-
? found
|
|
12
|
-
: closest(element.getRootNode().host);
|
|
13
|
-
}
|
|
14
|
-
return closest(baseElement);
|
|
14
|
+
return closest(baseElement);
|
|
15
15
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export function logError(component, message) {
|
|
2
|
-
|
|
2
|
+
console.error(`[${component.tagName.toLowerCase()}] ${message}`, component);
|
|
3
3
|
}
|
|
4
4
|
export function logWarn(component, message) {
|
|
5
|
-
|
|
5
|
+
console.warn(`[${component.tagName.toLowerCase()}] ${message}`, component);
|
|
6
6
|
}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
export const VISUALIZATION_COLORS = [
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
2
|
+
'#203B73',
|
|
3
|
+
'#1DA8B3',
|
|
4
|
+
'#75A8FF',
|
|
5
|
+
'#8452CF',
|
|
6
|
+
'#B5B5EB',
|
|
7
|
+
'#CC3EBE',
|
|
8
|
+
'#5E5782',
|
|
9
|
+
'#FF8FDD',
|
|
10
|
+
'#868C1E',
|
|
11
|
+
'#DDD933'
|
|
12
12
|
];
|
|
@@ -7,7 +7,7 @@ const NR_LIMIT_INTERVAL = 30000; // 30s
|
|
|
7
7
|
* We initialize it with the library version to make sure that's always reported.
|
|
8
8
|
*/
|
|
9
9
|
const actionQueue = [
|
|
10
|
-
|
|
10
|
+
getVersionEvent(packageInfo.version)
|
|
11
11
|
];
|
|
12
12
|
/**
|
|
13
13
|
* Process the next batch items in the queue, set a timeout to recur.
|
|
@@ -16,66 +16,66 @@ const actionQueue = [
|
|
|
16
16
|
* held up by processing elsewhere.
|
|
17
17
|
*/
|
|
18
18
|
function processActionQueue() {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
}
|
|
23
|
-
for (let i = 0; i < ACTION_BATCH_SIZE; i++) {
|
|
24
|
-
if (actionQueue.length == 0) {
|
|
25
|
-
setTimeout(processActionQueue, NR_LIMIT_INTERVAL);
|
|
26
|
-
return;
|
|
19
|
+
const newrelic = window.newrelic;
|
|
20
|
+
if (!newrelic) {
|
|
21
|
+
return;
|
|
27
22
|
}
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
23
|
+
for (let i = 0; i < ACTION_BATCH_SIZE; i++) {
|
|
24
|
+
if (actionQueue.length == 0) {
|
|
25
|
+
setTimeout(processActionQueue, NR_LIMIT_INTERVAL);
|
|
26
|
+
return;
|
|
27
|
+
}
|
|
28
|
+
const action = actionQueue.shift();
|
|
29
|
+
newrelic.addPageAction(action.name, Object.assign(Object.assign({}, action.metadata), { queueDepth: actionQueue.length }));
|
|
30
|
+
}
|
|
31
|
+
setTimeout(processActionQueue, NR_LIMIT_INTERVAL);
|
|
32
32
|
}
|
|
33
33
|
let trackingStarted = false;
|
|
34
34
|
/**
|
|
35
35
|
* Begin action processing loop if it hasn't started.
|
|
36
36
|
*/
|
|
37
37
|
function ensureTracking() {
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
38
|
+
if (!trackingStarted) {
|
|
39
|
+
trackingStarted = true;
|
|
40
|
+
processActionQueue();
|
|
41
|
+
}
|
|
42
42
|
}
|
|
43
43
|
/**
|
|
44
44
|
* Submits a component for tracking by NewRelic.
|
|
45
45
|
*/
|
|
46
46
|
export function trackComponent(element, metadata) {
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
47
|
+
if (!window.newrelic) {
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
50
|
+
ensureTracking();
|
|
51
|
+
// Ignore components in the shadow DOM of another component
|
|
52
|
+
// e.g. Only track components used directly by the app
|
|
53
|
+
if (!document.contains(element)) {
|
|
54
|
+
return;
|
|
55
|
+
}
|
|
56
|
+
actionQueue.push({
|
|
57
|
+
name: 'spark-component',
|
|
58
|
+
metadata: Object.assign(Object.assign({}, metadata), { component: element.tagName.toLowerCase(), version: packageInfo.version })
|
|
59
|
+
});
|
|
60
60
|
}
|
|
61
61
|
export function trackAction(element, action, actionMetadata) {
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
62
|
+
if (!window.newrelic) {
|
|
63
|
+
return;
|
|
64
|
+
}
|
|
65
|
+
ensureTracking();
|
|
66
|
+
actionQueue.push({
|
|
67
|
+
name: 'spark-action',
|
|
68
|
+
metadata: Object.assign(Object.assign({}, actionMetadata), { action, component: element.tagName.toLowerCase() })
|
|
69
|
+
});
|
|
70
70
|
}
|
|
71
71
|
export function getVersionEvent(packageInfoVersion) {
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
72
|
+
const [major, minor, ...patch] = packageInfoVersion.split('.');
|
|
73
|
+
return {
|
|
74
|
+
name: 'spark-library',
|
|
75
|
+
metadata: {
|
|
76
|
+
fullVersion: `${major}.${minor}.${patch.join('.')}`,
|
|
77
|
+
majorVersion: major,
|
|
78
|
+
minorVersion: `${major}.${minor}`
|
|
79
|
+
}
|
|
80
|
+
};
|
|
81
81
|
}
|
|
@@ -3,119 +3,119 @@ import packageInfo from "../../../package.json";
|
|
|
3
3
|
const component = document.createElement('gux-button');
|
|
4
4
|
const addPageAction = jest.fn();
|
|
5
5
|
describe('tracking/usage', () => {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
});
|
|
9
|
-
beforeEach(() => {
|
|
10
|
-
addPageAction.mockClear();
|
|
11
|
-
window.newrelic = {
|
|
12
|
-
addPageAction
|
|
13
|
-
};
|
|
14
|
-
window.document.contains = jest.fn().mockReturnValue(true);
|
|
15
|
-
});
|
|
16
|
-
describe('Component usage tracking', () => {
|
|
17
|
-
test("Doesn't throw when newrelic is not present", () => {
|
|
18
|
-
window.newrelic = undefined;
|
|
19
|
-
expect(() => {
|
|
20
|
-
trackComponent(component);
|
|
21
|
-
}).not.toThrow();
|
|
6
|
+
beforeAll(() => {
|
|
7
|
+
jest.useFakeTimers();
|
|
22
8
|
});
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
expect(versionInfo.fullVersion).toBe(packageInfo.version);
|
|
30
|
-
expect(packageInfo.version.startsWith(versionInfo.majorVersion)).toBe(true);
|
|
31
|
-
expect(packageInfo.version.startsWith(versionInfo.minorVersion)).toBe(true);
|
|
9
|
+
beforeEach(() => {
|
|
10
|
+
addPageAction.mockClear();
|
|
11
|
+
window.newrelic = {
|
|
12
|
+
addPageAction
|
|
13
|
+
};
|
|
14
|
+
window.document.contains = jest.fn().mockReturnValue(true);
|
|
32
15
|
});
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
16
|
+
describe('Component usage tracking', () => {
|
|
17
|
+
test("Doesn't throw when newrelic is not present", () => {
|
|
18
|
+
window.newrelic = undefined;
|
|
19
|
+
expect(() => {
|
|
20
|
+
trackComponent(component);
|
|
21
|
+
}).not.toThrow();
|
|
22
|
+
});
|
|
23
|
+
test('Logs the library after the first component loads', () => {
|
|
24
|
+
trackComponent(component);
|
|
25
|
+
jest.runOnlyPendingTimers();
|
|
26
|
+
expect(addPageAction).toHaveBeenCalledTimes(2);
|
|
27
|
+
expect(addPageAction.mock.calls[0][0]).toBe('spark-library');
|
|
28
|
+
const versionInfo = addPageAction.mock.calls[0][1];
|
|
29
|
+
expect(versionInfo.fullVersion).toBe(packageInfo.version);
|
|
30
|
+
expect(packageInfo.version.startsWith(versionInfo.majorVersion)).toBe(true);
|
|
31
|
+
expect(packageInfo.version.startsWith(versionInfo.minorVersion)).toBe(true);
|
|
32
|
+
});
|
|
33
|
+
test('Logs the tag name when a component is tracked', () => {
|
|
34
|
+
trackComponent(component);
|
|
35
|
+
jest.runOnlyPendingTimers();
|
|
36
|
+
expect(addPageAction).toHaveBeenCalledWith('spark-component', {
|
|
37
|
+
component: 'gux-button',
|
|
38
|
+
version: packageInfo.version,
|
|
39
|
+
queueDepth: 0
|
|
40
|
+
});
|
|
41
|
+
});
|
|
42
|
+
test('Optionally logs a tag variant', () => {
|
|
43
|
+
trackComponent(component, { variant: 'test' });
|
|
44
|
+
jest.runOnlyPendingTimers();
|
|
45
|
+
expect(addPageAction).toHaveBeenCalledWith('spark-component', {
|
|
46
|
+
component: 'gux-button',
|
|
47
|
+
version: packageInfo.version,
|
|
48
|
+
variant: 'test',
|
|
49
|
+
queueDepth: 0
|
|
50
|
+
});
|
|
51
|
+
});
|
|
41
52
|
});
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
53
|
+
describe('Component action tracking', () => {
|
|
54
|
+
test("Doesn't throw when newrelic is not present", () => {
|
|
55
|
+
window.newrelic = undefined;
|
|
56
|
+
expect(() => {
|
|
57
|
+
trackAction(component, 'click');
|
|
58
|
+
}).not.toThrow();
|
|
59
|
+
});
|
|
60
|
+
test('Logs the component tag and action', () => {
|
|
61
|
+
trackAction(component, 'click');
|
|
62
|
+
jest.runOnlyPendingTimers();
|
|
63
|
+
expect(addPageAction).toHaveBeenCalledWith('spark-action', {
|
|
64
|
+
component: 'gux-button',
|
|
65
|
+
action: 'click',
|
|
66
|
+
queueDepth: 0
|
|
67
|
+
});
|
|
68
|
+
});
|
|
69
|
+
test('Optionally logs metadata', () => {
|
|
70
|
+
trackAction(component, 'click', { strength: 'real hard' });
|
|
71
|
+
jest.runOnlyPendingTimers();
|
|
72
|
+
expect(addPageAction).toHaveBeenCalledWith('spark-action', {
|
|
73
|
+
component: 'gux-button',
|
|
74
|
+
action: 'click',
|
|
75
|
+
strength: 'real hard',
|
|
76
|
+
queueDepth: 0
|
|
77
|
+
});
|
|
78
|
+
});
|
|
51
79
|
});
|
|
52
|
-
});
|
|
53
|
-
describe('Component action tracking', () => {
|
|
54
|
-
test("Doesn't throw when newrelic is not present", () => {
|
|
55
|
-
window.newrelic = undefined;
|
|
56
|
-
expect(() => {
|
|
57
|
-
trackAction(component, 'click');
|
|
58
|
-
}).not.toThrow();
|
|
59
|
-
});
|
|
60
|
-
test('Logs the component tag and action', () => {
|
|
61
|
-
trackAction(component, 'click');
|
|
62
|
-
jest.runOnlyPendingTimers();
|
|
63
|
-
expect(addPageAction).toHaveBeenCalledWith('spark-action', {
|
|
64
|
-
component: 'gux-button',
|
|
65
|
-
action: 'click',
|
|
66
|
-
queueDepth: 0
|
|
67
|
-
});
|
|
68
|
-
});
|
|
69
|
-
test('Optionally logs metadata', () => {
|
|
70
|
-
trackAction(component, 'click', { strength: 'real hard' });
|
|
71
|
-
jest.runOnlyPendingTimers();
|
|
72
|
-
expect(addPageAction).toHaveBeenCalledWith('spark-action', {
|
|
73
|
-
component: 'gux-button',
|
|
74
|
-
action: 'click',
|
|
75
|
-
strength: 'real hard',
|
|
76
|
-
queueDepth: 0
|
|
77
|
-
});
|
|
78
|
-
});
|
|
79
|
-
});
|
|
80
80
|
});
|
|
81
81
|
describe('getVersionObject', () => {
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
82
|
+
[
|
|
83
|
+
{
|
|
84
|
+
packageLockVersion: '0.0.1',
|
|
85
|
+
expectedVersionObject: {
|
|
86
|
+
fullVersion: '0.0.1',
|
|
87
|
+
majorVersion: '0',
|
|
88
|
+
minorVersion: '0.0'
|
|
89
|
+
}
|
|
90
|
+
},
|
|
91
|
+
{
|
|
92
|
+
packageLockVersion: '0.1.1',
|
|
93
|
+
expectedVersionObject: {
|
|
94
|
+
fullVersion: '0.1.1',
|
|
95
|
+
majorVersion: '0',
|
|
96
|
+
minorVersion: '0.1'
|
|
97
|
+
}
|
|
98
|
+
},
|
|
99
|
+
{
|
|
100
|
+
packageLockVersion: '1.1.1',
|
|
101
|
+
expectedVersionObject: {
|
|
102
|
+
fullVersion: '1.1.1',
|
|
103
|
+
majorVersion: '1',
|
|
104
|
+
minorVersion: '1.1'
|
|
105
|
+
}
|
|
106
|
+
},
|
|
107
|
+
{
|
|
108
|
+
packageLockVersion: '2.0.0-alpha.0',
|
|
109
|
+
expectedVersionObject: {
|
|
110
|
+
fullVersion: '2.0.0-alpha.0',
|
|
111
|
+
majorVersion: '2',
|
|
112
|
+
minorVersion: '2.0'
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
].forEach(({ packageLockVersion, expectedVersionObject }, index) => {
|
|
116
|
+
it(`should return expected versionObject (${index + 1})`, async () => {
|
|
117
|
+
const versionEvent = getVersionEvent(packageLockVersion);
|
|
118
|
+
expect(versionEvent.metadata).toEqual(expectedVersionObject);
|
|
119
|
+
});
|
|
119
120
|
});
|
|
120
|
-
});
|
|
121
121
|
});
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import { p as promiseResolve, b as bootstrapLazy } from './index-
|
|
2
|
-
export { s as setNonce } from './index-
|
|
1
|
+
import { p as promiseResolve, b as bootstrapLazy } from './index-82fd7406.js';
|
|
2
|
+
export { s as setNonce } from './index-82fd7406.js';
|
|
3
|
+
import { g as globalScripts } from './app-globals-0f993ce5.js';
|
|
3
4
|
|
|
4
5
|
/*
|
|
5
|
-
Stencil Client Patch Browser v4.
|
|
6
|
+
Stencil Client Patch Browser v4.12.6 | MIT Licensed | https://stenciljs.com
|
|
6
7
|
*/
|
|
7
8
|
const patchBrowser = () => {
|
|
8
9
|
const importMeta = import.meta.url;
|
|
@@ -13,6 +14,7 @@ const patchBrowser = () => {
|
|
|
13
14
|
return promiseResolve(opts);
|
|
14
15
|
};
|
|
15
16
|
|
|
16
|
-
patchBrowser().then(options => {
|
|
17
|
+
patchBrowser().then(async (options) => {
|
|
18
|
+
await globalScripts();
|
|
17
19
|
return bootstrapLazy([["gux-visualization-beta",[[1,"gux-visualization-beta",{"visualizationSpec":[16],"embedOptions":[16]}]]],["gux-chart-column-beta",[[1,"gux-chart-column-beta",{"chartData":[16],"xTickLabelSlant":[4,"x-tick-label-slant"],"includeLegend":[4,"include-legend"],"xFieldName":[1,"x-field-name"],"yFieldName":[1,"y-field-name"],"xAxisTitle":[1,"x-axis-title"],"yAxisTitle":[1,"y-axis-title"],"legendTitle":[1,"legend-title"],"legendPosition":[1,"legend-position"],"chartLayers":[16],"embedOptions":[16]},null,{"chartData":["parseData"]}]]],["gux-chart-donut-beta",[[1,"gux-chart-donut-beta",{"chartData":[16],"includeLegend":[4,"include-legend"],"legendPosition":[1,"legend-position"],"legendTitle":[1,"legend-title"],"colorFieldName":[1,"color-field-name"],"outerRadius":[2,"outer-radius"],"innerRadius":[2,"inner-radius"],"labelRadius":[2,"label-radius"],"labelField":[1,"label-field"],"gauge":[4],"centerText":[1,"center-text"],"centerSubText":[1,"center-sub-text"],"showTooltip":[4,"show-tooltip"],"tooltipOptions":[16],"legendX":[2,"legend-x"],"legendY":[2,"legend-y"],"legendFontSize":[2,"legend-font-size"],"legendSymbolSize":[2,"legend-symbol-size"],"embedOptions":[16]},null,{"chartData":["parseData"]}]]],["gux-chart-line-beta",[[1,"gux-chart-line-beta",{"chartData":[16],"xTickLabelSlant":[4,"x-tick-label-slant"],"includeLegend":[4,"include-legend"],"legendPosition":[1,"legend-position"],"includeDataPointMarkers":[4,"include-data-point-markers"],"xFieldName":[1,"x-field-name"],"xAxisTitle":[1,"x-axis-title"],"yFieldName":[1,"y-field-name"],"yAxisTitle":[1,"y-axis-title"],"legendTitle":[1,"legend-title"],"colorFieldName":[1,"color-field-name"],"strokeDash":[4,"stroke-dash"],"interpolation":[1],"embedOptions":[16]},null,{"chartData":["parseData"]}]]],["gux-chart-pie-beta",[[1,"gux-chart-pie-beta",{"chartData":[16],"includeLegend":[4,"include-legend"],"legendPosition":[1,"legend-position"],"legendTitle":[1,"legend-title"],"colorFieldName":[1,"color-field-name"],"outerRadius":[2,"outer-radius"],"labelRadius":[2,"label-radius"],"labelField":[1,"label-field"],"embedOptions":[16]},null,{"chartData":["parseData"]}]]],["gux-chart-scatter-plot-beta",[[1,"gux-chart-scatter-plot-beta",{"chartData":[16],"xTickLabelSlant":[4,"x-tick-label-slant"],"includeLegend":[4,"include-legend"],"legendPosition":[1,"legend-position"],"xFieldName":[1,"x-field-name"],"xAxisTitle":[1,"x-axis-title"],"yFieldName":[1,"y-field-name"],"yAxisTitle":[1,"y-axis-title"],"legendTitle":[1,"legend-title"],"colorFieldName":[1,"color-field-name"],"useShape":[1,"use-shape"],"embedOptions":[16]},null,{"chartData":["parseData"]}]]]], options);
|
|
18
20
|
});
|