@telefonica/mistica 11.9.0 → 11.10.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/button.js CHANGED
@@ -306,7 +306,7 @@ var useDangerButtonStyles = (0, _jss).createUseStyles(function(theme) {
306
306
  });
307
307
  });
308
308
  var Button = function Button(props) {
309
- var analytics = (0, _hooks).useTheme().analytics;
309
+ var eventFormat = (0, _analytics).useTrackingConfig().eventFormat;
310
310
  var ref = (0, _formContext).useForm(), formStatus = ref.formStatus, formId = ref.formId;
311
311
  var isInverse = (0, _themeVariantContext).useIsInverseVariant();
312
312
  var classes = props.classes, loadingText = props.loadingText;
@@ -346,7 +346,7 @@ var Button = function Button(props) {
346
346
  });
347
347
  };
348
348
  var createDefaultTrackingEvent = function createDefaultTrackingEvent() {
349
- if (analytics.eventFormat === "google-analytics-4") {
349
+ if (eventFormat === "google-analytics-4") {
350
350
  return {
351
351
  name: _analytics.eventNames.userInteraction,
352
352
  component_type: "".concat(props.type, "_button"),
package/dist/index.d.ts CHANGED
@@ -89,7 +89,8 @@ export { default as IconSuccess } from './icons/icon-success';
89
89
  export { default as IconSuccessVivo } from './icons/icon-success-vivo';
90
90
  export { default as Circle } from './circle';
91
91
  export { useTheme, useScreenSize, useElementDimensions, useAriaId, useWindowSize, useWindowHeight, useWindowWidth, useIsInViewport, } from './hooks';
92
- export type { ThemeConfig, ColorScheme } from './theme';
92
+ export type { ThemeConfig, ColorScheme, EventFormat } from './theme';
93
+ export { TrackingConfig, useTrackingConfig } from './utils/analytics';
93
94
  export { useDocumentVisibility } from './utils/document-visibility';
94
95
  export { ThemeVariant, useIsInverseVariant } from './theme-variant-context';
95
96
  export type { Skin, KnownSkinName, SkinName } from './skins/types';
package/dist/index.js CHANGED
@@ -818,6 +818,18 @@ Object.defineProperty(exports, "useIsInViewport", {
818
818
  return _hooks.useIsInViewport;
819
819
  }
820
820
  });
821
+ Object.defineProperty(exports, "TrackingConfig", {
822
+ enumerable: true,
823
+ get: function() {
824
+ return _analytics.TrackingConfig;
825
+ }
826
+ });
827
+ Object.defineProperty(exports, "useTrackingConfig", {
828
+ enumerable: true,
829
+ get: function() {
830
+ return _analytics.useTrackingConfig;
831
+ }
832
+ });
821
833
  Object.defineProperty(exports, "useDocumentVisibility", {
822
834
  enumerable: true,
823
835
  get: function() {
@@ -10832,6 +10844,7 @@ var _iconSuccess = _interopRequireDefault(require("./icons/icon-success"));
10832
10844
  var _iconSuccessVivo = _interopRequireDefault(require("./icons/icon-success-vivo"));
10833
10845
  var _circle = _interopRequireDefault(require("./circle"));
10834
10846
  var _hooks = require("./hooks");
10847
+ var _analytics = require("./utils/analytics");
10835
10848
  var _documentVisibility = require("./utils/document-visibility");
10836
10849
  var _themeVariantContext = require("./theme-variant-context");
10837
10850
  var _constants = require("./skins/constants");
@@ -146,7 +146,8 @@ declare export {
146
146
  useWindowWidth,
147
147
  useIsInViewport,
148
148
  } from "./hooks";
149
- export type { ThemeConfig, ColorScheme } from "./theme";
149
+ export type { ThemeConfig, ColorScheme, EventFormat } from "./theme";
150
+ declare export { TrackingConfig, useTrackingConfig } from "./utils/analytics";
150
151
  declare export { useDocumentVisibility } from "./utils/document-visibility";
151
152
  declare export {
152
153
  ThemeVariant,
@@ -3,5 +3,5 @@ Object.defineProperty(exports, "__esModule", {
3
3
  value: true
4
4
  });
5
5
  exports.PACKAGE_VERSION = void 0;
6
- var PACKAGE_VERSION = "11.9.0";
6
+ var PACKAGE_VERSION = "11.10.2";
7
7
  exports.PACKAGE_VERSION = PACKAGE_VERSION;
package/dist/select.js CHANGED
@@ -232,7 +232,7 @@ var useStyles = (0, _jss).createUseStyles(function(theme) {
232
232
  },
233
233
  menuItem: (_obj1 = {
234
234
  color: theme.colors.textPrimary,
235
- padding: "6px 16px",
235
+ padding: "8px 16px",
236
236
  height: 48,
237
237
  transition: "background-color 150ms cubic-bezier(0.4, 0, 0.2, 1) 0ms"
238
238
  }, _defineProperty(_obj1, theme.mq.supportsHover, {
package/dist/text-link.js CHANGED
@@ -12,7 +12,6 @@ var _themeVariantContext = require("./theme-variant-context");
12
12
  var _formContext = require("./form-context");
13
13
  var _common = require("./utils/common");
14
14
  var _analytics = require("./utils/analytics");
15
- var _hooks = require("./hooks");
16
15
  function _interopRequireDefault(obj) {
17
16
  return obj && obj.__esModule ? obj : {
18
17
  default: obj
@@ -129,9 +128,9 @@ var TextLink = function TextLink(_param) {
129
128
  var classes = useStyles();
130
129
  var isInverse = (0, _themeVariantContext).useIsInverseVariant();
131
130
  var formStatus = (0, _formContext).useForm().formStatus;
132
- var analytics = (0, _hooks).useTheme().analytics;
131
+ var eventFormat = (0, _analytics).useTrackingConfig().eventFormat;
133
132
  var createDefaultTrackingEvent = function createDefaultTrackingEvent() {
134
- if (analytics.eventFormat === "google-analytics-4") {
133
+ if (eventFormat === "google-analytics-4") {
135
134
  return {
136
135
  name: _analytics.eventNames.userInteraction,
137
136
  component_type: "link",
package/dist/text.js CHANGED
@@ -117,6 +117,12 @@ var useStyles = (0, _jss).createUseStyles(function(theme) {
117
117
  var wordBreak = param.wordBreak;
118
118
  return wordBreak ? "anywhere" : "inherit";
119
119
  },
120
+ "@supports not (overflow-wrap: anywhere)": {
121
+ wordBreak: function wordBreak(param) {
122
+ var wordBreak1 = param.wordBreak;
123
+ return wordBreak1 ? "break-all" : "inherit";
124
+ }
125
+ },
120
126
  // Needed to reset the default browser margin that adds to p, h1, h2... elements.
121
127
  margin: 0
122
128
  }, theme.mq.tabletOrSmaller, {
@@ -133,8 +139,8 @@ var useStyles = (0, _jss).createUseStyles(function(theme) {
133
139
  "-webkit-line-clamp": lineClamp,
134
140
  lineClamp: lineClamp,
135
141
  wordBreak: function wordBreak(param) {
136
- var wordBreak1 = param.wordBreak;
137
- return wordBreak1 ? "break-all" : "normal";
142
+ var wordBreak2 = param.wordBreak;
143
+ return wordBreak2 ? "break-all" : "normal";
138
144
  },
139
145
  "@supports (overflow-wrap: anywhere)": {
140
146
  wordBreak: function wordBreak(param) {
@@ -22,6 +22,7 @@ var _tabFocus = _interopRequireDefault(require("./tab-focus"));
22
22
  var _modalContextProvider = _interopRequireDefault(require("./modal-context-provider"));
23
23
  var _documentVisibility = require("./utils/document-visibility");
24
24
  var _aspectRatioSupport = require("./utils/aspect-ratio-support");
25
+ var _analytics = require("./utils/analytics");
25
26
  function _interopRequireDefault(obj) {
26
27
  return obj && obj.__esModule ? obj : {
27
28
  default: obj
@@ -230,13 +231,16 @@ var ThemeContextProvider = function ThemeContextProvider(param) {
230
231
  children: /*#__PURE__*/ (0, _jsxRuntime).jsx(_modalContextProvider.default, {
231
232
  children: /*#__PURE__*/ (0, _jsxRuntime).jsx(_themeContext.default.Provider, {
232
233
  value: contextTheme,
233
- children: /*#__PURE__*/ (0, _jsxRuntime).jsx(_aspectRatioSupport.AspectRatioSupportProvider, {
234
- children: /*#__PURE__*/ (0, _jsxRuntime).jsx(_documentVisibility.DocumentVisibilityProvider, {
235
- children: /*#__PURE__*/ (0, _jsxRuntime).jsx(_ariaIdGetterContext.default.Provider, {
236
- value: getAriaId,
237
- children: /*#__PURE__*/ (0, _jsxRuntime).jsx(_screenSizeContextProvider.default, {
238
- children: /*#__PURE__*/ (0, _jsxRuntime).jsx(_dialog.default, {
239
- children: children
234
+ children: /*#__PURE__*/ (0, _jsxRuntime).jsx(_analytics.TrackingConfig, {
235
+ eventFormat: contextTheme.analytics.eventFormat,
236
+ children: /*#__PURE__*/ (0, _jsxRuntime).jsx(_aspectRatioSupport.AspectRatioSupportProvider, {
237
+ children: /*#__PURE__*/ (0, _jsxRuntime).jsx(_documentVisibility.DocumentVisibilityProvider, {
238
+ children: /*#__PURE__*/ (0, _jsxRuntime).jsx(_ariaIdGetterContext.default.Provider, {
239
+ value: getAriaId,
240
+ children: /*#__PURE__*/ (0, _jsxRuntime).jsx(_screenSizeContextProvider.default, {
241
+ children: /*#__PURE__*/ (0, _jsxRuntime).jsx(_dialog.default, {
242
+ children: children
243
+ })
240
244
  })
241
245
  })
242
246
  })
package/dist/theme.d.ts CHANGED
@@ -74,6 +74,7 @@ declare type LinkComponent = React.ComponentType<{
74
74
  }>;
75
75
  export declare const AnchorLink: LinkComponent;
76
76
  export declare type ColorScheme = 'dark' | 'light' | 'auto';
77
+ export declare type EventFormat = 'universal-analytics' | 'google-analytics-4';
77
78
  export declare type ThemeConfig = {
78
79
  skin: Readonly<Skin>;
79
80
  colorScheme?: ColorScheme;
@@ -89,7 +90,7 @@ export declare type ThemeConfig = {
89
90
  texts?: Partial<ThemeTexts>;
90
91
  analytics?: {
91
92
  logEvent: (trackingEvent: TrackingEvent) => Promise<void>;
92
- eventFormat?: 'universal-analytics' | 'google-analytics-4';
93
+ eventFormat?: EventFormat;
93
94
  };
94
95
  dimensions?: {
95
96
  headerMobileHeight: number;
@@ -118,7 +119,7 @@ export declare type Theme = {
118
119
  texts: ThemeTexts;
119
120
  analytics: {
120
121
  logEvent: (trackingEvent: TrackingEvent) => Promise<void>;
121
- eventFormat: 'universal-analytics' | 'google-analytics-4';
122
+ eventFormat: EventFormat;
122
123
  };
123
124
  dimensions: {
124
125
  headerMobileHeight: number;
@@ -78,6 +78,7 @@ declare type LinkComponent = React.ComponentType<{
78
78
  }>;
79
79
  declare export var AnchorLink: LinkComponent;
80
80
  export type ColorScheme = "dark" | "light" | "auto";
81
+ export type EventFormat = "universal-analytics" | "google-analytics-4";
81
82
  export type ThemeConfig = {
82
83
  skin: $ReadOnly<Skin>,
83
84
  colorScheme?: ColorScheme,
@@ -93,7 +94,7 @@ export type ThemeConfig = {
93
94
  texts?: $Shape<ThemeTexts>,
94
95
  analytics?: {
95
96
  logEvent: (trackingEvent: TrackingEvent) => Promise<void>,
96
- eventFormat?: "universal-analytics" | "google-analytics-4",
97
+ eventFormat?: EventFormat,
97
98
  },
98
99
  dimensions?: {
99
100
  headerMobileHeight: number,
@@ -122,7 +123,7 @@ export type Theme = {
122
123
  texts: ThemeTexts,
123
124
  analytics: {
124
125
  logEvent: (trackingEvent: TrackingEvent) => Promise<void>,
125
- eventFormat: "universal-analytics" | "google-analytics-4",
126
+ eventFormat: EventFormat,
126
127
  },
127
128
  dimensions: {
128
129
  headerMobileHeight: number,
@@ -0,0 +1,74 @@
1
+ "use strict";
2
+ var _jsxRuntime = require("react/jsx-runtime");
3
+ var React = _interopRequireWildcard(require("react"));
4
+ var _themeContextProvider = _interopRequireDefault(require("../../theme-context-provider"));
5
+ var _react = require("@testing-library/react");
6
+ var _testUtils = require("../../__tests__/test-utils");
7
+ var _analytics = require("../analytics");
8
+ function _interopRequireDefault(obj) {
9
+ return obj && obj.__esModule ? obj : {
10
+ default: obj
11
+ };
12
+ }
13
+ function _interopRequireWildcard(obj) {
14
+ if (obj && obj.__esModule) {
15
+ return obj;
16
+ } else {
17
+ var newObj = {};
18
+ if (obj != null) {
19
+ for(var key in obj){
20
+ if (Object.prototype.hasOwnProperty.call(obj, key)) {
21
+ var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {};
22
+ if (desc.get || desc.set) {
23
+ Object.defineProperty(newObj, key, desc);
24
+ } else {
25
+ newObj[key] = obj[key];
26
+ }
27
+ }
28
+ }
29
+ }
30
+ newObj.default = obj;
31
+ return newObj;
32
+ }
33
+ }
34
+ var PrintEventFormat = function PrintEventFormat(param) {
35
+ var prefix = param.prefix;
36
+ var eventFormat = (0, _analytics).useTrackingConfig().eventFormat;
37
+ return /*#__PURE__*/ (0, _jsxRuntime).jsx("div", {
38
+ children: "".concat(prefix, ": ").concat(eventFormat)
39
+ });
40
+ };
41
+ test("TrackingConfig context providers", function() {
42
+ (0, _react).render(/*#__PURE__*/ (0, _jsxRuntime).jsxs(_themeContextProvider.default, {
43
+ theme: (0, _testUtils).makeTheme({
44
+ analytics: {
45
+ logEvent: function logEvent() {
46
+ return Promise.resolve();
47
+ },
48
+ eventFormat: "google-analytics-4"
49
+ }
50
+ }),
51
+ children: [
52
+ /*#__PURE__*/ (0, _jsxRuntime).jsx(PrintEventFormat, {
53
+ prefix: "test1"
54
+ }),
55
+ /*#__PURE__*/ (0, _jsxRuntime).jsxs(_analytics.TrackingConfig, {
56
+ eventFormat: "universal-analytics",
57
+ children: [
58
+ /*#__PURE__*/ (0, _jsxRuntime).jsx(PrintEventFormat, {
59
+ prefix: "test2"
60
+ }),
61
+ /*#__PURE__*/ (0, _jsxRuntime).jsx(_analytics.TrackingConfig, {
62
+ eventFormat: "google-analytics-4",
63
+ children: /*#__PURE__*/ (0, _jsxRuntime).jsx(PrintEventFormat, {
64
+ prefix: "test3"
65
+ })
66
+ })
67
+ ]
68
+ })
69
+ ]
70
+ }));
71
+ expect(_react.screen.getByText("test1: google-analytics-4")).toBeInTheDocument();
72
+ expect(_react.screen.getByText("test2: universal-analytics")).toBeInTheDocument();
73
+ expect(_react.screen.getByText("test3: google-analytics-4")).toBeInTheDocument();
74
+ });
@@ -1,3 +1,5 @@
1
+ import * as React from 'react';
2
+ import type { EventFormat } from '../theme';
1
3
  export declare const eventCategories: {
2
4
  readonly userInteraction: "user_interaction";
3
5
  };
@@ -7,3 +9,12 @@ export declare const eventActions: {
7
9
  export declare const eventNames: {
8
10
  readonly userInteraction: "user_interaction";
9
11
  };
12
+ declare type TrackingConfigProps = {
13
+ children: React.ReactNode;
14
+ eventFormat: EventFormat;
15
+ };
16
+ export declare const TrackingConfig: ({ children, eventFormat }: TrackingConfigProps) => JSX.Element;
17
+ export declare const useTrackingConfig: () => {
18
+ eventFormat: EventFormat;
19
+ };
20
+ export {};
@@ -2,7 +2,30 @@
2
2
  Object.defineProperty(exports, "__esModule", {
3
3
  value: true
4
4
  });
5
- exports.eventNames = exports.eventActions = exports.eventCategories = void 0;
5
+ exports.useTrackingConfig = exports.TrackingConfig = exports.eventNames = exports.eventActions = exports.eventCategories = void 0;
6
+ var _jsxRuntime = require("react/jsx-runtime");
7
+ var React = _interopRequireWildcard(require("react"));
8
+ function _interopRequireWildcard(obj) {
9
+ if (obj && obj.__esModule) {
10
+ return obj;
11
+ } else {
12
+ var newObj = {};
13
+ if (obj != null) {
14
+ for(var key in obj){
15
+ if (Object.prototype.hasOwnProperty.call(obj, key)) {
16
+ var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {};
17
+ if (desc.get || desc.set) {
18
+ Object.defineProperty(newObj, key, desc);
19
+ } else {
20
+ newObj[key] = obj[key];
21
+ }
22
+ }
23
+ }
24
+ }
25
+ newObj.default = obj;
26
+ return newObj;
27
+ }
28
+ }
6
29
  var eventCategories = {
7
30
  userInteraction: "user_interaction"
8
31
  };
@@ -15,3 +38,25 @@ var eventNames = {
15
38
  userInteraction: "user_interaction"
16
39
  };
17
40
  exports.eventNames = eventNames;
41
+ var TrackingContext = /*#__PURE__*/ React.createContext({
42
+ eventFormat: "universal-analytics"
43
+ });
44
+ var TrackingConfig = function TrackingConfig(param) {
45
+ var children = param.children, eventFormat = param.eventFormat;
46
+ var value = React.useMemo(function() {
47
+ return {
48
+ eventFormat: eventFormat
49
+ };
50
+ }, [
51
+ eventFormat
52
+ ]);
53
+ return /*#__PURE__*/ (0, _jsxRuntime).jsx(TrackingContext.Provider, {
54
+ value: value,
55
+ children: children
56
+ });
57
+ };
58
+ exports.TrackingConfig = TrackingConfig;
59
+ var useTrackingConfig = function useTrackingConfig() {
60
+ return React.useContext(TrackingContext);
61
+ };
62
+ exports.useTrackingConfig = useTrackingConfig;
@@ -1,5 +1,7 @@
1
1
  // @flow
2
2
 
3
+ import * as React from "react";
4
+ import type { EventFormat } from "../theme";
3
5
  declare export var eventCategories: {
4
6
  +userInteraction: "user_interaction",
5
7
  };
@@ -9,3 +11,12 @@ declare export var eventActions: {
9
11
  declare export var eventNames: {
10
12
  +userInteraction: "user_interaction",
11
13
  };
14
+ declare type TrackingConfigProps = {
15
+ children: React.Node,
16
+ eventFormat: EventFormat,
17
+ };
18
+ declare export var TrackingConfig: (x: TrackingConfigProps) => React.Node;
19
+ declare export var useTrackingConfig: () => {
20
+ eventFormat: EventFormat,
21
+ };
22
+ declare export {};
package/dist-es/button.js CHANGED
@@ -84,7 +84,7 @@ import { pxToRem } from "./utils/css";
84
84
  import { Text, Text2, Text3 } from "./text";
85
85
  import Box from "./box";
86
86
  import { getTextFromChildren } from "./utils/common";
87
- import { eventActions, eventCategories, eventNames } from "./utils/analytics";
87
+ import { eventActions, eventCategories, eventNames, useTrackingConfig } from "./utils/analytics";
88
88
  import { useTheme } from "./hooks";
89
89
  export var BUTTON_MIN_WIDTH = 136;
90
90
  var transitionTiming = "0.3s cubic-bezier(0.77, 0, 0.175, 1)";
@@ -273,7 +273,7 @@ var useDangerButtonStyles = createUseStyles(function(theme) {
273
273
  });
274
274
  });
275
275
  var Button = function(props) {
276
- var analytics = useTheme().analytics;
276
+ var eventFormat = useTrackingConfig().eventFormat;
277
277
  var ref = useForm(), formStatus = ref.formStatus, formId = ref.formId;
278
278
  var isInverse = useIsInverseVariant();
279
279
  var classes = props.classes, loadingText = props.loadingText;
@@ -313,7 +313,7 @@ var Button = function(props) {
313
313
  });
314
314
  };
315
315
  var createDefaultTrackingEvent = function() {
316
- if (analytics.eventFormat === "google-analytics-4") {
316
+ if (eventFormat === "google-analytics-4") {
317
317
  return {
318
318
  name: eventNames.userInteraction,
319
319
  component_type: "".concat(props.type, "_button"),
package/dist-es/index.js CHANGED
@@ -90,6 +90,7 @@ export { default as IconSuccess } from "./icons/icon-success";
90
90
  export { default as IconSuccessVivo } from "./icons/icon-success-vivo";
91
91
  export { default as Circle } from "./circle";
92
92
  export { useTheme, useScreenSize, useElementDimensions, useAriaId, useWindowSize, useWindowHeight, useWindowWidth, useIsInViewport } from "./hooks";
93
+ export { TrackingConfig, useTrackingConfig } from "./utils/analytics";
93
94
  export { useDocumentVisibility } from "./utils/document-visibility";
94
95
  export { ThemeVariant, useIsInverseVariant } from "./theme-variant-context";
95
96
  export { VIVO_SKIN, O2_CLASSIC_SKIN, O2_SKIN, MOVISTAR_SKIN, TELEFONICA_SKIN, BLAU_SKIN } from "./skins/constants";
@@ -1,2 +1,2 @@
1
1
  // DO NOT EDIT THIS FILE. It's autogenerated by set-version.js
2
- export var PACKAGE_VERSION = "11.9.0";
2
+ export var PACKAGE_VERSION = "11.10.2";
package/dist-es/select.js CHANGED
@@ -200,7 +200,7 @@ var useStyles = createUseStyles(function(theme) {
200
200
  },
201
201
  menuItem: (_obj1 = {
202
202
  color: theme.colors.textPrimary,
203
- padding: "6px 16px",
203
+ padding: "8px 16px",
204
204
  height: 48,
205
205
  transition: "background-color 150ms cubic-bezier(0.4, 0, 0.2, 1) 0ms"
206
206
  }, _defineProperty(_obj1, theme.mq.supportsHover, {
@@ -61,8 +61,7 @@ import classnames from "classnames";
61
61
  import { useIsInverseVariant } from "./theme-variant-context";
62
62
  import { useForm } from "./form-context";
63
63
  import { getTextFromChildren } from "./utils/common";
64
- import { eventActions, eventCategories, eventNames } from "./utils/analytics";
65
- import { useTheme } from "./hooks";
64
+ import { eventActions, eventCategories, eventNames, useTrackingConfig } from "./utils/analytics";
66
65
  var useStyles = createUseStyles(function(theme) {
67
66
  var _obj;
68
67
  return {
@@ -97,9 +96,9 @@ var TextLink = function(_param) {
97
96
  var classes = useStyles();
98
97
  var isInverse = useIsInverseVariant();
99
98
  var formStatus = useForm().formStatus;
100
- var analytics = useTheme().analytics;
99
+ var eventFormat = useTrackingConfig().eventFormat;
101
100
  var createDefaultTrackingEvent = function() {
102
- if (analytics.eventFormat === "google-analytics-4") {
101
+ if (eventFormat === "google-analytics-4") {
103
102
  return {
104
103
  name: eventNames.userInteraction,
105
104
  component_type: "link",
package/dist-es/text.js CHANGED
@@ -85,6 +85,12 @@ var useStyles = createUseStyles(function(theme) {
85
85
  var wordBreak = param.wordBreak;
86
86
  return wordBreak ? "anywhere" : "inherit";
87
87
  },
88
+ "@supports not (overflow-wrap: anywhere)": {
89
+ wordBreak: function(param) {
90
+ var wordBreak = param.wordBreak;
91
+ return wordBreak ? "break-all" : "inherit";
92
+ }
93
+ },
88
94
  // Needed to reset the default browser margin that adds to p, h1, h2... elements.
89
95
  margin: 0
90
96
  }, theme.mq.tabletOrSmaller, {
@@ -91,6 +91,7 @@ import TabFocus from "./tab-focus";
91
91
  import ModalContextProvider from "./modal-context-provider";
92
92
  import { DocumentVisibilityProvider } from "./utils/document-visibility";
93
93
  import { AspectRatioSupportProvider } from "./utils/aspect-ratio-support";
94
+ import { TrackingConfig } from "./utils/analytics";
94
95
  var darkModeMedia = "(prefers-color-scheme: dark)";
95
96
  export var useIsOsDarkModeEnabled = function() {
96
97
  var ref = _slicedToArray(React.useState(false), 2), isDarkMode = ref[0], setIsDarkMode = ref[1];
@@ -197,13 +198,16 @@ var ThemeContextProvider = function(param) {
197
198
  children: /*#__PURE__*/ _jsx(ModalContextProvider, {
198
199
  children: /*#__PURE__*/ _jsx(ThemeContext.Provider, {
199
200
  value: contextTheme,
200
- children: /*#__PURE__*/ _jsx(AspectRatioSupportProvider, {
201
- children: /*#__PURE__*/ _jsx(DocumentVisibilityProvider, {
202
- children: /*#__PURE__*/ _jsx(AriaIdGetterContext.Provider, {
203
- value: getAriaId,
204
- children: /*#__PURE__*/ _jsx(ScreenSizeContextProvider, {
205
- children: /*#__PURE__*/ _jsx(DialogRoot, {
206
- children: children
201
+ children: /*#__PURE__*/ _jsx(TrackingConfig, {
202
+ eventFormat: contextTheme.analytics.eventFormat,
203
+ children: /*#__PURE__*/ _jsx(AspectRatioSupportProvider, {
204
+ children: /*#__PURE__*/ _jsx(DocumentVisibilityProvider, {
205
+ children: /*#__PURE__*/ _jsx(AriaIdGetterContext.Provider, {
206
+ value: getAriaId,
207
+ children: /*#__PURE__*/ _jsx(ScreenSizeContextProvider, {
208
+ children: /*#__PURE__*/ _jsx(DialogRoot, {
209
+ children: children
210
+ })
207
211
  })
208
212
  })
209
213
  })
@@ -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.9.0",
3
+ "version": "11.10.2",
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.27.9",
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.5.0",
126
+ "@tef-novum/webview-bridge": "^3.8.0",
127
127
  "@telefonica/libphonenumber": "^2.8.1",
128
128
  "classnames": "^2.3.1",
129
129
  "jss": "^10.9.0",