@telefonica/mistica 10.26.0 → 10.27.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.
Files changed (46) hide show
  1. package/CHANGELOG.md +15 -0
  2. package/dist/button.d.ts +2 -0
  3. package/dist/button.js +20 -5
  4. package/dist/button.js.flow +2 -0
  5. package/dist/image.d.ts +3 -0
  6. package/dist/image.js +35 -4
  7. package/dist/image.js.flow +3 -0
  8. package/dist/package-version.js +1 -1
  9. package/dist/skins/blau.js +0 -2
  10. package/dist/skins/o2-classic.js +0 -4
  11. package/dist/skins/o2.js +0 -4
  12. package/dist/skins/telefonica.js +1 -5
  13. package/dist/skins/vivo.js +0 -4
  14. package/dist/tag.d.ts +2 -1
  15. package/dist/tag.js +33 -3
  16. package/dist/tag.js.flow +2 -1
  17. package/dist/text-link.d.ts +1 -0
  18. package/dist/text-link.js +8 -0
  19. package/dist/text-link.js.flow +1 -0
  20. package/dist/text.d.ts +2 -0
  21. package/dist/text.js +4 -3
  22. package/dist/text.js.flow +2 -0
  23. package/dist/utils/analytics.d.ts +6 -0
  24. package/dist/utils/analytics.js +13 -0
  25. package/dist/utils/analytics.js.flow +8 -0
  26. package/dist/utils/common.d.ts +1 -0
  27. package/dist/utils/common.js +11 -1
  28. package/dist/utils/common.js.flow +1 -0
  29. package/dist/video.d.ts +2 -0
  30. package/dist/video.js +37 -5
  31. package/dist/video.js.flow +2 -0
  32. package/dist-es/button.js +20 -5
  33. package/dist-es/image.js +34 -4
  34. package/dist-es/package-version.js +1 -1
  35. package/dist-es/skins/blau.js +0 -2
  36. package/dist-es/skins/o2-classic.js +0 -4
  37. package/dist-es/skins/o2.js +0 -4
  38. package/dist-es/skins/telefonica.js +1 -5
  39. package/dist-es/skins/vivo.js +0 -4
  40. package/dist-es/tag.js +32 -3
  41. package/dist-es/text-link.js +8 -0
  42. package/dist-es/text.js +4 -3
  43. package/dist-es/utils/analytics.js +6 -0
  44. package/dist-es/utils/common.js +9 -0
  45. package/dist-es/video.js +36 -5
  46. package/package.json +1 -1
package/CHANGELOG.md CHANGED
@@ -1,3 +1,18 @@
1
+ # [10.27.0](https://github.com/Telefonica/mistica-web/compare/v10.26.0...v10.27.0) (2022-02-25)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * **playroom:** dark mode in Blau & Telefonica ios ([#423](https://github.com/Telefonica/mistica-web/issues/423)) ([a630625](https://github.com/Telefonica/mistica-web/commit/a630625379cdb486abd916ad05c0d3fd4974e5cd))
7
+ * **skins:** remove deprecated constants ([#418](https://github.com/Telefonica/mistica-web/issues/418)) ([822960f](https://github.com/Telefonica/mistica-web/commit/822960f2ecf629b4e5de0ac3224e2026332c0f14))
8
+ * **Telefonica skin:** change badge color ([#424](https://github.com/Telefonica/mistica-web/issues/424)) ([0976c24](https://github.com/Telefonica/mistica-web/commit/0976c246f295d4be61426d33ff93b65c9bae0598))
9
+
10
+
11
+ ### Features
12
+
13
+ * **Button:** default tracking events ([#425](https://github.com/Telefonica/mistica-web/issues/425)) ([5fc2576](https://github.com/Telefonica/mistica-web/commit/5fc25768f71cd8a0318b47266511694e6024e49e))
14
+ * **Image, Text, Video, Tag:** add dataAttributes prop ([#429](https://github.com/Telefonica/mistica-web/issues/429)) ([730a0db](https://github.com/Telefonica/mistica-web/commit/730a0dbb80abe9a47260b21e29fe1cbf2c9cc206))
15
+
1
16
  # [10.26.0](https://github.com/Telefonica/mistica-web/compare/v10.25.0...v10.26.0) (2022-02-23)
2
17
 
3
18
 
package/dist/button.d.ts CHANGED
@@ -11,6 +11,7 @@ interface CommonProps {
11
11
  loadingText?: string;
12
12
  disabled?: boolean;
13
13
  trackingEvent?: TrackingEvent | ReadonlyArray<TrackingEvent>;
14
+ trackEvent?: boolean;
14
15
  /** "data-" prefix is automatically added. For example, use "testid" instead of "data-testid" */
15
16
  dataAttributes?: DataAttributes;
16
17
  'aria-controls'?: string;
@@ -58,6 +59,7 @@ export declare type ButtonProps = FakeButtonProps | SubmitButtonProps | ToButton
58
59
  interface ButtonLinkCommonProps {
59
60
  children: React.ReactNode;
60
61
  trackingEvent?: TrackingEvent | ReadonlyArray<TrackingEvent>;
62
+ trackEvent?: boolean;
61
63
  /** "data-" prefix is automatically added. For example, use "testid" instead of "data-testid" */
62
64
  dataAttributes?: DataAttributes;
63
65
  aligned?: boolean;
package/dist/button.js CHANGED
@@ -14,6 +14,8 @@ var _formContext = require("./form-context");
14
14
  var _css = require("./utils/css");
15
15
  var _text = require("./text");
16
16
  var _box = _interopRequireDefault(require("./box"));
17
+ var _common = require("./utils/common");
18
+ var _analytics = require("./utils/analytics");
17
19
  function _interopRequireDefault(obj) {
18
20
  return obj && obj.__esModule ? obj : {
19
21
  default: obj
@@ -341,13 +343,18 @@ var Button = function Button(props) {
341
343
  children: text
342
344
  });
343
345
  };
346
+ var _trackingEvent;
344
347
  var _obj;
345
348
  var commonProps = {
346
349
  className: (0, _classnames).default(classes.button, props.className, (_obj = {}, _defineProperty(_obj, classes.small, props.small), _defineProperty(_obj, classes.inverse, isInverse), _defineProperty(_obj, classes.light, !isInverse), _defineProperty(_obj, classes.isLoading, showSpinner), _obj)),
347
350
  style: _objectSpread({
348
351
  cursor: props.fake ? 'pointer' : undefined
349
352
  }, props.style),
350
- trackingEvent: props.trackingEvent,
353
+ trackingEvent: (_trackingEvent = props.trackingEvent) !== null && _trackingEvent !== void 0 ? _trackingEvent : props.trackEvent ? {
354
+ category: _analytics.eventCategories.userInteraction,
355
+ action: "".concat(props.type, "_button_tapped"),
356
+ label: (0, _common).getTextFromChildren(props.children)
357
+ } : undefined,
351
358
  dataAttributes: props.dataAttributes,
352
359
  'aria-controls': props['aria-controls'],
353
360
  'aria-expanded': props['aria-expanded'],
@@ -486,10 +493,15 @@ var useButtonLinkStyles = (0, _jss).createUseStyles(function(theme) {
486
493
  var ButtonLink = /*#__PURE__*/ React.forwardRef(function(props, ref) {
487
494
  var classes = useButtonLinkStyles();
488
495
  var isInverse = (0, _themeVariantContext).useIsInverseVariant();
496
+ var _trackingEvent;
489
497
  var _obj;
490
498
  var commonProps = {
491
499
  className: (0, _classnames).default(classes.link, (_obj = {}, _defineProperty(_obj, classes.inverse, isInverse), _defineProperty(_obj, classes.aligned, props.aligned), _obj)),
492
- trackingEvent: props.trackingEvent,
500
+ trackingEvent: (_trackingEvent = props.trackingEvent) !== null && _trackingEvent !== void 0 ? _trackingEvent : props.trackEvent ? {
501
+ category: _analytics.eventCategories.userInteraction,
502
+ action: _analytics.eventActions.linkTapped,
503
+ label: (0, _common).getTextFromChildren(props.children)
504
+ } : undefined,
493
505
  dataAttributes: props.dataAttributes,
494
506
  children: /*#__PURE__*/ (0, _jsxRuntime).jsx(_text.Text2, {
495
507
  medium: true,
@@ -536,21 +548,24 @@ exports.ButtonLink = ButtonLink;
536
548
  var ButtonPrimary = function ButtonPrimary(props) {
537
549
  var classes = usePrimaryButtonStyles();
538
550
  return(/*#__PURE__*/ (0, _jsxRuntime).jsx(Button, _objectSpread({}, props, {
539
- classes: classes
551
+ classes: classes,
552
+ type: "primary"
540
553
  })));
541
554
  };
542
555
  exports.ButtonPrimary = ButtonPrimary;
543
556
  var ButtonSecondary = function ButtonSecondary(props) {
544
557
  var classes = useSecondaryButtonStyles();
545
558
  return(/*#__PURE__*/ (0, _jsxRuntime).jsx(Button, _objectSpread({}, props, {
546
- classes: classes
559
+ classes: classes,
560
+ type: "secondary"
547
561
  })));
548
562
  };
549
563
  exports.ButtonSecondary = ButtonSecondary;
550
564
  var ButtonDanger = function ButtonDanger(props) {
551
565
  var classes = useDangerButtonStyles();
552
566
  return(/*#__PURE__*/ (0, _jsxRuntime).jsx(Button, _objectSpread({}, props, {
553
- classes: classes
567
+ classes: classes,
568
+ type: "danger"
554
569
  })));
555
570
  };
556
571
  exports.ButtonDanger = ButtonDanger;
@@ -18,6 +18,7 @@ declare type CommonProps = {
18
18
  loadingText?: string,
19
19
  disabled?: boolean,
20
20
  trackingEvent?: TrackingEvent | $ReadOnlyArray<TrackingEvent>,
21
+ trackEvent?: boolean,
21
22
 
22
23
  /**
23
24
  * "data-" prefix is automatically added. For example, use "testid" instead of "data-testid"
@@ -58,6 +59,7 @@ export type ButtonProps =
58
59
  declare type ButtonLinkCommonProps = {
59
60
  children: React.Node,
60
61
  trackingEvent?: TrackingEvent | $ReadOnlyArray<TrackingEvent>,
62
+ trackEvent?: boolean,
61
63
 
62
64
  /**
63
65
  * "data-" prefix is automatically added. For example, use "testid" instead of "data-testid"
package/dist/image.d.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  import * as React from 'react';
2
+ import type { DataAttributes } from './utils/types';
2
3
  export declare const useDisableBorderRadius: () => boolean;
3
4
  export declare const DisableBorderRadiusProvider: React.FC;
4
5
  export declare type AspectRatio = '1:1' | '16:9' | '7:10' | '4:3';
@@ -19,6 +20,7 @@ export declare type ImageProps = {
19
20
  /** defaults to empty string */
20
21
  alt?: string;
21
22
  children?: void;
23
+ dataAttributes?: DataAttributes;
22
24
  };
23
25
  /** @deprecated */
24
26
  declare type DeprecatedImageProps = {
@@ -31,6 +33,7 @@ declare type DeprecatedImageProps = {
31
33
  /** defaults to empty string */
32
34
  alt?: string;
33
35
  children?: void;
36
+ dataAttributes?: DataAttributes;
34
37
  };
35
38
  declare const Image: React.ForwardRefExoticComponent<(ImageProps | DeprecatedImageProps) & React.RefAttributes<HTMLImageElement>>;
36
39
  export default Image;
package/dist/image.js CHANGED
@@ -6,6 +6,7 @@ exports.default = exports.RATIO = exports.DisableBorderRadiusProvider = exports.
6
6
  var _jsxRuntime = require("react/jsx-runtime");
7
7
  var React = _interopRequireWildcard(require("react"));
8
8
  var _jss = require("./jss");
9
+ var _dom = require("./utils/dom");
9
10
  function _interopRequireWildcard(obj) {
10
11
  if (obj && obj.__esModule) {
11
12
  return obj;
@@ -27,6 +28,35 @@ function _interopRequireWildcard(obj) {
27
28
  return newObj;
28
29
  }
29
30
  }
31
+ function _defineProperty(obj, key, value) {
32
+ if (key in obj) {
33
+ Object.defineProperty(obj, key, {
34
+ value: value,
35
+ enumerable: true,
36
+ configurable: true,
37
+ writable: true
38
+ });
39
+ } else {
40
+ obj[key] = value;
41
+ }
42
+ return obj;
43
+ }
44
+ function _objectSpread(target) {
45
+ var _arguments = arguments, _loop = function(i) {
46
+ var source = _arguments[i] != null ? _arguments[i] : {};
47
+ var ownKeys = Object.keys(source);
48
+ if (typeof Object.getOwnPropertySymbols === "function") {
49
+ ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
50
+ return Object.getOwnPropertyDescriptor(source, sym).enumerable;
51
+ }));
52
+ }
53
+ ownKeys.forEach(function(key) {
54
+ _defineProperty(target, key, source[key]);
55
+ });
56
+ };
57
+ for(var i = 1; i < arguments.length; i++)_loop(i);
58
+ return target;
59
+ }
30
60
  function _objectWithoutProperties(source, excluded) {
31
61
  if (source == null) return {};
32
62
  var target = _objectWithoutPropertiesLoose(source, excluded);
@@ -96,9 +126,10 @@ var RATIO = {
96
126
  };
97
127
  exports.RATIO = RATIO;
98
128
  var Image = /*#__PURE__*/ React.forwardRef(function(_param, ref) {
99
- var _aspectRatio = _param.aspectRatio, aspectRatio = _aspectRatio === void 0 ? '1:1' : _aspectRatio, _alt = _param.alt, alt = _alt === void 0 ? '' : _alt, props = _objectWithoutProperties(_param, [
129
+ var _aspectRatio = _param.aspectRatio, aspectRatio = _aspectRatio === void 0 ? '1:1' : _aspectRatio, _alt = _param.alt, alt = _alt === void 0 ? '' : _alt, dataAttributes = _param.dataAttributes, props = _objectWithoutProperties(_param, [
100
130
  "aspectRatio",
101
- "alt"
131
+ "alt",
132
+ "dataAttributes"
102
133
  ]);
103
134
  var noBorderRadius = useDisableBorderRadius();
104
135
  var classes = useStyles({
@@ -118,14 +149,14 @@ var Image = /*#__PURE__*/ React.forwardRef(function(_param, ref) {
118
149
  } else {
119
150
  width = '100%';
120
151
  }
121
- return(/*#__PURE__*/ (0, _jsxRuntime).jsx("img", {
152
+ return(/*#__PURE__*/ (0, _jsxRuntime).jsx("img", _objectSpread({}, (0, _dom).getPrefixedDataAttributes(dataAttributes), {
122
153
  ref: ref,
123
154
  src: url,
124
155
  className: classes.image,
125
156
  alt: alt,
126
157
  width: width,
127
158
  height: height
128
- }));
159
+ })));
129
160
  });
130
161
  var _default = Image;
131
162
  exports.default = _default;
@@ -1,6 +1,7 @@
1
1
  // @flow
2
2
 
3
3
  import * as React from "react";
4
+ import type { DataAttributes } from "./utils/types";
4
5
  declare export var useDisableBorderRadius: () => boolean;
5
6
  declare export var DisableBorderRadiusProvider: React.ComponentType<{}>;
6
7
  export type AspectRatio = "1:1" | "16:9" | "7:10" | "4:3";
@@ -25,6 +26,7 @@ export type ImageProps = {
25
26
  * defaults to empty string
26
27
  */
27
28
  alt?: string,
29
+ dataAttributes?: DataAttributes,
28
30
  };
29
31
  /**
30
32
  * @deprecated
@@ -41,6 +43,7 @@ declare type DeprecatedImageProps = {
41
43
  * defaults to empty string
42
44
  */
43
45
  alt?: string,
46
+ dataAttributes?: DataAttributes,
44
47
  };
45
48
  declare var Image: React.ComponentType<{
46
49
  ...ImageProps | DeprecatedImageProps,
@@ -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 = '10.26.0';
6
+ var PACKAGE_VERSION = '10.27.0';
7
7
  exports.PACKAGE_VERSION = PACKAGE_VERSION;
@@ -98,8 +98,6 @@ var getBlauSkin = function getBlauSkin() {
98
98
  controlError: palette.blauRed,
99
99
  loadingBar: palette.blauBlueSecondary,
100
100
  loadingBarBackground: palette.blauBlueSecondary10,
101
- loadingBarInverse: palette.blauBlueSecondary,
102
- loadingBarBackgroundInverse: palette.blauBlueSecondary10,
103
101
  toggleAndroidInactive: palette.grey2,
104
102
  toggleAndroidBackgroundActive: palette.blauBlueSecondary10,
105
103
  iosControlKnob: palette.white,
@@ -111,8 +111,6 @@ var getO2ClassicSkin = function getO2ClassicSkin() {
111
111
  controlError: palette.pepper,
112
112
  loadingBar: palette.o2Gem,
113
113
  loadingBarBackground: palette.o2GemLight30,
114
- loadingBarBackgroundInverse: palette.o2GemLight30,
115
- loadingBarInverse: palette.o2Gem,
116
114
  toggleAndroidInactive: palette.grey2,
117
115
  toggleAndroidBackgroundActive: palette.o2GemLight30,
118
116
  iosControlKnob: palette.white,
@@ -199,8 +197,6 @@ var getO2ClassicSkin = function getO2ClassicSkin() {
199
197
  controlActivated: palette.o2Gem,
200
198
  loadingBar: palette.o2Gem,
201
199
  loadingBarBackground: palette.darkModeGrey6,
202
- loadingBarBackgroundInverse: palette.darkModeGrey,
203
- loadingBarInverse: palette.o2SkyBlue,
204
200
  toggleAndroidInactive: palette.grey4,
205
201
  toggleAndroidBackgroundActive: palette.o2GemLight30,
206
202
  iosControlKnob: palette.grey2,
package/dist/skins/o2.js CHANGED
@@ -101,8 +101,6 @@ var getO2Skin = function getO2Skin() {
101
101
  controlError: palette.pepper,
102
102
  loadingBar: palette.o2BluePrimary,
103
103
  loadingBarBackground: palette.grey1,
104
- loadingBarBackgroundInverse: palette.grey1,
105
- loadingBarInverse: palette.o2BluePrimary,
106
104
  toggleAndroidInactive: palette.grey2,
107
105
  toggleAndroidBackgroundActive: palette.o2BluePrimary15,
108
106
  iosControlKnob: palette.white,
@@ -193,8 +191,6 @@ var getO2Skin = function getO2Skin() {
193
191
  controlActivated: palette.o2BluePrimary30,
194
192
  loadingBar: palette.darkModeO2BluePrimary,
195
193
  loadingBarBackground: palette.darkModeGrey6,
196
- loadingBarBackgroundInverse: palette.grey1,
197
- loadingBarInverse: palette.darkModeO2BluePrimary,
198
194
  toggleAndroidInactive: palette.grey4,
199
195
  toggleAndroidBackgroundActive: palette.o2BlueLight30,
200
196
  iosControlKnob: palette.grey2,
@@ -96,8 +96,6 @@ var getTelefonicaSkin = function getTelefonicaSkin() {
96
96
  controlError: palette.coral,
97
97
  loadingBar: palette.telefonicaBlue30,
98
98
  loadingBarBackground: palette.telefonicaBlue70,
99
- loadingBarBackgroundInverse: palette.telefonicaBlue70,
100
- loadingBarInverse: palette.telefonicaBlue30,
101
99
  toggleAndroidInactive: palette.grey2,
102
100
  toggleAndroidBackgroundActive: palette.grey2,
103
101
  iosControlKnob: palette.white,
@@ -106,7 +104,7 @@ var getTelefonicaSkin = function getTelefonicaSkin() {
106
104
  dividerInverse: (0, _color).applyAlpha(palette.white, 0.2),
107
105
  navigationBarDivider: palette.telefonicaBlue,
108
106
  // FEEDBACKS
109
- badge: palette.coral80,
107
+ badge: palette.coral70,
110
108
  feedbackErrorBackground: palette.coral,
111
109
  feedbackInfoBackground: palette.grey9,
112
110
  // GLOBAL
@@ -186,8 +184,6 @@ var getTelefonicaSkin = function getTelefonicaSkin() {
186
184
  controlActivated: palette.telefonicaBlue,
187
185
  loadingBar: palette.telefonicaBlue,
188
186
  loadingBarBackground: (0, _color).applyAlpha(palette.white, 0.05),
189
- loadingBarBackgroundInverse: palette.telefonicaBlue70,
190
- loadingBarInverse: palette.telefonicaBlue30,
191
187
  toggleAndroidInactive: palette.grey4,
192
188
  toggleAndroidBackgroundActive: palette.grey1,
193
189
  iosControlKnob: palette.grey2,
@@ -95,8 +95,6 @@ var getVivoSkin = function getVivoSkin() {
95
95
  controlError: palette.pepper,
96
96
  loadingBar: palette.pink,
97
97
  loadingBarBackground: palette.pepperLight30,
98
- loadingBarBackgroundInverse: palette.vivoPurpleLight50,
99
- loadingBarInverse: palette.vivoPurple,
100
98
  toggleAndroidInactive: palette.grey2,
101
99
  toggleAndroidBackgroundActive: palette.vivoPurpleLight20,
102
100
  iosControlKnob: palette.white,
@@ -187,8 +185,6 @@ var getVivoSkin = function getVivoSkin() {
187
185
  controlActivated: palette.vivoPurpleLight80,
188
186
  loadingBar: palette.vivoPurpleLight80,
189
187
  loadingBarBackground: palette.darkModeGrey6,
190
- loadingBarBackgroundInverse: palette.grey1,
191
- loadingBarInverse: palette.vivoPurpleLight80,
192
188
  toggleAndroidInactive: palette.grey4,
193
189
  toggleAndroidBackgroundActive: palette.vivoPurpleLight50,
194
190
  iosControlKnob: palette.grey2,
package/dist/tag.d.ts CHANGED
@@ -1,10 +1,11 @@
1
1
  import * as React from 'react';
2
- import type { IconProps } from './utils/types';
2
+ import type { DataAttributes, IconProps } from './utils/types';
3
3
  export declare type TagType = 'promo' | 'active' | 'inactive' | 'success' | 'warning' | 'error';
4
4
  export declare type TagProps = {
5
5
  type?: 'promo' | 'active' | 'inactive' | 'success' | 'warning' | 'error';
6
6
  children: string;
7
7
  Icon?: React.FC<IconProps>;
8
+ dataAttributes?: DataAttributes;
8
9
  /** @deprecated use type prop */
9
10
  color?: string;
10
11
  };
package/dist/tag.js CHANGED
@@ -11,6 +11,7 @@ var _jss = require("./jss");
11
11
  var _text = require("./text");
12
12
  var _themeVariantContext = require("./theme-variant-context");
13
13
  var _css = require("./utils/css");
14
+ var _dom = require("./utils/dom");
14
15
  function _interopRequireDefault(obj) {
15
16
  return obj && obj.__esModule ? obj : {
16
17
  default: obj
@@ -45,6 +46,19 @@ function _arrayLikeToArray(arr, len) {
45
46
  function _arrayWithHoles(arr) {
46
47
  if (Array.isArray(arr)) return arr;
47
48
  }
49
+ function _defineProperty(obj, key, value) {
50
+ if (key in obj) {
51
+ Object.defineProperty(obj, key, {
52
+ value: value,
53
+ enumerable: true,
54
+ configurable: true,
55
+ writable: true
56
+ });
57
+ } else {
58
+ obj[key] = value;
59
+ }
60
+ return obj;
61
+ }
48
62
  function _iterableToArrayLimit(arr, i) {
49
63
  var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
50
64
  if (_i == null) return;
@@ -72,6 +86,22 @@ function _iterableToArrayLimit(arr, i) {
72
86
  function _nonIterableRest() {
73
87
  throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
74
88
  }
89
+ function _objectSpread(target) {
90
+ var _arguments = arguments, _loop = function(i) {
91
+ var source = _arguments[i] != null ? _arguments[i] : {};
92
+ var ownKeys = Object.keys(source);
93
+ if (typeof Object.getOwnPropertySymbols === "function") {
94
+ ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
95
+ return Object.getOwnPropertyDescriptor(source, sym).enumerable;
96
+ }));
97
+ }
98
+ ownKeys.forEach(function(key) {
99
+ _defineProperty(target, key, source[key]);
100
+ });
101
+ };
102
+ for(var i = 1; i < arguments.length; i++)_loop(i);
103
+ return target;
104
+ }
75
105
  function _slicedToArray(arr, i) {
76
106
  return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();
77
107
  }
@@ -105,7 +135,7 @@ var useStyles = (0, _jss).createUseStyles(function() {
105
135
  };
106
136
  });
107
137
  var Tag = function Tag(param) {
108
- var Icon = param.Icon, children = param.children, _type = param.type, type = _type === void 0 ? 'promo' : _type, color = param.color;
138
+ var Icon = param.Icon, children = param.children, dataAttributes = param.dataAttributes, _type = param.type, type = _type === void 0 ? 'promo' : _type, color = param.color;
109
139
  var classes = useStyles({
110
140
  hasIcon: !!Icon
111
141
  });
@@ -168,7 +198,7 @@ var Tag = function Tag(param) {
168
198
  };
169
199
  var _type1 = _slicedToArray(tagTypeToColors[type], 2), textColor1 = _type1[0], backgroundColor = _type1[1];
170
200
  var shouldUseInverseBackground = isInverse && !isDarkMode;
171
- return(/*#__PURE__*/ (0, _jsxRuntime).jsxs("span", {
201
+ return(/*#__PURE__*/ (0, _jsxRuntime).jsxs("span", _objectSpread({}, (0, _dom).getPrefixedDataAttributes(dataAttributes), {
172
202
  className: classes.tag,
173
203
  style: {
174
204
  background: shouldUseInverseBackground ? colors.inverse : backgroundColor
@@ -193,7 +223,7 @@ var Tag = function Tag(param) {
193
223
  })
194
224
  })
195
225
  ]
196
- }));
226
+ })));
197
227
  };
198
228
  var _default = Tag;
199
229
  exports.default = _default;
package/dist/tag.js.flow CHANGED
@@ -1,7 +1,7 @@
1
1
  // @flow
2
2
 
3
3
  import * as React from "react";
4
- import type { IconProps } from "./utils/types";
4
+ import type { DataAttributes, IconProps } from "./utils/types";
5
5
  export type TagType =
6
6
  | "promo"
7
7
  | "active"
@@ -13,6 +13,7 @@ export type TagProps = {
13
13
  type?: "promo" | "active" | "inactive" | "success" | "warning" | "error",
14
14
  children: string,
15
15
  Icon?: React.ComponentType<IconProps>,
16
+ dataAttributes?: DataAttributes,
16
17
 
17
18
  /**
18
19
  * @deprecated use type prop
@@ -10,6 +10,7 @@ interface CommonProps {
10
10
  small?: boolean;
11
11
  disabled?: boolean;
12
12
  trackingEvent?: TrackingEvent | ReadonlyArray<TrackingEvent>;
13
+ trackEvent?: boolean;
13
14
  /** "data-" prefix is automatically added. For example, use "testid" instead of "data-testid" */
14
15
  dataAttributes?: DataAttributes;
15
16
  }
package/dist/text-link.js CHANGED
@@ -10,6 +10,8 @@ var _touchable = _interopRequireDefault(require("./touchable"));
10
10
  var _classnames = _interopRequireDefault(require("classnames"));
11
11
  var _themeVariantContext = require("./theme-variant-context");
12
12
  var _formContext = require("./form-context");
13
+ var _common = require("./utils/common");
14
+ var _analytics = require("./utils/analytics");
13
15
  function _interopRequireDefault(obj) {
14
16
  return obj && obj.__esModule ? obj : {
15
17
  default: obj
@@ -126,8 +128,14 @@ var TextLink = function TextLink(_param) {
126
128
  var classes = useStyles();
127
129
  var isInverse = (0, _themeVariantContext).useIsInverseVariant();
128
130
  var formStatus = (0, _formContext).useForm().formStatus;
131
+ var _trackingEvent;
129
132
  var _obj;
130
133
  return(/*#__PURE__*/ (0, _jsxRuntime).jsx(_touchable.default, _objectSpread({}, props, {
134
+ trackingEvent: (_trackingEvent = props.trackingEvent) !== null && _trackingEvent !== void 0 ? _trackingEvent : props.trackEvent ? {
135
+ category: _analytics.eventCategories.userInteraction,
136
+ action: _analytics.eventActions.linkTapped,
137
+ label: (0, _common).getTextFromChildren(children)
138
+ } : undefined,
131
139
  disabled: disabled || formStatus === 'sending',
132
140
  className: (0, _classnames).default(classes.textLink, className, (_obj = {}, _defineProperty(_obj, classes.small, small), _defineProperty(_obj, classes.inverse, isInverse), _obj)),
133
141
  children: children
@@ -12,6 +12,7 @@ declare type CommonProps = {
12
12
  small?: boolean,
13
13
  disabled?: boolean,
14
14
  trackingEvent?: TrackingEvent | $ReadOnlyArray<TrackingEvent>,
15
+ trackEvent?: boolean,
15
16
 
16
17
  /**
17
18
  * "data-" prefix is automatically added. For example, use "testid" instead of "data-testid"
package/dist/text.d.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  import * as React from 'react';
2
+ import type { DataAttributes } from './utils/types';
2
3
  declare type FontWeight = 'light' | 'regular' | 'medium';
3
4
  export interface TextPresetProps {
4
5
  color?: string;
@@ -15,6 +16,7 @@ export interface TextPresetProps {
15
16
  as?: React.ComponentType<any> | string;
16
17
  role?: string;
17
18
  'aria-level'?: number;
19
+ dataAttributes?: DataAttributes;
18
20
  }
19
21
  interface TextProps extends TextPresetProps {
20
22
  weight?: FontWeight | boolean;
package/dist/text.js CHANGED
@@ -9,6 +9,7 @@ var _classnames = _interopRequireDefault(require("classnames"));
9
9
  var _jss = require("./jss");
10
10
  var _themeVariantContext = require("./theme-variant-context");
11
11
  var _css = require("./utils/css");
12
+ var _dom = require("./utils/dom");
12
13
  function _interopRequireDefault(obj) {
13
14
  return obj && obj.__esModule ? obj : {
14
15
  default: obj
@@ -148,7 +149,7 @@ var useStyles = (0, _jss).createUseStyles(function(theme) {
148
149
  };
149
150
  });
150
151
  var Text = function Text(param) {
151
- var weight = param.weight, color = param.color, textDecoration = param.textDecoration, _decoration = param.decoration, decoration = _decoration === void 0 ? textDecoration : _decoration, truncate = param.truncate, uppercase = param.uppercase, transform = param.transform, wordBreak = param.wordBreak, _as = param.as, as = _as === void 0 ? 'span' : _as, children = param.children, size = param.size, _mobileSize = param.mobileSize, mobileSize = _mobileSize === void 0 ? size : _mobileSize, _desktopSize = param.desktopSize, desktopSize = _desktopSize === void 0 ? size : _desktopSize, lineHeight = param.lineHeight, _mobileLineHeight = param.mobileLineHeight, mobileLineHeight = _mobileLineHeight === void 0 ? lineHeight : _mobileLineHeight, _desktopLineHeight = param.desktopLineHeight, desktopLineHeight = _desktopLineHeight === void 0 ? lineHeight : _desktopLineHeight, letterSpacing = param.letterSpacing, id = param.id, role = param.role, ariaLevel = param['aria-level'];
152
+ var weight = param.weight, color = param.color, textDecoration = param.textDecoration, _decoration = param.decoration, decoration = _decoration === void 0 ? textDecoration : _decoration, truncate = param.truncate, uppercase = param.uppercase, transform = param.transform, wordBreak = param.wordBreak, _as = param.as, as = _as === void 0 ? 'span' : _as, children = param.children, size = param.size, _mobileSize = param.mobileSize, mobileSize = _mobileSize === void 0 ? size : _mobileSize, _desktopSize = param.desktopSize, desktopSize = _desktopSize === void 0 ? size : _desktopSize, lineHeight = param.lineHeight, _mobileLineHeight = param.mobileLineHeight, mobileLineHeight = _mobileLineHeight === void 0 ? lineHeight : _mobileLineHeight, _desktopLineHeight = param.desktopLineHeight, desktopLineHeight = _desktopLineHeight === void 0 ? lineHeight : _desktopLineHeight, letterSpacing = param.letterSpacing, id = param.id, role = param.role, ariaLevel = param['aria-level'], dataAttributes = param.dataAttributes;
152
153
  var isInverse = (0, _themeVariantContext).useIsInverseVariant();
153
154
  var classes = useStyles({
154
155
  isInverse: isInverse,
@@ -169,12 +170,12 @@ var Text = function Text(param) {
169
170
  return null;
170
171
  }
171
172
  var className = (0, _classnames).default(classes.text, _defineProperty({}, classes.truncate, !!truncate));
172
- return(/*#__PURE__*/ React.createElement(as, {
173
+ return(/*#__PURE__*/ React.createElement(as, _objectSpread({
173
174
  className: className,
174
175
  id: id,
175
176
  role: role,
176
177
  'aria-level': ariaLevel
177
- }, children));
178
+ }, (0, _dom).getPrefixedDataAttributes(dataAttributes)), children));
178
179
  };
179
180
  exports.Text = Text;
180
181
  var getRegularOrMediumWeight = function getRegularOrMediumWeight(props) {
package/dist/text.js.flow CHANGED
@@ -1,6 +1,7 @@
1
1
  // @flow
2
2
 
3
3
  import * as React from "react";
4
+ import type { DataAttributes } from "./utils/types";
4
5
  declare type FontWeight = "light" | "regular" | "medium";
5
6
  export type TextPresetProps = {
6
7
  color?: string,
@@ -23,6 +24,7 @@ export type TextPresetProps = {
23
24
  as?: React.ComponentType<any> | string,
24
25
  role?: string,
25
26
  "aria-level"?: number,
27
+ dataAttributes?: DataAttributes,
26
28
  };
27
29
  declare type TextProps = {
28
30
  ...$Exact<TextPresetProps>,
@@ -0,0 +1,6 @@
1
+ export declare const eventCategories: {
2
+ readonly userInteraction: "user_interaction";
3
+ };
4
+ export declare const eventActions: {
5
+ readonly linkTapped: "link_tapped";
6
+ };
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
5
+ exports.eventActions = exports.eventCategories = void 0;
6
+ var eventCategories = {
7
+ userInteraction: 'user_interaction'
8
+ };
9
+ exports.eventCategories = eventCategories;
10
+ var eventActions = {
11
+ linkTapped: 'link_tapped'
12
+ };
13
+ exports.eventActions = eventActions;
@@ -0,0 +1,8 @@
1
+ // @flow
2
+
3
+ declare export var eventCategories: {
4
+ +userInteraction: "user_interaction",
5
+ };
6
+ declare export var eventActions: {
7
+ +linkTapped: "link_tapped",
8
+ };
@@ -1,2 +1,3 @@
1
1
  import * as React from 'react';
2
2
  export declare const combineRefs: <T>(...refs: (React.Ref<T> | undefined)[]) => (refValue: T | null) => void;
3
+ export declare const getTextFromChildren: (children: React.ReactNode) => string;
@@ -2,7 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", {
3
3
  value: true
4
4
  });
5
- exports.combineRefs = void 0;
5
+ exports.getTextFromChildren = exports.combineRefs = void 0;
6
6
  var React = _interopRequireWildcard(require("react"));
7
7
  function _interopRequireWildcard(obj) {
8
8
  if (obj && obj.__esModule) {
@@ -43,3 +43,13 @@ var combineRefs = function combineRefs() {
43
43
  };
44
44
  };
45
45
  exports.combineRefs = combineRefs;
46
+ var getTextFromChildren = function getTextFromChildren(children) {
47
+ var text = '';
48
+ React.Children.forEach(children, function(child) {
49
+ if (typeof child === 'string') {
50
+ text += child;
51
+ }
52
+ });
53
+ return text;
54
+ };
55
+ exports.getTextFromChildren = getTextFromChildren;
@@ -4,3 +4,4 @@ import * as React from "react";
4
4
  declare export var combineRefs: <T>(
5
5
  ...refs: Array<React.Ref<T> | void>
6
6
  ) => (refValue: T | null) => void;
7
+ declare export var getTextFromChildren: (children: React.Node) => string;
package/dist/video.d.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  import * as React from 'react';
2
+ import type { DataAttributes } from './utils/types';
2
3
  export declare type AspectRatio = '1:1' | '16:9' | '12:5' | '4:3';
3
4
  export declare const RATIO: {
4
5
  '1:1': number;
@@ -28,6 +29,7 @@ export declare type VideoProps = {
28
29
  children?: void;
29
30
  /** defaults to none */
30
31
  preload?: 'none' | 'metadata' | 'auto';
32
+ dataAttributes?: DataAttributes;
31
33
  };
32
34
  declare const Video: React.ForwardRefExoticComponent<VideoProps & React.RefAttributes<HTMLVideoElement>>;
33
35
  export default Video;
package/dist/video.js CHANGED
@@ -8,6 +8,7 @@ var React = _interopRequireWildcard(require("react"));
8
8
  var _image = require("./image");
9
9
  var _jss = require("./jss");
10
10
  var _common = require("./utils/common");
11
+ var _dom = require("./utils/dom");
11
12
  function _interopRequireWildcard(obj) {
12
13
  if (obj && obj.__esModule) {
13
14
  return obj;
@@ -29,6 +30,35 @@ function _interopRequireWildcard(obj) {
29
30
  return newObj;
30
31
  }
31
32
  }
33
+ function _defineProperty(obj, key, value) {
34
+ if (key in obj) {
35
+ Object.defineProperty(obj, key, {
36
+ value: value,
37
+ enumerable: true,
38
+ configurable: true,
39
+ writable: true
40
+ });
41
+ } else {
42
+ obj[key] = value;
43
+ }
44
+ return obj;
45
+ }
46
+ function _objectSpread(target) {
47
+ var _arguments = arguments, _loop = function(i) {
48
+ var source = _arguments[i] != null ? _arguments[i] : {};
49
+ var ownKeys = Object.keys(source);
50
+ if (typeof Object.getOwnPropertySymbols === "function") {
51
+ ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
52
+ return Object.getOwnPropertyDescriptor(source, sym).enumerable;
53
+ }));
54
+ }
55
+ ownKeys.forEach(function(key) {
56
+ _defineProperty(target, key, source[key]);
57
+ });
58
+ };
59
+ for(var i = 1; i < arguments.length; i++)_loop(i);
60
+ return target;
61
+ }
32
62
  function _objectWithoutProperties(source, excluded) {
33
63
  if (source == null) return {};
34
64
  var target = _objectWithoutPropertiesLoose(source, excluded);
@@ -83,14 +113,15 @@ var useStyles = (0, _jss).createUseStyles(function() {
83
113
  });
84
114
  /** Transparent 1x1px PNG */ var TRANSPARENT_PIXEL = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAAXNSR0IArs4c6QAAAAtJREFUGFdjYAACAAAFAAGq1chRAAAAAElFTkSuQmCC';
85
115
  var Video = /*#__PURE__*/ React.forwardRef(function(_param, ref) {
86
- var src1 = _param.src, poster = _param.poster, _autoPlay = _param.autoPlay, autoPlay = _autoPlay === void 0 ? true : _autoPlay, _muted = _param.muted, muted = _muted === void 0 ? true : _muted, _loop = _param.loop, loop = _loop === void 0 ? true : _loop, _preload = _param.preload, preload = _preload === void 0 ? 'none' : _preload, _aspectRatio = _param.aspectRatio, aspectRatio = _aspectRatio === void 0 ? '1:1' : _aspectRatio, props = _objectWithoutProperties(_param, [
116
+ var src1 = _param.src, poster = _param.poster, _autoPlay = _param.autoPlay, autoPlay = _autoPlay === void 0 ? true : _autoPlay, _muted = _param.muted, muted = _muted === void 0 ? true : _muted, _loop = _param.loop, loop = _loop === void 0 ? true : _loop, _preload = _param.preload, preload = _preload === void 0 ? 'none' : _preload, _aspectRatio = _param.aspectRatio, aspectRatio = _aspectRatio === void 0 ? '1:1' : _aspectRatio, dataAttributes = _param.dataAttributes, props = _objectWithoutProperties(_param, [
87
117
  "src",
88
118
  "poster",
89
119
  "autoPlay",
90
120
  "muted",
91
121
  "loop",
92
122
  "preload",
93
- "aspectRatio"
123
+ "aspectRatio",
124
+ "dataAttributes"
94
125
  ]);
95
126
  var noBorderRadius = (0, _image).useDisableBorderRadius();
96
127
  var classes = useStyles({
@@ -130,7 +161,7 @@ var Video = /*#__PURE__*/ React.forwardRef(function(_param, ref) {
130
161
  } else {
131
162
  width = '100%';
132
163
  }
133
- return(/*#__PURE__*/ (0, _jsxRuntime).jsx("video", {
164
+ return(/*#__PURE__*/ (0, _jsxRuntime).jsx("video", _objectSpread({
134
165
  ref: (0, _common).combineRefs(ref, videoRef),
135
166
  playsInline: true,
136
167
  disablePictureInPicture: true,
@@ -143,7 +174,8 @@ var Video = /*#__PURE__*/ React.forwardRef(function(_param, ref) {
143
174
  className: classes.video,
144
175
  preload: preload,
145
176
  // This transparent pixel fallback avoids showing the ugly "play" image in android webviews
146
- poster: poster || TRANSPARENT_PIXEL,
177
+ poster: poster || TRANSPARENT_PIXEL
178
+ }, (0, _dom).getPrefixedDataAttributes(dataAttributes), {
147
179
  children: sources.map(function(param, index) {
148
180
  var src = param.src, type = param.type;
149
181
  /*#__PURE__*/ return (0, _jsxRuntime).jsx("source", {
@@ -151,7 +183,7 @@ var Video = /*#__PURE__*/ React.forwardRef(function(_param, ref) {
151
183
  type: type
152
184
  }, index);
153
185
  })
154
- }));
186
+ })));
155
187
  });
156
188
  var _default = Video;
157
189
  exports.default = _default;
@@ -1,6 +1,7 @@
1
1
  // @flow
2
2
 
3
3
  import * as React from "react";
4
+ import type { DataAttributes } from "./utils/types";
4
5
  export type AspectRatio = "1:1" | "16:9" | "12:5" | "4:3";
5
6
  declare export var RATIO: {
6
7
  "1:1": number,
@@ -43,6 +44,7 @@ export type VideoProps = {
43
44
  * defaults to none
44
45
  */
45
46
  preload?: "none" | "metadata" | "auto",
47
+ dataAttributes?: DataAttributes,
46
48
  };
47
49
  declare var Video: React.ComponentType<{
48
50
  ...VideoProps,
package/dist-es/button.js CHANGED
@@ -9,6 +9,8 @@ import { useForm } from './form-context';
9
9
  import { pxToRem } from './utils/css';
10
10
  import { Text, Text2, Text3 } from './text';
11
11
  import Box from './box';
12
+ import { getTextFromChildren } from './utils/common';
13
+ import { eventActions, eventCategories } from './utils/analytics';
12
14
  function _arrayLikeToArray(arr, len) {
13
15
  if (len == null || len > arr.length) len = arr.length;
14
16
  for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
@@ -308,13 +310,18 @@ var Button = function(props) {
308
310
  children: text
309
311
  });
310
312
  };
313
+ var _trackingEvent;
311
314
  var _obj;
312
315
  var commonProps = {
313
316
  className: classnames(classes.button, props.className, (_obj = {}, _defineProperty(_obj, classes.small, props.small), _defineProperty(_obj, classes.inverse, isInverse), _defineProperty(_obj, classes.light, !isInverse), _defineProperty(_obj, classes.isLoading, showSpinner), _obj)),
314
317
  style: _objectSpread({
315
318
  cursor: props.fake ? 'pointer' : undefined
316
319
  }, props.style),
317
- trackingEvent: props.trackingEvent,
320
+ trackingEvent: (_trackingEvent = props.trackingEvent) !== null && _trackingEvent !== void 0 ? _trackingEvent : props.trackEvent ? {
321
+ category: eventCategories.userInteraction,
322
+ action: "".concat(props.type, "_button_tapped"),
323
+ label: getTextFromChildren(props.children)
324
+ } : undefined,
318
325
  dataAttributes: props.dataAttributes,
319
326
  'aria-controls': props['aria-controls'],
320
327
  'aria-expanded': props['aria-expanded'],
@@ -453,10 +460,15 @@ var useButtonLinkStyles = createUseStyles(function(theme) {
453
460
  export var ButtonLink = /*#__PURE__*/ React.forwardRef(function(props, ref) {
454
461
  var classes = useButtonLinkStyles();
455
462
  var isInverse = useIsInverseVariant();
463
+ var _trackingEvent;
456
464
  var _obj;
457
465
  var commonProps = {
458
466
  className: classnames(classes.link, (_obj = {}, _defineProperty(_obj, classes.inverse, isInverse), _defineProperty(_obj, classes.aligned, props.aligned), _obj)),
459
- trackingEvent: props.trackingEvent,
467
+ trackingEvent: (_trackingEvent = props.trackingEvent) !== null && _trackingEvent !== void 0 ? _trackingEvent : props.trackEvent ? {
468
+ category: eventCategories.userInteraction,
469
+ action: eventActions.linkTapped,
470
+ label: getTextFromChildren(props.children)
471
+ } : undefined,
460
472
  dataAttributes: props.dataAttributes,
461
473
  children: /*#__PURE__*/ _jsx(Text2, {
462
474
  medium: true,
@@ -502,18 +514,21 @@ export var ButtonLink = /*#__PURE__*/ React.forwardRef(function(props, ref) {
502
514
  export var ButtonPrimary = function(props) {
503
515
  var classes = usePrimaryButtonStyles();
504
516
  return(/*#__PURE__*/ _jsx(Button, _objectSpread({}, props, {
505
- classes: classes
517
+ classes: classes,
518
+ type: "primary"
506
519
  })));
507
520
  };
508
521
  export var ButtonSecondary = function(props) {
509
522
  var classes = useSecondaryButtonStyles();
510
523
  return(/*#__PURE__*/ _jsx(Button, _objectSpread({}, props, {
511
- classes: classes
524
+ classes: classes,
525
+ type: "secondary"
512
526
  })));
513
527
  };
514
528
  export var ButtonDanger = function(props) {
515
529
  var classes = useDangerButtonStyles();
516
530
  return(/*#__PURE__*/ _jsx(Button, _objectSpread({}, props, {
517
- classes: classes
531
+ classes: classes,
532
+ type: "danger"
518
533
  })));
519
534
  };
package/dist-es/image.js CHANGED
@@ -1,6 +1,35 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import * as React from 'react';
3
3
  import { createUseStyles } from './jss';
4
+ import { getPrefixedDataAttributes } from './utils/dom';
5
+ function _defineProperty(obj, key, value) {
6
+ if (key in obj) {
7
+ Object.defineProperty(obj, key, {
8
+ value: value,
9
+ enumerable: true,
10
+ configurable: true,
11
+ writable: true
12
+ });
13
+ } else {
14
+ obj[key] = value;
15
+ }
16
+ return obj;
17
+ }
18
+ function _objectSpread(target) {
19
+ for(var i = 1; i < arguments.length; i++){
20
+ var source = arguments[i] != null ? arguments[i] : {};
21
+ var ownKeys = Object.keys(source);
22
+ if (typeof Object.getOwnPropertySymbols === "function") {
23
+ ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
24
+ return Object.getOwnPropertyDescriptor(source, sym).enumerable;
25
+ }));
26
+ }
27
+ ownKeys.forEach(function(key) {
28
+ _defineProperty(target, key, source[key]);
29
+ });
30
+ }
31
+ return target;
32
+ }
4
33
  function _objectWithoutProperties(source, excluded) {
5
34
  if (source == null) return {};
6
35
  var target = _objectWithoutPropertiesLoose(source, excluded);
@@ -67,9 +96,10 @@ export var RATIO = {
67
96
  '4:3': 4 / 3
68
97
  };
69
98
  var Image = /*#__PURE__*/ React.forwardRef(function(_param, ref) {
70
- var _aspectRatio = _param.aspectRatio, aspectRatio = _aspectRatio === void 0 ? '1:1' : _aspectRatio, _alt = _param.alt, alt = _alt === void 0 ? '' : _alt, props = _objectWithoutProperties(_param, [
99
+ var _aspectRatio = _param.aspectRatio, aspectRatio = _aspectRatio === void 0 ? '1:1' : _aspectRatio, _alt = _param.alt, alt = _alt === void 0 ? '' : _alt, dataAttributes = _param.dataAttributes, props = _objectWithoutProperties(_param, [
71
100
  "aspectRatio",
72
- "alt"
101
+ "alt",
102
+ "dataAttributes"
73
103
  ]);
74
104
  var noBorderRadius = useDisableBorderRadius();
75
105
  var classes = useStyles({
@@ -89,13 +119,13 @@ var Image = /*#__PURE__*/ React.forwardRef(function(_param, ref) {
89
119
  } else {
90
120
  width = '100%';
91
121
  }
92
- return(/*#__PURE__*/ _jsx("img", {
122
+ return(/*#__PURE__*/ _jsx("img", _objectSpread({}, getPrefixedDataAttributes(dataAttributes), {
93
123
  ref: ref,
94
124
  src: url,
95
125
  className: classes.image,
96
126
  alt: alt,
97
127
  width: width,
98
128
  height: height
99
- }));
129
+ })));
100
130
  });
101
131
  export default Image;
@@ -1,2 +1,2 @@
1
1
  // DO NOT EDIT THIS FILE. It's autogenerated by set-version.js
2
- export var PACKAGE_VERSION = '10.26.0';
2
+ export var PACKAGE_VERSION = '10.27.0';
@@ -94,8 +94,6 @@ export var getBlauSkin = function() {
94
94
  controlError: palette.blauRed,
95
95
  loadingBar: palette.blauBlueSecondary,
96
96
  loadingBarBackground: palette.blauBlueSecondary10,
97
- loadingBarInverse: palette.blauBlueSecondary,
98
- loadingBarBackgroundInverse: palette.blauBlueSecondary10,
99
97
  toggleAndroidInactive: palette.grey2,
100
98
  toggleAndroidBackgroundActive: palette.blauBlueSecondary10,
101
99
  iosControlKnob: palette.white,
@@ -107,8 +107,6 @@ export var getO2ClassicSkin = function() {
107
107
  controlError: palette.pepper,
108
108
  loadingBar: palette.o2Gem,
109
109
  loadingBarBackground: palette.o2GemLight30,
110
- loadingBarBackgroundInverse: palette.o2GemLight30,
111
- loadingBarInverse: palette.o2Gem,
112
110
  toggleAndroidInactive: palette.grey2,
113
111
  toggleAndroidBackgroundActive: palette.o2GemLight30,
114
112
  iosControlKnob: palette.white,
@@ -195,8 +193,6 @@ export var getO2ClassicSkin = function() {
195
193
  controlActivated: palette.o2Gem,
196
194
  loadingBar: palette.o2Gem,
197
195
  loadingBarBackground: palette.darkModeGrey6,
198
- loadingBarBackgroundInverse: palette.darkModeGrey,
199
- loadingBarInverse: palette.o2SkyBlue,
200
196
  toggleAndroidInactive: palette.grey4,
201
197
  toggleAndroidBackgroundActive: palette.o2GemLight30,
202
198
  iosControlKnob: palette.grey2,
@@ -97,8 +97,6 @@ export var getO2Skin = function() {
97
97
  controlError: palette.pepper,
98
98
  loadingBar: palette.o2BluePrimary,
99
99
  loadingBarBackground: palette.grey1,
100
- loadingBarBackgroundInverse: palette.grey1,
101
- loadingBarInverse: palette.o2BluePrimary,
102
100
  toggleAndroidInactive: palette.grey2,
103
101
  toggleAndroidBackgroundActive: palette.o2BluePrimary15,
104
102
  iosControlKnob: palette.white,
@@ -189,8 +187,6 @@ export var getO2Skin = function() {
189
187
  controlActivated: palette.o2BluePrimary30,
190
188
  loadingBar: palette.darkModeO2BluePrimary,
191
189
  loadingBarBackground: palette.darkModeGrey6,
192
- loadingBarBackgroundInverse: palette.grey1,
193
- loadingBarInverse: palette.darkModeO2BluePrimary,
194
190
  toggleAndroidInactive: palette.grey4,
195
191
  toggleAndroidBackgroundActive: palette.o2BlueLight30,
196
192
  iosControlKnob: palette.grey2,
@@ -92,8 +92,6 @@ export var getTelefonicaSkin = function() {
92
92
  controlError: palette.coral,
93
93
  loadingBar: palette.telefonicaBlue30,
94
94
  loadingBarBackground: palette.telefonicaBlue70,
95
- loadingBarBackgroundInverse: palette.telefonicaBlue70,
96
- loadingBarInverse: palette.telefonicaBlue30,
97
95
  toggleAndroidInactive: palette.grey2,
98
96
  toggleAndroidBackgroundActive: palette.grey2,
99
97
  iosControlKnob: palette.white,
@@ -102,7 +100,7 @@ export var getTelefonicaSkin = function() {
102
100
  dividerInverse: applyAlpha(palette.white, 0.2),
103
101
  navigationBarDivider: palette.telefonicaBlue,
104
102
  // FEEDBACKS
105
- badge: palette.coral80,
103
+ badge: palette.coral70,
106
104
  feedbackErrorBackground: palette.coral,
107
105
  feedbackInfoBackground: palette.grey9,
108
106
  // GLOBAL
@@ -182,8 +180,6 @@ export var getTelefonicaSkin = function() {
182
180
  controlActivated: palette.telefonicaBlue,
183
181
  loadingBar: palette.telefonicaBlue,
184
182
  loadingBarBackground: applyAlpha(palette.white, 0.05),
185
- loadingBarBackgroundInverse: palette.telefonicaBlue70,
186
- loadingBarInverse: palette.telefonicaBlue30,
187
183
  toggleAndroidInactive: palette.grey4,
188
184
  toggleAndroidBackgroundActive: palette.grey1,
189
185
  iosControlKnob: palette.grey2,
@@ -91,8 +91,6 @@ export var getVivoSkin = function() {
91
91
  controlError: palette.pepper,
92
92
  loadingBar: palette.pink,
93
93
  loadingBarBackground: palette.pepperLight30,
94
- loadingBarBackgroundInverse: palette.vivoPurpleLight50,
95
- loadingBarInverse: palette.vivoPurple,
96
94
  toggleAndroidInactive: palette.grey2,
97
95
  toggleAndroidBackgroundActive: palette.vivoPurpleLight20,
98
96
  iosControlKnob: palette.white,
@@ -183,8 +181,6 @@ export var getVivoSkin = function() {
183
181
  controlActivated: palette.vivoPurpleLight80,
184
182
  loadingBar: palette.vivoPurpleLight80,
185
183
  loadingBarBackground: palette.darkModeGrey6,
186
- loadingBarBackgroundInverse: palette.grey1,
187
- loadingBarInverse: palette.vivoPurpleLight80,
188
184
  toggleAndroidInactive: palette.grey4,
189
185
  toggleAndroidBackgroundActive: palette.vivoPurpleLight50,
190
186
  iosControlKnob: palette.grey2,
package/dist-es/tag.js CHANGED
@@ -6,6 +6,7 @@ import { createUseStyles } from './jss';
6
6
  import { Text } from './text';
7
7
  import { ThemeVariant, useIsInverseVariant } from './theme-variant-context';
8
8
  import { pxToRem } from './utils/css';
9
+ import { getPrefixedDataAttributes } from './utils/dom';
9
10
  function _arrayLikeToArray(arr, len) {
10
11
  if (len == null || len > arr.length) len = arr.length;
11
12
  for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
@@ -14,6 +15,19 @@ function _arrayLikeToArray(arr, len) {
14
15
  function _arrayWithHoles(arr) {
15
16
  if (Array.isArray(arr)) return arr;
16
17
  }
18
+ function _defineProperty(obj, key, value) {
19
+ if (key in obj) {
20
+ Object.defineProperty(obj, key, {
21
+ value: value,
22
+ enumerable: true,
23
+ configurable: true,
24
+ writable: true
25
+ });
26
+ } else {
27
+ obj[key] = value;
28
+ }
29
+ return obj;
30
+ }
17
31
  function _iterableToArrayLimit(arr, i) {
18
32
  var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
19
33
  if (_i == null) return;
@@ -41,6 +55,21 @@ function _iterableToArrayLimit(arr, i) {
41
55
  function _nonIterableRest() {
42
56
  throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
43
57
  }
58
+ function _objectSpread(target) {
59
+ for(var i = 1; i < arguments.length; i++){
60
+ var source = arguments[i] != null ? arguments[i] : {};
61
+ var ownKeys = Object.keys(source);
62
+ if (typeof Object.getOwnPropertySymbols === "function") {
63
+ ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
64
+ return Object.getOwnPropertyDescriptor(source, sym).enumerable;
65
+ }));
66
+ }
67
+ ownKeys.forEach(function(key) {
68
+ _defineProperty(target, key, source[key]);
69
+ });
70
+ }
71
+ return target;
72
+ }
44
73
  function _slicedToArray(arr, i) {
45
74
  return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();
46
75
  }
@@ -74,7 +103,7 @@ var useStyles = createUseStyles(function() {
74
103
  };
75
104
  });
76
105
  var Tag = function(param) {
77
- var Icon = param.Icon, children = param.children, _type = param.type, type = _type === void 0 ? 'promo' : _type, color = param.color;
106
+ var Icon = param.Icon, children = param.children, dataAttributes = param.dataAttributes, _type = param.type, type = _type === void 0 ? 'promo' : _type, color = param.color;
78
107
  var classes = useStyles({
79
108
  hasIcon: !!Icon
80
109
  });
@@ -137,7 +166,7 @@ var Tag = function(param) {
137
166
  };
138
167
  var _type1 = _slicedToArray(tagTypeToColors[type], 2), textColor1 = _type1[0], backgroundColor = _type1[1];
139
168
  var shouldUseInverseBackground = isInverse && !isDarkMode;
140
- return(/*#__PURE__*/ _jsxs("span", {
169
+ return(/*#__PURE__*/ _jsxs("span", _objectSpread({}, getPrefixedDataAttributes(dataAttributes), {
141
170
  className: classes.tag,
142
171
  style: {
143
172
  background: shouldUseInverseBackground ? colors.inverse : backgroundColor
@@ -162,6 +191,6 @@ var Tag = function(param) {
162
191
  })
163
192
  })
164
193
  ]
165
- }));
194
+ })));
166
195
  };
167
196
  export default Tag;
@@ -5,6 +5,8 @@ import Touchable from './touchable';
5
5
  import classnames from 'classnames';
6
6
  import { useIsInverseVariant } from './theme-variant-context';
7
7
  import { useForm } from './form-context';
8
+ import { getTextFromChildren } from './utils/common';
9
+ import { eventActions, eventCategories } from './utils/analytics';
8
10
  function _defineProperty(obj, key, value) {
9
11
  if (key in obj) {
10
12
  Object.defineProperty(obj, key, {
@@ -94,8 +96,14 @@ var TextLink = function(_param) {
94
96
  var classes = useStyles();
95
97
  var isInverse = useIsInverseVariant();
96
98
  var formStatus = useForm().formStatus;
99
+ var _trackingEvent;
97
100
  var _obj;
98
101
  return(/*#__PURE__*/ _jsx(Touchable, _objectSpread({}, props, {
102
+ trackingEvent: (_trackingEvent = props.trackingEvent) !== null && _trackingEvent !== void 0 ? _trackingEvent : props.trackEvent ? {
103
+ category: eventCategories.userInteraction,
104
+ action: eventActions.linkTapped,
105
+ label: getTextFromChildren(children)
106
+ } : undefined,
99
107
  disabled: disabled || formStatus === 'sending',
100
108
  className: classnames(classes.textLink, className, (_obj = {}, _defineProperty(_obj, classes.small, small), _defineProperty(_obj, classes.inverse, isInverse), _obj)),
101
109
  children: children
package/dist-es/text.js CHANGED
@@ -4,6 +4,7 @@ import classnames from 'classnames';
4
4
  import { createUseStyles } from './jss';
5
5
  import { useIsInverseVariant } from './theme-variant-context';
6
6
  import { pxToRem } from './utils/css';
7
+ import { getPrefixedDataAttributes } from './utils/dom';
7
8
  function _defineProperty(obj, key, value) {
8
9
  if (key in obj) {
9
10
  Object.defineProperty(obj, key, {
@@ -116,7 +117,7 @@ var useStyles = createUseStyles(function(theme) {
116
117
  };
117
118
  });
118
119
  export var Text = function(param) {
119
- var weight = param.weight, color = param.color, textDecoration = param.textDecoration, _decoration = param.decoration, decoration = _decoration === void 0 ? textDecoration : _decoration, truncate = param.truncate, uppercase = param.uppercase, transform = param.transform, wordBreak = param.wordBreak, _as = param.as, as = _as === void 0 ? 'span' : _as, children = param.children, size = param.size, _mobileSize = param.mobileSize, mobileSize = _mobileSize === void 0 ? size : _mobileSize, _desktopSize = param.desktopSize, desktopSize = _desktopSize === void 0 ? size : _desktopSize, lineHeight = param.lineHeight, _mobileLineHeight = param.mobileLineHeight, mobileLineHeight = _mobileLineHeight === void 0 ? lineHeight : _mobileLineHeight, _desktopLineHeight = param.desktopLineHeight, desktopLineHeight = _desktopLineHeight === void 0 ? lineHeight : _desktopLineHeight, letterSpacing = param.letterSpacing, id = param.id, role = param.role, ariaLevel = param['aria-level'];
120
+ var weight = param.weight, color = param.color, textDecoration = param.textDecoration, _decoration = param.decoration, decoration = _decoration === void 0 ? textDecoration : _decoration, truncate = param.truncate, uppercase = param.uppercase, transform = param.transform, wordBreak = param.wordBreak, _as = param.as, as = _as === void 0 ? 'span' : _as, children = param.children, size = param.size, _mobileSize = param.mobileSize, mobileSize = _mobileSize === void 0 ? size : _mobileSize, _desktopSize = param.desktopSize, desktopSize = _desktopSize === void 0 ? size : _desktopSize, lineHeight = param.lineHeight, _mobileLineHeight = param.mobileLineHeight, mobileLineHeight = _mobileLineHeight === void 0 ? lineHeight : _mobileLineHeight, _desktopLineHeight = param.desktopLineHeight, desktopLineHeight = _desktopLineHeight === void 0 ? lineHeight : _desktopLineHeight, letterSpacing = param.letterSpacing, id = param.id, role = param.role, ariaLevel = param['aria-level'], dataAttributes = param.dataAttributes;
120
121
  var isInverse = useIsInverseVariant();
121
122
  var classes = useStyles({
122
123
  isInverse: isInverse,
@@ -137,12 +138,12 @@ export var Text = function(param) {
137
138
  return null;
138
139
  }
139
140
  var className = classnames(classes.text, _defineProperty({}, classes.truncate, !!truncate));
140
- return(/*#__PURE__*/ React.createElement(as, {
141
+ return(/*#__PURE__*/ React.createElement(as, _objectSpread({
141
142
  className: className,
142
143
  id: id,
143
144
  role: role,
144
145
  'aria-level': ariaLevel
145
- }, children));
146
+ }, getPrefixedDataAttributes(dataAttributes)), children));
146
147
  };
147
148
  var getRegularOrMediumWeight = function(props) {
148
149
  return props.regular && 'regular' || props.medium && 'medium';
@@ -0,0 +1,6 @@
1
+ export var eventCategories = {
2
+ userInteraction: 'user_interaction'
3
+ };
4
+ export var eventActions = {
5
+ linkTapped: 'link_tapped'
6
+ };
@@ -16,3 +16,12 @@ export var combineRefs = function() {
16
16
  });
17
17
  };
18
18
  };
19
+ export var getTextFromChildren = function(children) {
20
+ var text = '';
21
+ React.Children.forEach(children, function(child) {
22
+ if (typeof child === 'string') {
23
+ text += child;
24
+ }
25
+ });
26
+ return text;
27
+ };
package/dist-es/video.js CHANGED
@@ -3,6 +3,35 @@ import * as React from 'react';
3
3
  import { useDisableBorderRadius } from './image';
4
4
  import { createUseStyles } from './jss';
5
5
  import { combineRefs } from './utils/common';
6
+ import { getPrefixedDataAttributes } from './utils/dom';
7
+ function _defineProperty(obj, key, value) {
8
+ if (key in obj) {
9
+ Object.defineProperty(obj, key, {
10
+ value: value,
11
+ enumerable: true,
12
+ configurable: true,
13
+ writable: true
14
+ });
15
+ } else {
16
+ obj[key] = value;
17
+ }
18
+ return obj;
19
+ }
20
+ function _objectSpread(target) {
21
+ for(var i = 1; i < arguments.length; i++){
22
+ var source = arguments[i] != null ? arguments[i] : {};
23
+ var ownKeys = Object.keys(source);
24
+ if (typeof Object.getOwnPropertySymbols === "function") {
25
+ ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
26
+ return Object.getOwnPropertyDescriptor(source, sym).enumerable;
27
+ }));
28
+ }
29
+ ownKeys.forEach(function(key) {
30
+ _defineProperty(target, key, source[key]);
31
+ });
32
+ }
33
+ return target;
34
+ }
6
35
  function _objectWithoutProperties(source, excluded) {
7
36
  if (source == null) return {};
8
37
  var target = _objectWithoutPropertiesLoose(source, excluded);
@@ -56,14 +85,15 @@ var useStyles = createUseStyles(function() {
56
85
  });
57
86
  /** Transparent 1x1px PNG */ var TRANSPARENT_PIXEL = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAAXNSR0IArs4c6QAAAAtJREFUGFdjYAACAAAFAAGq1chRAAAAAElFTkSuQmCC';
58
87
  var Video = /*#__PURE__*/ React.forwardRef(function(_param, ref) {
59
- var src1 = _param.src, poster = _param.poster, _autoPlay = _param.autoPlay, autoPlay = _autoPlay === void 0 ? true : _autoPlay, _muted = _param.muted, muted = _muted === void 0 ? true : _muted, _loop = _param.loop, loop = _loop === void 0 ? true : _loop, _preload = _param.preload, preload = _preload === void 0 ? 'none' : _preload, _aspectRatio = _param.aspectRatio, aspectRatio = _aspectRatio === void 0 ? '1:1' : _aspectRatio, props = _objectWithoutProperties(_param, [
88
+ var src1 = _param.src, poster = _param.poster, _autoPlay = _param.autoPlay, autoPlay = _autoPlay === void 0 ? true : _autoPlay, _muted = _param.muted, muted = _muted === void 0 ? true : _muted, _loop = _param.loop, loop = _loop === void 0 ? true : _loop, _preload = _param.preload, preload = _preload === void 0 ? 'none' : _preload, _aspectRatio = _param.aspectRatio, aspectRatio = _aspectRatio === void 0 ? '1:1' : _aspectRatio, dataAttributes = _param.dataAttributes, props = _objectWithoutProperties(_param, [
60
89
  "src",
61
90
  "poster",
62
91
  "autoPlay",
63
92
  "muted",
64
93
  "loop",
65
94
  "preload",
66
- "aspectRatio"
95
+ "aspectRatio",
96
+ "dataAttributes"
67
97
  ]);
68
98
  var noBorderRadius = useDisableBorderRadius();
69
99
  var classes = useStyles({
@@ -103,7 +133,7 @@ var Video = /*#__PURE__*/ React.forwardRef(function(_param, ref) {
103
133
  } else {
104
134
  width = '100%';
105
135
  }
106
- return(/*#__PURE__*/ _jsx("video", {
136
+ return(/*#__PURE__*/ _jsx("video", _objectSpread({
107
137
  ref: combineRefs(ref, videoRef),
108
138
  playsInline: true,
109
139
  disablePictureInPicture: true,
@@ -116,7 +146,8 @@ var Video = /*#__PURE__*/ React.forwardRef(function(_param, ref) {
116
146
  className: classes.video,
117
147
  preload: preload,
118
148
  // This transparent pixel fallback avoids showing the ugly "play" image in android webviews
119
- poster: poster || TRANSPARENT_PIXEL,
149
+ poster: poster || TRANSPARENT_PIXEL
150
+ }, getPrefixedDataAttributes(dataAttributes), {
120
151
  children: sources.map(function(param, index) {
121
152
  var src = param.src, type = param.type;
122
153
  /*#__PURE__*/ return _jsx("source", {
@@ -124,6 +155,6 @@ var Video = /*#__PURE__*/ React.forwardRef(function(_param, ref) {
124
155
  type: type
125
156
  }, index);
126
157
  })
127
- }));
158
+ })));
128
159
  });
129
160
  export default Video;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@telefonica/mistica",
3
- "version": "10.26.0",
3
+ "version": "10.27.0",
4
4
  "license": "MIT",
5
5
  "repository": {
6
6
  "type": "git",