@mjhls/mjh-framework 1.0.994-CypressV3 → 1.0.994-invalidelement-v1

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 (225) hide show
  1. package/README.md +168 -168
  2. package/dist/cjs/AD.js +6 -6
  3. package/dist/cjs/AD300x250.js +5 -5
  4. package/dist/cjs/AD300x250x600.js +5 -5
  5. package/dist/cjs/AD728x90.js +6 -6
  6. package/dist/cjs/ADFloatingFooter.js +8 -8
  7. package/dist/cjs/ADFooter.js +5 -5
  8. package/dist/cjs/ADGutter.js +8 -8
  9. package/dist/cjs/{ADInfeed-e87afe8a.js → ADInfeed-f316b66a.js} +5 -5
  10. package/dist/cjs/ADSkyscraper.js +8 -8
  11. package/dist/cjs/ADSponsoredResources.js +8 -8
  12. package/dist/cjs/ADWebcast.js +8 -8
  13. package/dist/cjs/ADWelcome.js +12 -12
  14. package/dist/cjs/{ADlgInfeed-b5a3d436.js → ADlgInfeed-2003306e.js} +3 -3
  15. package/dist/cjs/AccordionPanel.js +17 -17
  16. package/dist/cjs/AdSlot.js +9 -9
  17. package/dist/cjs/AdSlotsProvider.js +7 -8
  18. package/dist/cjs/AlgoliaSearch.js +1214 -1129
  19. package/dist/cjs/AlphabeticList.js +12 -12
  20. package/dist/cjs/ArticleCarousel.js +5 -5
  21. package/dist/cjs/ArticleProgramLandingPage.js +16 -16
  22. package/dist/cjs/ArticleSeriesLandingPage.js +11 -11
  23. package/dist/cjs/ArticleSeriesListing.js +29 -29
  24. package/dist/cjs/Auth.js +23075 -242
  25. package/dist/cjs/AuthWrapper.js +120 -30
  26. package/dist/cjs/{AuthorComponent-39b37d84.js → AuthorComponent-7d00f6d5.js} +9 -9
  27. package/dist/cjs/{BlockContent-9ebd251f.js → BlockContent-96b44364.js} +18 -18
  28. package/dist/cjs/Breadcrumbs.js +17 -17
  29. package/dist/cjs/CMEDeck.js +61 -61
  30. package/dist/cjs/Column1.js +7 -7
  31. package/dist/cjs/Column2.js +15 -15
  32. package/dist/cjs/Column3.js +27 -27
  33. package/dist/cjs/ConferenceArticleCard.js +27 -27
  34. package/dist/cjs/{ConferenceBanner-6c9e718a.js → ConferenceBanner-213003ce.js} +3 -3
  35. package/dist/cjs/ContentCardPaginated.js +49 -49
  36. package/dist/cjs/DeckContent.js +66 -66
  37. package/dist/cjs/DeckQueue.js +57 -57
  38. package/dist/cjs/DeckQueuePaginated.js +46 -46
  39. package/dist/cjs/{Dfp-9be904d5.js → Dfp-c313a700.js} +17 -17
  40. package/dist/cjs/EventsDeck.js +107 -107
  41. package/dist/cjs/ExternalResources.js +36 -36
  42. package/dist/cjs/Feature.js +17 -17
  43. package/dist/cjs/ForbesHero.js +25 -25
  44. package/dist/cjs/GridContent.js +134 -134
  45. package/dist/cjs/GridContentPaginated.js +121 -121
  46. package/dist/cjs/GridHero.js +26 -26
  47. package/dist/cjs/GroupDeck.js +33 -33
  48. package/dist/cjs/HamMagazine.js +130 -130
  49. package/dist/cjs/Header.js +9 -9
  50. package/dist/cjs/HealthCareProfessionalModal.js +18 -18
  51. package/dist/cjs/Hero.js +5 -5
  52. package/dist/cjs/HighlightenVideo.js +13 -13
  53. package/dist/cjs/HorizontalArticleListing.js +30 -30
  54. package/dist/cjs/HorizontalHero.js +17 -17
  55. package/dist/cjs/{ImageSlider-6c00b878.js → ImageSlider-ca708da8.js} +1315 -176
  56. package/dist/cjs/IssueContentDeck.js +49 -49
  57. package/dist/cjs/IssueDeck.js +48 -48
  58. package/dist/cjs/IssueLanding.js +50 -50
  59. package/dist/cjs/KMTracker.js +15 -15
  60. package/dist/cjs/LeftNav.js +17 -17
  61. package/dist/cjs/MasterDeck.js +47 -47
  62. package/dist/cjs/MasterDeckPaginated.js +37 -37
  63. package/dist/cjs/{Tooltip-f075b7ef.js → MediaSeriesCard-f6db8f70.js} +678 -531
  64. package/dist/cjs/MediaSeriesLanding.js +56 -57
  65. package/dist/cjs/MediaSeriesLandingPaginated.js +54 -55
  66. package/dist/cjs/NavDvm.js +57 -57
  67. package/dist/cjs/{NavFooter-4799de4b.js → NavFooter-880e9d87.js} +11 -11
  68. package/dist/cjs/NavMagazine.js +116 -116
  69. package/dist/cjs/NavNative.js +106 -106
  70. package/dist/cjs/OncliveHero.js +11 -11
  71. package/dist/cjs/OncliveLargeHero.js +49 -49
  72. package/dist/cjs/PageFilter.js +5 -5
  73. package/dist/cjs/{Pagination-2a3d0103.js → Pagination-6359861a.js} +13 -13
  74. package/dist/cjs/PartnerDetailListing.js +52 -53
  75. package/dist/cjs/PartnerDetailListingPaginated.js +50 -73
  76. package/dist/cjs/PdfDownload.js +4 -4
  77. package/dist/cjs/PixelTracking.js +9 -9
  78. package/dist/cjs/PopUpModal.js +9 -9
  79. package/dist/cjs/PtceDeck.js +13 -13
  80. package/dist/cjs/PubSection.js +13 -13
  81. package/dist/cjs/PubToc.js +4 -4
  82. package/dist/cjs/PublicationDeck.js +44 -44
  83. package/dist/cjs/{PublicationFeature-5ccf9b13.js → PublicationFeature-a989a2b3.js} +29 -29
  84. package/dist/cjs/PublicationLanding.js +99 -99
  85. package/dist/cjs/QueueDeckExpanded.js +245 -245
  86. package/dist/cjs/QueueDeckExpandedPaginated.js +222 -222
  87. package/dist/cjs/RecentNews.js +15 -15
  88. package/dist/cjs/RelatedContent.js +42 -42
  89. package/dist/cjs/RelatedTopicsDropdown.js +24 -24
  90. package/dist/cjs/RolesDeck.js +20 -20
  91. package/dist/cjs/Schema.js +55 -52
  92. package/dist/cjs/Search.js +6 -6
  93. package/dist/cjs/SeriesListingDeck.js +18 -18
  94. package/dist/cjs/{SeriesSlider-594b19eb.js → SeriesSlider-f5248377.js} +26 -26
  95. package/dist/cjs/SideFooter.js +20 -20
  96. package/dist/cjs/SocialIcons.js +6 -6
  97. package/dist/cjs/{SocialSearchComponent-d2ab3d62.js → SocialSearchComponent-ca9c0c45.js} +28 -28
  98. package/dist/cjs/SocialShare.js +25 -25
  99. package/dist/cjs/TaxonomyCard.js +44 -44
  100. package/dist/cjs/TaxonomyDescription.js +13 -13
  101. package/dist/cjs/TemplateNormal.js +27 -27
  102. package/dist/cjs/ThumbnailCard.js +10 -10
  103. package/dist/cjs/Ustream.js +9 -9
  104. package/dist/cjs/VerticalHero.js +10 -10
  105. package/dist/cjs/VideoProgramLandingPage.js +30 -30
  106. package/dist/cjs/VideoSeriesCard.js +14 -14
  107. package/dist/cjs/VideoSeriesFilter.js +5 -5
  108. package/dist/cjs/VideoSeriesLandingPage.js +11 -11
  109. package/dist/cjs/VideoSeriesListing.js +46 -46
  110. package/dist/cjs/View.js +261 -274
  111. package/dist/cjs/YahooHero.js +22 -22
  112. package/dist/cjs/YoutubeGroup.js +37 -37
  113. package/dist/cjs/{brightcove-react-player-loader.es-a195642e.js → brightcove-react-player-loader.es-4c7825a1.js} +2 -2
  114. package/dist/cjs/defineProperty-ad65f5f0.js +110 -0
  115. package/dist/{esm/util-8ed16d48.js → cjs/empty-559717f3.js} +146 -1
  116. package/dist/cjs/getQuery.js +1 -1
  117. package/dist/cjs/getSerializers.js +8 -8
  118. package/dist/cjs/{getTargeting-ba942d9a.js → getTargeting-4439c99d.js} +9 -9
  119. package/dist/cjs/getTargeting.js +1 -1
  120. package/dist/cjs/iconBase-be4097c0.js +2 -4
  121. package/dist/cjs/index-0cf4c9fc.js +904 -0
  122. package/dist/cjs/{index-eadd5035.js → index-65621b6c.js} +5 -5
  123. package/dist/cjs/{index-f86bb269.js → index-96c331fd.js} +53 -52
  124. package/dist/cjs/{index-50be6759.js → index-9ec837cc.js} +9 -25
  125. package/dist/cjs/{index-f95a3c0f.js → index-b10d6863.js} +495 -511
  126. package/dist/cjs/{index-fc2f1ca2.js → index-d2a6ef75.js} +4 -4
  127. package/dist/cjs/{index.es-f3e47207.js → index.es-1ab8dda7.js} +4 -4
  128. package/dist/cjs/{index.esm-1461604c.js → index.esm-f59ef5b4.js} +14 -14
  129. package/dist/cjs/index.js +106 -111
  130. package/dist/cjs/{main-f1c77adb.js → main-6054981e.js} +17 -22
  131. package/dist/cjs/{react-social-icons-af932527.js → react-social-icons-2c5c389a.js} +7 -7
  132. package/dist/cjs/ustream-api-3819e4aa.js +1 -1
  133. package/dist/cjs/{visibility-sensor-eb2c5b69.js → visibility-sensor-56020df6.js} +1 -1
  134. package/dist/esm/AD300x250.js +1 -1
  135. package/dist/esm/AD300x250x600.js +1 -1
  136. package/dist/esm/AD728x90.js +1 -1
  137. package/dist/esm/ADFloatingFooter.js +1 -1
  138. package/dist/esm/ADGutter.js +1 -1
  139. package/dist/esm/ADSkyscraper.js +1 -1
  140. package/dist/esm/ADSponsoredResources.js +1 -1
  141. package/dist/esm/ADWebcast.js +1 -1
  142. package/dist/esm/ADWelcome.js +1 -1
  143. package/dist/esm/AdSlot.js +1 -1
  144. package/dist/esm/AdSlotsProvider.js +3 -3
  145. package/dist/esm/AlgoliaSearch.js +643 -558
  146. package/dist/esm/ArticleCarousel.js +1 -1
  147. package/dist/esm/ArticleProgramLandingPage.js +4 -4
  148. package/dist/esm/ArticleSeriesLandingPage.js +3 -3
  149. package/dist/esm/ArticleSeriesListing.js +1 -1
  150. package/dist/esm/Auth.js +22999 -163
  151. package/dist/esm/AuthWrapper.js +93 -3
  152. package/dist/esm/CMEDeck.js +1 -1
  153. package/dist/esm/Column3.js +1 -1
  154. package/dist/esm/ConferenceArticleCard.js +15 -15
  155. package/dist/esm/ContentCardPaginated.js +3 -3
  156. package/dist/esm/DeckContent.js +10 -10
  157. package/dist/esm/DeckQueue.js +1 -1
  158. package/dist/esm/DeckQueuePaginated.js +2 -2
  159. package/dist/esm/EventsDeck.js +19 -19
  160. package/dist/esm/ExternalResources.js +5 -5
  161. package/dist/esm/Feature.js +1 -1
  162. package/dist/esm/GridContent.js +3 -3
  163. package/dist/esm/GridContentPaginated.js +4 -4
  164. package/dist/esm/HamMagazine.js +29 -29
  165. package/dist/esm/HealthCareProfessionalModal.js +1 -1
  166. package/dist/esm/HorizontalArticleListing.js +4 -4
  167. package/dist/esm/{ImageSlider-f84174cb.js → ImageSlider-fada4f0c.js} +1257 -119
  168. package/dist/esm/IssueLanding.js +35 -35
  169. package/dist/esm/KMTracker.js +15 -15
  170. package/dist/esm/LeftNav.js +1 -1
  171. package/dist/esm/MasterDeck.js +11 -11
  172. package/dist/esm/MasterDeckPaginated.js +12 -12
  173. package/dist/esm/{Tooltip-95655b44.js → MediaSeriesCard-96ac8ed4.js} +396 -250
  174. package/dist/esm/MediaSeriesLanding.js +18 -19
  175. package/dist/esm/MediaSeriesLandingPaginated.js +18 -19
  176. package/dist/esm/NavMagazine.js +12 -12
  177. package/dist/esm/NavNative.js +10 -10
  178. package/dist/esm/{Pagination-dc30727b.js → Pagination-9fe9f61d.js} +1 -1
  179. package/dist/esm/PartnerDetailListing.js +8 -9
  180. package/dist/esm/PartnerDetailListingPaginated.js +16 -39
  181. package/dist/esm/PubSection.js +3 -3
  182. package/dist/esm/PublicationLanding.js +26 -26
  183. package/dist/esm/QueueDeckExpanded.js +3 -3
  184. package/dist/esm/QueueDeckExpandedPaginated.js +4 -4
  185. package/dist/esm/RelatedContent.js +28 -28
  186. package/dist/esm/RelatedTopicsDropdown.js +10 -10
  187. package/dist/esm/Schema.js +55 -52
  188. package/dist/esm/SeriesListingDeck.js +2 -2
  189. package/dist/esm/{SeriesSlider-f771e20d.js → SeriesSlider-4875823e.js} +5 -5
  190. package/dist/esm/SideFooter.js +2 -2
  191. package/dist/esm/{SocialSearchComponent-165b4ae7.js → SocialSearchComponent-68d948b9.js} +1 -1
  192. package/dist/esm/TaxonomyDescription.js +4 -4
  193. package/dist/esm/TemplateNormal.js +2 -2
  194. package/dist/esm/Ustream.js +1 -1
  195. package/dist/esm/VideoProgramLandingPage.js +4 -4
  196. package/dist/esm/VideoSeriesCard.js +1 -1
  197. package/dist/esm/VideoSeriesLandingPage.js +3 -3
  198. package/dist/esm/VideoSeriesListing.js +1 -1
  199. package/dist/esm/View.js +45 -58
  200. package/dist/esm/YoutubeGroup.js +5 -5
  201. package/dist/esm/defineProperty-50094484.js +101 -0
  202. package/dist/{cjs/util-93a37fd0.js → esm/empty-a8042e3c.js} +135 -3
  203. package/dist/esm/getQuery.js +1 -1
  204. package/dist/esm/getSerializers.js +4 -4
  205. package/dist/esm/{getTargeting-9bd28724.js → getTargeting-c6884f34.js} +9 -9
  206. package/dist/esm/getTargeting.js +1 -1
  207. package/dist/esm/{index-04817712.js → index-076baa11.js} +12 -27
  208. package/dist/esm/{index-98ca9cec.js → index-0ce54f8a.js} +10 -25
  209. package/dist/esm/{index-79cfd25c.js → index-30a6257d.js} +53 -52
  210. package/dist/esm/index-e7075467.js +897 -0
  211. package/dist/esm/index.js +13 -18
  212. package/dist/esm/{main-1894c974.js → main-9f6806ea.js} +4 -9
  213. package/package.json +115 -115
  214. package/dist/cjs/CypressTesting.js +0 -53
  215. package/dist/cjs/MediaSeriesCard-2e5cd247.js +0 -81
  216. package/dist/cjs/PodcastsLanding.js +0 -235
  217. package/dist/cjs/defineProperty-e0fb52c5.js +0 -73
  218. package/dist/cjs/typeof-1358762e.js +0 -33
  219. package/dist/esm/CypressTesting.js +0 -47
  220. package/dist/esm/MediaSeriesCard-afb517a5.js +0 -75
  221. package/dist/esm/PodcastsLanding.js +0 -228
  222. package/dist/esm/defineProperty-23a8f8cd.js +0 -68
  223. package/dist/esm/typeof-2f07d0e8.js +0 -30
  224. /package/dist/esm/{ADInfeed-5765a73a.js → ADInfeed-777bb0b3.js} +0 -0
  225. /package/dist/esm/{ADlgInfeed-5e36f317.js → ADlgInfeed-e7fd1bb6.js} +0 -0
@@ -0,0 +1,897 @@
1
+ import React__default, { Component } from 'react';
2
+ import PropTypes from 'prop-types';
3
+
4
+ function warn(s) {
5
+ console.warn('[react-ga]', s);
6
+ }
7
+
8
+ function _typeof$1(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof$1 = function _typeof(obj) { return typeof obj; }; } else { _typeof$1 = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof$1(obj); }
9
+
10
+ function ownKeys$2(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
11
+
12
+ function _objectSpread$2(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys$2(Object(source), true).forEach(function (key) { _defineProperty$2(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys$2(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
13
+
14
+ function _objectWithoutProperties$1(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose$1(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
15
+
16
+ function _objectWithoutPropertiesLoose$1(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
17
+
18
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
19
+
20
+ function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
21
+
22
+ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
23
+
24
+ function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
25
+
26
+ function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
27
+
28
+ function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
29
+
30
+ function _possibleConstructorReturn(self, call) { if (call && (_typeof$1(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
31
+
32
+ function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
33
+
34
+ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }
35
+
36
+ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
37
+
38
+ function _defineProperty$2(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
39
+ var NEWTAB = '_blank';
40
+ var MIDDLECLICK = 1;
41
+
42
+ var OutboundLink$1 = /*#__PURE__*/function (_Component) {
43
+ _inherits(OutboundLink, _Component);
44
+
45
+ var _super = _createSuper(OutboundLink);
46
+
47
+ function OutboundLink() {
48
+ var _this;
49
+
50
+ _classCallCheck(this, OutboundLink);
51
+
52
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
53
+ args[_key] = arguments[_key];
54
+ }
55
+
56
+ _this = _super.call.apply(_super, [this].concat(args));
57
+
58
+ _defineProperty$2(_assertThisInitialized(_this), "handleClick", function (event) {
59
+ var _this$props = _this.props,
60
+ target = _this$props.target,
61
+ eventLabel = _this$props.eventLabel,
62
+ to = _this$props.to,
63
+ onClick = _this$props.onClick,
64
+ trackerNames = _this$props.trackerNames;
65
+ var eventMeta = {
66
+ label: eventLabel
67
+ };
68
+ var sameTarget = target !== NEWTAB;
69
+ var normalClick = !(event.ctrlKey || event.shiftKey || event.metaKey || event.button === MIDDLECLICK);
70
+
71
+ if (sameTarget && normalClick) {
72
+ event.preventDefault();
73
+ OutboundLink.trackLink(eventMeta, function () {
74
+ window.location.href = to;
75
+ }, trackerNames);
76
+ } else {
77
+ OutboundLink.trackLink(eventMeta, function () {}, trackerNames);
78
+ }
79
+
80
+ if (onClick) {
81
+ onClick(event);
82
+ }
83
+ });
84
+
85
+ return _this;
86
+ }
87
+
88
+ _createClass(OutboundLink, [{
89
+ key: "render",
90
+ value: function render() {
91
+ var _this$props2 = this.props,
92
+ href = _this$props2.to,
93
+ target = _this$props2.target,
94
+ oldProps = _objectWithoutProperties$1(_this$props2, ["to", "target"]);
95
+
96
+ var props = _objectSpread$2(_objectSpread$2({}, oldProps), {}, {
97
+ target: target,
98
+ href: href,
99
+ onClick: this.handleClick
100
+ });
101
+
102
+ if (target === NEWTAB) {
103
+ props.rel = "".concat(props.rel ? props.rel : '', " noopener noreferrer").trim();
104
+ }
105
+
106
+ delete props.eventLabel;
107
+ delete props.trackerNames;
108
+ return /*#__PURE__*/React__default.createElement('a', props);
109
+ }
110
+ }]);
111
+
112
+ return OutboundLink;
113
+ }(Component);
114
+
115
+ _defineProperty$2(OutboundLink$1, "trackLink", function () {
116
+ warn('ga tracking not enabled');
117
+ });
118
+ OutboundLink$1.propTypes = {
119
+ eventLabel: PropTypes.string.isRequired,
120
+ target: PropTypes.string,
121
+ to: PropTypes.string,
122
+ onClick: PropTypes.func,
123
+ trackerNames: PropTypes.arrayOf(PropTypes.string)
124
+ };
125
+ OutboundLink$1.defaultProps = {
126
+ target: null,
127
+ to: null,
128
+ onClick: null,
129
+ trackerNames: null
130
+ };
131
+
132
+ // See if s could be an email address. We don't want to send personal data like email.
133
+ // https://support.google.com/analytics/answer/2795983?hl=en
134
+ function mightBeEmail(s) {
135
+ // There's no point trying to validate rfc822 fully, just look for ...@...
136
+ return typeof s === 'string' && s.indexOf('@') !== -1;
137
+ }
138
+
139
+ var redacted = 'REDACTED (Potential Email Address)';
140
+ function redactEmail(string) {
141
+ if (mightBeEmail(string)) {
142
+ warn('This arg looks like an email address, redacting.');
143
+ return redacted;
144
+ }
145
+
146
+ return string;
147
+ }
148
+
149
+ // GA strings need to have leading/trailing whitespace trimmed, and not all
150
+ // browsers have String.prototoype.trim().
151
+ function trim(s) {
152
+ return s && s.toString().replace(/^\s+|\s+$/g, '');
153
+ }
154
+
155
+ /**
156
+ * To Title Case 2.1 - http://individed.com/code/to-title-case/
157
+ * Copyright 2008-2013 David Gouch. Licensed under the MIT License.
158
+ * https://github.com/gouch/to-title-case
159
+ */
160
+ var smallWords = /^(a|an|and|as|at|but|by|en|for|if|in|nor|of|on|or|per|the|to|vs?\.?|via)$/i; // test
161
+
162
+ function toTitleCase(string) {
163
+ return trim(string).replace(/[A-Za-z0-9\u00C0-\u00FF]+[^\s-]*/g, function (match, index, title) {
164
+ if (index > 0 && index + match.length !== title.length && match.search(smallWords) > -1 && title.charAt(index - 2) !== ':' && (title.charAt(index + match.length) !== '-' || title.charAt(index - 1) === '-') && title.charAt(index - 1).search(/[^\s-]/) < 0) {
165
+ return match.toLowerCase();
166
+ }
167
+
168
+ if (match.substr(1).search(/[A-Z]|\../) > -1) {
169
+ return match;
170
+ }
171
+
172
+ return match.charAt(0).toUpperCase() + match.substr(1);
173
+ });
174
+ }
175
+
176
+ function format() {
177
+ var s = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
178
+ var titleCase = arguments.length > 1 ? arguments[1] : undefined;
179
+ var redactingEmail = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
180
+
181
+ var _str = s || '';
182
+
183
+ if (titleCase) {
184
+ _str = toTitleCase(s);
185
+ }
186
+
187
+ if (redactingEmail) {
188
+ _str = redactEmail(_str);
189
+ }
190
+
191
+ return _str;
192
+ }
193
+
194
+ function removeLeadingSlash(string) {
195
+ if (string.substring(0, 1) === '/') {
196
+ return string.substring(1);
197
+ }
198
+
199
+ return string;
200
+ }
201
+
202
+ var isLoaded = false;
203
+ function loadGA (options) {
204
+ if (isLoaded) return;
205
+ isLoaded = true;
206
+ var gaAddress = 'https://www.google-analytics.com/analytics.js';
207
+
208
+ if (options && options.gaAddress) {
209
+ gaAddress = options.gaAddress;
210
+ } else if (options && options.debug) {
211
+ gaAddress = 'https://www.google-analytics.com/analytics_debug.js';
212
+ }
213
+
214
+ var onerror = options && options.onerror; // https://developers.google.com/analytics/devguides/collection/analyticsjs/
215
+
216
+ /* eslint-disable */
217
+
218
+ (function (i, s, o, g, r, a, m) {
219
+ i['GoogleAnalyticsObject'] = r;
220
+ i[r] = i[r] || function () {
221
+ (i[r].q = i[r].q || []).push(arguments);
222
+ }, i[r].l = 1 * new Date();
223
+ a = s.createElement(o), m = s.getElementsByTagName(o)[0];
224
+ a.async = 1;
225
+ a.src = g;
226
+ a.onerror = onerror;
227
+ m.parentNode.insertBefore(a, m);
228
+ })(window, document, 'script', gaAddress, 'ga');
229
+ /* eslint-enable */
230
+
231
+ }
232
+
233
+ function log(s) {
234
+ console.info('[react-ga]', s);
235
+ }
236
+
237
+ var gaCalls = [];
238
+ var TestModeAPI = {
239
+ calls: gaCalls,
240
+ ga: function ga() {
241
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
242
+ args[_key] = arguments[_key];
243
+ }
244
+
245
+ gaCalls.push([].concat(args));
246
+ },
247
+ resetCalls: function resetCalls() {
248
+ gaCalls.length = 0;
249
+ }
250
+ };
251
+
252
+ function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
253
+
254
+ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
255
+
256
+ function ownKeys$1(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
257
+
258
+ function _objectSpread$1(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys$1(Object(source), true).forEach(function (key) { _defineProperty$1(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys$1(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
259
+
260
+ function _defineProperty$1(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
261
+
262
+ function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
263
+
264
+ function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
265
+
266
+ function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
267
+
268
+ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
269
+
270
+ function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && Symbol.iterator in Object(iter)) return Array.from(iter); }
271
+
272
+ function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
273
+
274
+ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
275
+
276
+ var _isNotBrowser = typeof window === 'undefined' || typeof document === 'undefined';
277
+
278
+ var _debug = false;
279
+ var _titleCase = true;
280
+ var _testMode = false;
281
+ var _alwaysSendToDefaultTracker = true;
282
+ var _redactEmail = true;
283
+
284
+ var internalGa = function internalGa() {
285
+ var _window;
286
+
287
+ if (_testMode) return TestModeAPI.ga.apply(TestModeAPI, arguments);
288
+ if (_isNotBrowser) return false;
289
+ if (!window.ga) return warn('ReactGA.initialize must be called first or GoogleAnalytics should be loaded manually');
290
+ return (_window = window).ga.apply(_window, arguments);
291
+ };
292
+
293
+ function _format(s) {
294
+ return format(s, _titleCase, _redactEmail);
295
+ }
296
+
297
+ function _gaCommand(trackerNames) {
298
+ for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
299
+ args[_key - 1] = arguments[_key];
300
+ }
301
+
302
+ var command = args[0];
303
+
304
+ if (typeof internalGa === 'function') {
305
+ if (typeof command !== 'string') {
306
+ warn('ga command must be a string');
307
+ return;
308
+ }
309
+
310
+ if (_alwaysSendToDefaultTracker || !Array.isArray(trackerNames)) internalGa.apply(void 0, args);
311
+
312
+ if (Array.isArray(trackerNames)) {
313
+ trackerNames.forEach(function (name) {
314
+ internalGa.apply(void 0, _toConsumableArray(["".concat(name, ".").concat(command)].concat(args.slice(1))));
315
+ });
316
+ }
317
+ }
318
+ }
319
+
320
+ function _initialize(gaTrackingID, options) {
321
+ if (!gaTrackingID) {
322
+ warn('gaTrackingID is required in initialize()');
323
+ return;
324
+ }
325
+
326
+ if (options) {
327
+ if (options.debug && options.debug === true) {
328
+ _debug = true;
329
+ }
330
+
331
+ if (options.titleCase === false) {
332
+ _titleCase = false;
333
+ }
334
+
335
+ if (options.redactEmail === false) {
336
+ _redactEmail = false;
337
+ }
338
+
339
+ if (options.useExistingGa) {
340
+ return;
341
+ }
342
+ }
343
+
344
+ if (options && options.gaOptions) {
345
+ internalGa('create', gaTrackingID, options.gaOptions);
346
+ } else {
347
+ internalGa('create', gaTrackingID, 'auto');
348
+ }
349
+ }
350
+
351
+ function addTrackers(configsOrTrackingId, options) {
352
+ if (Array.isArray(configsOrTrackingId)) {
353
+ configsOrTrackingId.forEach(function (config) {
354
+ if (_typeof(config) !== 'object') {
355
+ warn('All configs must be an object');
356
+ return;
357
+ }
358
+
359
+ _initialize(config.trackingId, config);
360
+ });
361
+ } else {
362
+ _initialize(configsOrTrackingId, options);
363
+ }
364
+
365
+ return true;
366
+ }
367
+ function initialize(configsOrTrackingId, options) {
368
+ if (options && options.testMode === true) {
369
+ _testMode = true;
370
+ } else {
371
+ if (_isNotBrowser) {
372
+ return;
373
+ }
374
+
375
+ if (!options || options.standardImplementation !== true) loadGA(options);
376
+ }
377
+
378
+ _alwaysSendToDefaultTracker = options && typeof options.alwaysSendToDefaultTracker === 'boolean' ? options.alwaysSendToDefaultTracker : true;
379
+ addTrackers(configsOrTrackingId, options);
380
+ }
381
+ /**
382
+ * ga:
383
+ * Returns the original GA object.
384
+ */
385
+
386
+ function ga() {
387
+ for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
388
+ args[_key2] = arguments[_key2];
389
+ }
390
+
391
+ if (args.length > 0) {
392
+ internalGa.apply(void 0, args);
393
+
394
+ if (_debug) {
395
+ log("called ga('arguments');");
396
+ log("with arguments: ".concat(JSON.stringify(args)));
397
+ }
398
+ }
399
+
400
+ return window.ga;
401
+ }
402
+ /**
403
+ * set:
404
+ * GA tracker set method
405
+ * @param {Object} fieldsObject - a field/value pair or a group of field/value pairs on the tracker
406
+ * @param {Array} trackerNames - (optional) a list of extra trackers to run the command on
407
+ */
408
+
409
+ function set(fieldsObject, trackerNames) {
410
+ if (!fieldsObject) {
411
+ warn('`fieldsObject` is required in .set()');
412
+ return;
413
+ }
414
+
415
+ if (_typeof(fieldsObject) !== 'object') {
416
+ warn('Expected `fieldsObject` arg to be an Object');
417
+ return;
418
+ }
419
+
420
+ if (Object.keys(fieldsObject).length === 0) {
421
+ warn('empty `fieldsObject` given to .set()');
422
+ }
423
+
424
+ _gaCommand(trackerNames, 'set', fieldsObject);
425
+
426
+ if (_debug) {
427
+ log("called ga('set', fieldsObject);");
428
+ log("with fieldsObject: ".concat(JSON.stringify(fieldsObject)));
429
+ }
430
+ }
431
+ /**
432
+ * send:
433
+ * Clone of the low level `ga.send` method
434
+ * WARNING: No validations will be applied to this
435
+ * @param {Object} fieldObject - field object for tracking different analytics
436
+ * @param {Array} trackerNames - trackers to send the command to
437
+ * @param {Array} trackerNames - (optional) a list of extra trackers to run the command on
438
+ */
439
+
440
+ function send(fieldObject, trackerNames) {
441
+ _gaCommand(trackerNames, 'send', fieldObject);
442
+
443
+ if (_debug) {
444
+ log("called ga('send', fieldObject);");
445
+ log("with fieldObject: ".concat(JSON.stringify(fieldObject)));
446
+ log("with trackers: ".concat(JSON.stringify(trackerNames)));
447
+ }
448
+ }
449
+ /**
450
+ * pageview:
451
+ * Basic GA pageview tracking
452
+ * @param {String} path - the current page page e.g. '/about'
453
+ * @param {Array} trackerNames - (optional) a list of extra trackers to run the command on
454
+ * @param {String} title - (optional) the page title e. g. 'My Website'
455
+ */
456
+
457
+ function pageview(rawPath, trackerNames, title) {
458
+ if (!rawPath) {
459
+ warn('path is required in .pageview()');
460
+ return;
461
+ }
462
+
463
+ var path = trim(rawPath);
464
+
465
+ if (path === '') {
466
+ warn('path cannot be an empty string in .pageview()');
467
+ return;
468
+ }
469
+
470
+ var extraFields = {};
471
+
472
+ if (title) {
473
+ extraFields.title = title;
474
+ }
475
+
476
+ if (typeof ga === 'function') {
477
+ _gaCommand(trackerNames, 'send', _objectSpread$1({
478
+ hitType: 'pageview',
479
+ page: path
480
+ }, extraFields));
481
+
482
+ if (_debug) {
483
+ log("called ga('send', 'pageview', path);");
484
+ var extraLog = '';
485
+
486
+ if (title) {
487
+ extraLog = " and title: ".concat(title);
488
+ }
489
+
490
+ log("with path: ".concat(path).concat(extraLog));
491
+ }
492
+ }
493
+ }
494
+ /**
495
+ * modalview:
496
+ * a proxy to basic GA pageview tracking to consistently track
497
+ * modal views that are an equivalent UX to a traditional pageview
498
+ * @param {String} modalName e.g. 'add-or-edit-club'
499
+ * @param {Array} trackerNames - (optional) a list of extra trackers to run the command on
500
+ */
501
+
502
+ function modalview(rawModalName, trackerNames) {
503
+ if (!rawModalName) {
504
+ warn('modalName is required in .modalview(modalName)');
505
+ return;
506
+ }
507
+
508
+ var modalName = removeLeadingSlash(trim(rawModalName));
509
+
510
+ if (modalName === '') {
511
+ warn('modalName cannot be an empty string or a single / in .modalview()');
512
+ return;
513
+ }
514
+
515
+ if (typeof ga === 'function') {
516
+ var path = "/modal/".concat(modalName);
517
+
518
+ _gaCommand(trackerNames, 'send', 'pageview', path);
519
+
520
+ if (_debug) {
521
+ log("called ga('send', 'pageview', path);");
522
+ log("with path: ".concat(path));
523
+ }
524
+ }
525
+ }
526
+ /**
527
+ * timing:
528
+ * GA timing
529
+ * @param args.category {String} required
530
+ * @param args.variable {String} required
531
+ * @param args.value {Int} required
532
+ * @param args.label {String} required
533
+ * @param {Array} trackerNames - (optional) a list of extra trackers to run the command on
534
+ */
535
+
536
+ function timing() {
537
+ var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
538
+ category = _ref.category,
539
+ variable = _ref.variable,
540
+ value = _ref.value,
541
+ label = _ref.label;
542
+
543
+ var trackerNames = arguments.length > 1 ? arguments[1] : undefined;
544
+
545
+ if (typeof ga === 'function') {
546
+ if (!category || !variable || typeof value !== 'number') {
547
+ warn('args.category, args.variable ' + 'AND args.value are required in timing() ' + 'AND args.value has to be a number');
548
+ return;
549
+ } // Required Fields
550
+
551
+
552
+ var fieldObject = {
553
+ hitType: 'timing',
554
+ timingCategory: _format(category),
555
+ timingVar: _format(variable),
556
+ timingValue: value
557
+ };
558
+
559
+ if (label) {
560
+ fieldObject.timingLabel = _format(label);
561
+ }
562
+
563
+ send(fieldObject, trackerNames);
564
+ }
565
+ }
566
+ /**
567
+ * event:
568
+ * GA event tracking
569
+ * @param args.category {String} required
570
+ * @param args.action {String} required
571
+ * @param args.label {String} optional
572
+ * @param args.value {Int} optional
573
+ * @param args.nonInteraction {boolean} optional
574
+ * @param args.transport {string} optional
575
+ * @param {{action: string, category: string}} trackerNames - (optional) a list of extra trackers to run the command on
576
+ */
577
+
578
+ function event() {
579
+ var _ref2 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
580
+ category = _ref2.category,
581
+ action = _ref2.action,
582
+ label = _ref2.label,
583
+ value = _ref2.value,
584
+ nonInteraction = _ref2.nonInteraction,
585
+ transport = _ref2.transport,
586
+ args = _objectWithoutProperties(_ref2, ["category", "action", "label", "value", "nonInteraction", "transport"]);
587
+
588
+ var trackerNames = arguments.length > 1 ? arguments[1] : undefined;
589
+
590
+ if (typeof ga === 'function') {
591
+ // Simple Validation
592
+ if (!category || !action) {
593
+ warn('args.category AND args.action are required in event()');
594
+ return;
595
+ } // Required Fields
596
+
597
+
598
+ var fieldObject = {
599
+ hitType: 'event',
600
+ eventCategory: _format(category),
601
+ eventAction: _format(action)
602
+ }; // Optional Fields
603
+
604
+ if (label) {
605
+ fieldObject.eventLabel = _format(label);
606
+ }
607
+
608
+ if (typeof value !== 'undefined') {
609
+ if (typeof value !== 'number') {
610
+ warn('Expected `args.value` arg to be a Number.');
611
+ } else {
612
+ fieldObject.eventValue = value;
613
+ }
614
+ }
615
+
616
+ if (typeof nonInteraction !== 'undefined') {
617
+ if (typeof nonInteraction !== 'boolean') {
618
+ warn('`args.nonInteraction` must be a boolean.');
619
+ } else {
620
+ fieldObject.nonInteraction = nonInteraction;
621
+ }
622
+ }
623
+
624
+ if (typeof transport !== 'undefined') {
625
+ if (typeof transport !== 'string') {
626
+ warn('`args.transport` must be a string.');
627
+ } else {
628
+ if (['beacon', 'xhr', 'image'].indexOf(transport) === -1) {
629
+ warn('`args.transport` must be either one of these values: `beacon`, `xhr` or `image`');
630
+ }
631
+
632
+ fieldObject.transport = transport;
633
+ }
634
+ }
635
+
636
+ Object.keys(args).filter(function (key) {
637
+ return key.substr(0, 'dimension'.length) === 'dimension';
638
+ }).forEach(function (key) {
639
+ fieldObject[key] = args[key];
640
+ });
641
+ Object.keys(args).filter(function (key) {
642
+ return key.substr(0, 'metric'.length) === 'metric';
643
+ }).forEach(function (key) {
644
+ fieldObject[key] = args[key];
645
+ }); // Send to GA
646
+
647
+ send(fieldObject, trackerNames);
648
+ }
649
+ }
650
+ /**
651
+ * exception:
652
+ * GA exception tracking
653
+ * @param args.description {String} optional
654
+ * @param args.fatal {boolean} optional
655
+ * @param {Array} trackerNames - (optional) a list of extra trackers to run the command on
656
+ */
657
+
658
+ function exception(_ref3, trackerNames) {
659
+ var description = _ref3.description,
660
+ fatal = _ref3.fatal;
661
+
662
+ if (typeof ga === 'function') {
663
+ // Required Fields
664
+ var fieldObject = {
665
+ hitType: 'exception'
666
+ }; // Optional Fields
667
+
668
+ if (description) {
669
+ fieldObject.exDescription = _format(description);
670
+ }
671
+
672
+ if (typeof fatal !== 'undefined') {
673
+ if (typeof fatal !== 'boolean') {
674
+ warn('`args.fatal` must be a boolean.');
675
+ } else {
676
+ fieldObject.exFatal = fatal;
677
+ }
678
+ } // Send to GA
679
+
680
+
681
+ send(fieldObject, trackerNames);
682
+ }
683
+ }
684
+ var plugin = {
685
+ /**
686
+ * require:
687
+ * GA requires a plugin
688
+ * @param name {String} e.g. 'ecommerce' or 'myplugin'
689
+ * @param options {Object} optional e.g {path: '/log', debug: true}
690
+ * @param trackerName {String} optional e.g 'trackerName'
691
+ */
692
+ require: function require(rawName, options, trackerName) {
693
+ if (typeof ga === 'function') {
694
+ // Required Fields
695
+ if (!rawName) {
696
+ warn('`name` is required in .require()');
697
+ return;
698
+ }
699
+
700
+ var name = trim(rawName);
701
+
702
+ if (name === '') {
703
+ warn('`name` cannot be an empty string in .require()');
704
+ return;
705
+ }
706
+
707
+ var requireString = trackerName ? "".concat(trackerName, ".require") : 'require'; // Optional Fields
708
+
709
+ if (options) {
710
+ if (_typeof(options) !== 'object') {
711
+ warn('Expected `options` arg to be an Object');
712
+ return;
713
+ }
714
+
715
+ if (Object.keys(options).length === 0) {
716
+ warn('Empty `options` given to .require()');
717
+ }
718
+
719
+ ga(requireString, name, options);
720
+
721
+ if (_debug) {
722
+ log("called ga('require', '".concat(name, "', ").concat(JSON.stringify(options)));
723
+ }
724
+ } else {
725
+ ga(requireString, name);
726
+
727
+ if (_debug) {
728
+ log("called ga('require', '".concat(name, "');"));
729
+ }
730
+ }
731
+ }
732
+ },
733
+
734
+ /**
735
+ * execute:
736
+ * GA execute action for plugin
737
+ * Takes variable number of arguments
738
+ * @param pluginName {String} e.g. 'ecommerce' or 'myplugin'
739
+ * @param action {String} e.g. 'addItem' or 'myCustomAction'
740
+ * @param actionType {String} optional e.g. 'detail'
741
+ * @param payload {Object} optional e.g { id: '1x5e', name : 'My product to track' }
742
+ */
743
+ execute: function execute(pluginName, action) {
744
+ var payload;
745
+ var actionType;
746
+
747
+ for (var _len3 = arguments.length, args = new Array(_len3 > 2 ? _len3 - 2 : 0), _key3 = 2; _key3 < _len3; _key3++) {
748
+ args[_key3 - 2] = arguments[_key3];
749
+ }
750
+
751
+ if (args.length === 1) {
752
+ payload = args[0];
753
+ } else {
754
+ actionType = args[0];
755
+ payload = args[1];
756
+ }
757
+
758
+ if (typeof ga === 'function') {
759
+ if (typeof pluginName !== 'string') {
760
+ warn('Expected `pluginName` arg to be a String.');
761
+ } else if (typeof action !== 'string') {
762
+ warn('Expected `action` arg to be a String.');
763
+ } else {
764
+ var command = "".concat(pluginName, ":").concat(action);
765
+ payload = payload || null;
766
+
767
+ if (actionType && payload) {
768
+ ga(command, actionType, payload);
769
+
770
+ if (_debug) {
771
+ log("called ga('".concat(command, "');"));
772
+ log("actionType: \"".concat(actionType, "\" with payload: ").concat(JSON.stringify(payload)));
773
+ }
774
+ } else if (payload) {
775
+ ga(command, payload);
776
+
777
+ if (_debug) {
778
+ log("called ga('".concat(command, "');"));
779
+ log("with payload: ".concat(JSON.stringify(payload)));
780
+ }
781
+ } else {
782
+ ga(command);
783
+
784
+ if (_debug) {
785
+ log("called ga('".concat(command, "');"));
786
+ }
787
+ }
788
+ }
789
+ }
790
+ }
791
+ };
792
+ /**
793
+ * outboundLink:
794
+ * GA outboundLink tracking
795
+ * @param args.label {String} e.g. url, or 'Create an Account'
796
+ * @param {function} hitCallback - Called after processing a hit.
797
+ */
798
+
799
+ function outboundLink(args, hitCallback, trackerNames) {
800
+ if (typeof hitCallback !== 'function') {
801
+ warn('hitCallback function is required');
802
+ return;
803
+ }
804
+
805
+ if (typeof ga === 'function') {
806
+ // Simple Validation
807
+ if (!args || !args.label) {
808
+ warn('args.label is required in outboundLink()');
809
+ return;
810
+ } // Required Fields
811
+
812
+
813
+ var fieldObject = {
814
+ hitType: 'event',
815
+ eventCategory: 'Outbound',
816
+ eventAction: 'Click',
817
+ eventLabel: _format(args.label)
818
+ };
819
+ var safetyCallbackCalled = false;
820
+
821
+ var safetyCallback = function safetyCallback() {
822
+ // This prevents a delayed response from GA
823
+ // causing hitCallback from being fired twice
824
+ safetyCallbackCalled = true;
825
+ hitCallback();
826
+ }; // Using a timeout to ensure the execution of critical application code
827
+ // in the case when the GA server might be down
828
+ // or an ad blocker prevents sending the data
829
+ // register safety net timeout:
830
+
831
+
832
+ var t = setTimeout(safetyCallback, 250);
833
+
834
+ var clearableCallbackForGA = function clearableCallbackForGA() {
835
+ clearTimeout(t);
836
+
837
+ if (!safetyCallbackCalled) {
838
+ hitCallback();
839
+ }
840
+ };
841
+
842
+ fieldObject.hitCallback = clearableCallbackForGA; // Send to GA
843
+
844
+ send(fieldObject, trackerNames);
845
+ } else {
846
+ // if ga is not defined, return the callback so the application
847
+ // continues to work as expected
848
+ setTimeout(hitCallback, 0);
849
+ }
850
+ }
851
+ var testModeAPI = TestModeAPI;
852
+ var core = {
853
+ initialize: initialize,
854
+ ga: ga,
855
+ set: set,
856
+ send: send,
857
+ pageview: pageview,
858
+ modalview: modalview,
859
+ timing: timing,
860
+ event: event,
861
+ exception: exception,
862
+ plugin: plugin,
863
+ outboundLink: outboundLink,
864
+ testModeAPI: TestModeAPI
865
+ };
866
+
867
+ var Defaults = /*#__PURE__*/Object.freeze({
868
+ __proto__: null,
869
+ addTrackers: addTrackers,
870
+ initialize: initialize,
871
+ ga: ga,
872
+ set: set,
873
+ send: send,
874
+ pageview: pageview,
875
+ modalview: modalview,
876
+ timing: timing,
877
+ event: event,
878
+ exception: exception,
879
+ plugin: plugin,
880
+ outboundLink: outboundLink,
881
+ testModeAPI: testModeAPI,
882
+ 'default': core
883
+ });
884
+
885
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
886
+
887
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
888
+
889
+ function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
890
+ OutboundLink$1.origTrackLink = OutboundLink$1.trackLink;
891
+ OutboundLink$1.trackLink = outboundLink;
892
+ var OutboundLink = OutboundLink$1;
893
+ var ReactGA = _objectSpread(_objectSpread({}, Defaults), {}, {
894
+ OutboundLink: OutboundLink
895
+ });
896
+
897
+ export { ReactGA as R };