@telefonica/mistica 11.8.0 → 11.10.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/avatar.d.ts +14 -0
- package/dist/avatar.js +239 -0
- package/dist/avatar.js.flow +16 -0
- package/dist/badge.d.ts +2 -0
- package/dist/badge.js +24 -7
- package/dist/badge.js.flow +2 -0
- package/dist/button.js +2 -2
- package/dist/index.d.ts +4 -2
- package/dist/index.js +27 -13
- package/dist/index.js.flow +4 -2
- package/dist/package-version.js +1 -1
- package/dist/placeholder.d.ts +0 -4
- package/dist/placeholder.js +1 -13
- package/dist/placeholder.js.flow +0 -4
- package/dist/text-link.js +2 -3
- package/dist/text.js +14 -2
- package/dist/theme-context-provider.js +11 -7
- package/dist/theme.d.ts +3 -2
- package/dist/theme.js.flow +3 -2
- package/dist/utils/__tests__/analytics-test.js +74 -0
- package/dist/utils/analytics.d.ts +11 -0
- package/dist/utils/analytics.js +46 -1
- package/dist/utils/analytics.js.flow +11 -0
- package/dist-es/avatar.js +208 -0
- package/dist-es/badge.js +24 -7
- package/dist-es/button.js +3 -3
- package/dist-es/index.js +3 -1
- package/dist-es/package-version.js +1 -1
- package/dist-es/placeholder.js +0 -11
- package/dist-es/text-link.js +3 -4
- package/dist-es/text.js +14 -2
- package/dist-es/theme-context-provider.js +11 -7
- package/dist-es/utils/__tests__/analytics-test.js +47 -0
- package/dist-es/utils/analytics.js +22 -0
- package/package.json +3 -3
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
import ThemeContextProvider from "../../theme-context-provider";
|
|
4
|
+
import { render, screen } from "@testing-library/react";
|
|
5
|
+
import { makeTheme } from "../../__tests__/test-utils";
|
|
6
|
+
import { TrackingConfig, useTrackingConfig } from "../analytics";
|
|
7
|
+
var PrintEventFormat = function(param) {
|
|
8
|
+
var prefix = param.prefix;
|
|
9
|
+
var eventFormat = useTrackingConfig().eventFormat;
|
|
10
|
+
return /*#__PURE__*/ _jsx("div", {
|
|
11
|
+
children: "".concat(prefix, ": ").concat(eventFormat)
|
|
12
|
+
});
|
|
13
|
+
};
|
|
14
|
+
test("TrackingConfig context providers", function() {
|
|
15
|
+
render(/*#__PURE__*/ _jsxs(ThemeContextProvider, {
|
|
16
|
+
theme: makeTheme({
|
|
17
|
+
analytics: {
|
|
18
|
+
logEvent: function() {
|
|
19
|
+
return Promise.resolve();
|
|
20
|
+
},
|
|
21
|
+
eventFormat: "google-analytics-4"
|
|
22
|
+
}
|
|
23
|
+
}),
|
|
24
|
+
children: [
|
|
25
|
+
/*#__PURE__*/ _jsx(PrintEventFormat, {
|
|
26
|
+
prefix: "test1"
|
|
27
|
+
}),
|
|
28
|
+
/*#__PURE__*/ _jsxs(TrackingConfig, {
|
|
29
|
+
eventFormat: "universal-analytics",
|
|
30
|
+
children: [
|
|
31
|
+
/*#__PURE__*/ _jsx(PrintEventFormat, {
|
|
32
|
+
prefix: "test2"
|
|
33
|
+
}),
|
|
34
|
+
/*#__PURE__*/ _jsx(TrackingConfig, {
|
|
35
|
+
eventFormat: "google-analytics-4",
|
|
36
|
+
children: /*#__PURE__*/ _jsx(PrintEventFormat, {
|
|
37
|
+
prefix: "test3"
|
|
38
|
+
})
|
|
39
|
+
})
|
|
40
|
+
]
|
|
41
|
+
})
|
|
42
|
+
]
|
|
43
|
+
}));
|
|
44
|
+
expect(screen.getByText("test1: google-analytics-4")).toBeInTheDocument();
|
|
45
|
+
expect(screen.getByText("test2: universal-analytics")).toBeInTheDocument();
|
|
46
|
+
expect(screen.getByText("test3: google-analytics-4")).toBeInTheDocument();
|
|
47
|
+
});
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import * as React from "react";
|
|
1
3
|
// Universal Analytics (legacy)
|
|
2
4
|
export var eventCategories = {
|
|
3
5
|
userInteraction: "user_interaction"
|
|
@@ -9,3 +11,23 @@ export var eventActions = {
|
|
|
9
11
|
export var eventNames = {
|
|
10
12
|
userInteraction: "user_interaction"
|
|
11
13
|
};
|
|
14
|
+
var TrackingContext = /*#__PURE__*/ React.createContext({
|
|
15
|
+
eventFormat: "universal-analytics"
|
|
16
|
+
});
|
|
17
|
+
export var TrackingConfig = function(param) {
|
|
18
|
+
var children = param.children, eventFormat = param.eventFormat;
|
|
19
|
+
var value = React.useMemo(function() {
|
|
20
|
+
return {
|
|
21
|
+
eventFormat: eventFormat
|
|
22
|
+
};
|
|
23
|
+
}, [
|
|
24
|
+
eventFormat
|
|
25
|
+
]);
|
|
26
|
+
return /*#__PURE__*/ _jsx(TrackingContext.Provider, {
|
|
27
|
+
value: value,
|
|
28
|
+
children: children
|
|
29
|
+
});
|
|
30
|
+
};
|
|
31
|
+
export var useTrackingConfig = function() {
|
|
32
|
+
return React.useContext(TrackingContext);
|
|
33
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@telefonica/mistica",
|
|
3
|
-
"version": "11.
|
|
3
|
+
"version": "11.10.1",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -107,7 +107,7 @@
|
|
|
107
107
|
"jimp": "^0.16.1",
|
|
108
108
|
"lint-staged": "^12.3.7",
|
|
109
109
|
"node-fetch": "^2.6.7",
|
|
110
|
-
"playroom": "^0.
|
|
110
|
+
"playroom": "^0.28.0",
|
|
111
111
|
"prettier": "^2.6.1",
|
|
112
112
|
"pretty-bytes": "^5.6.0",
|
|
113
113
|
"prop-types": "^15.8.1",
|
|
@@ -123,7 +123,7 @@
|
|
|
123
123
|
},
|
|
124
124
|
"dependencies": {
|
|
125
125
|
"@juggle/resize-observer": "^3.3.1",
|
|
126
|
-
"@tef-novum/webview-bridge": "^3.
|
|
126
|
+
"@tef-novum/webview-bridge": "^3.7.0",
|
|
127
127
|
"@telefonica/libphonenumber": "^2.8.1",
|
|
128
128
|
"classnames": "^2.3.1",
|
|
129
129
|
"jss": "^10.9.0",
|