@scrippsproduct/networks-ui-library 2.0.8 → 2.0.9

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 (98) hide show
  1. package/dist/components/ActionButton/ActionButton.test.js +3 -3
  2. package/dist/components/AdBlock/AdBlock.test.js +2 -2
  3. package/dist/components/AdjustableTwoColumnGrid/AdjustableTwoColumnGrid.test.js +2 -2
  4. package/dist/components/AirDateFormatter/AirDateFormatter.test.js +2 -2
  5. package/dist/components/AnchorTag/AnchorTag.test.js +3 -3
  6. package/dist/components/BCVideoPlayer/BCVideoPlayer.test.js +2 -2
  7. package/dist/components/BasicGridModule/BasicGridModule.test.js +2 -2
  8. package/dist/components/Button/Button.test.js +3 -3
  9. package/dist/components/ButtonAnchor/ButtonAnchor.test.js +3 -3
  10. package/dist/components/Carousel/Carousel.suspense-regression.test.js +2 -2
  11. package/dist/components/Carousel/Carousel.test.js +2 -2
  12. package/dist/components/Carousel/navigations/Pagination.test.js +2 -2
  13. package/dist/components/CarouselSlide/CarouselSlide.test.js +2 -2
  14. package/dist/components/CarouselSlide/slide-layouts/TwoColumn/TwoColumnSlide.js +1 -1
  15. package/dist/components/CastInfoLayout/CastInfoLayout.test.js +2 -2
  16. package/dist/components/ChannelSearch/ChannelSearch.test.js +2 -2
  17. package/dist/components/ChoicesItem/ChoicesItem.test.js +2 -2
  18. package/dist/components/Concat/Concat.js +1 -1
  19. package/dist/components/Concat/Concat.test.js +2 -2
  20. package/dist/components/CtaBlock/CtaBlock.js +1 -1
  21. package/dist/components/CtaBlock/CtaBlock.test.js +3 -3
  22. package/dist/components/CustomSelect/CustomSelect.test.js +3 -3
  23. package/dist/components/DateNavigation/DateNavigation.test.js +3 -3
  24. package/dist/components/DatePicker/DatePicker.js +2309 -2324
  25. package/dist/components/DeviceAndPlatformLists/DeviceAndPlatformLists.test.js +2 -2
  26. package/dist/components/DrawerNavigation/DrawerNavigation.test.js +3 -3
  27. package/dist/components/EqualSizeFlexRow/EqualSizeFlexRow.test.js +2 -2
  28. package/dist/components/EqualSizeGrid/EqualSizeGrid.test.js +2 -2
  29. package/dist/components/ErrorHandler/ErrorHandler.js +1 -1
  30. package/dist/components/ErrorHandler/ErrorHandler.test.js +2 -2
  31. package/dist/components/FeaturedList/FeaturedList.test.js +3 -3
  32. package/dist/components/Figure/Figure.js +1 -1
  33. package/dist/components/Figure/Figure.test.js +2 -2
  34. package/dist/components/FindUs/FindUs.test.js +2 -2
  35. package/dist/components/FooterNavigation/FooterNavigation.test.js +2 -2
  36. package/dist/components/GenericList/GenericList.js +1 -1
  37. package/dist/components/GenericList/GenericList.test.js +2 -2
  38. package/dist/components/GetAirdateWrapper/GetAirdateWrapper.test.js +2 -2
  39. package/dist/components/GradientButton/GradientButton.test.js +2 -2
  40. package/dist/components/GridList/GridList.test.js +1 -1
  41. package/dist/components/ImageCard/ImageCard.test.js +2 -2
  42. package/dist/components/ImageCard/ImageCardCore.js +1 -1
  43. package/dist/components/ImageCard/ImageCardCore.test.js +2 -2
  44. package/dist/components/ImageReplacementAnchor/ImageReplacementAnchor.test.js +1 -1
  45. package/dist/components/InlineNavigation/InlineNavigation.test.js +1 -1
  46. package/dist/components/Input/Input.test.js +2 -2
  47. package/dist/components/InstructionsList/InstructionsList.js +1 -1
  48. package/dist/components/InstructionsList/InstructionsList.test.js +1 -1
  49. package/dist/components/LogoListItem/LogoListItem.test.js +1 -1
  50. package/dist/components/LogoNavigation/LogoNavigation.test.js +1 -1
  51. package/dist/components/ModalContainer/ModalContainer.js +1 -1
  52. package/dist/components/NavList/NavList.test.js +2 -2
  53. package/dist/components/Overlay/Overlay.js +1 -1
  54. package/dist/components/Overlay/Overlay.test.js +1 -1
  55. package/dist/components/PageHero/PageHero.test.js +1 -1
  56. package/dist/components/PageHero/page-hero-layouts/IONShow/IONShowHero.js +1 -1
  57. package/dist/components/ProgramAirdate/ProgramAirdate.js +1 -1
  58. package/dist/components/ProgramAirdate/ProgramAirdate.test.js +1 -1
  59. package/dist/components/PromotionsRowBlock/PromotionsRowBlock.test.js +2 -2
  60. package/dist/components/PromotionsRowModule/PromotionsRowModule.js +1 -1
  61. package/dist/components/PromotionsRowModule/PromotionsRowModule.test.js +2 -2
  62. package/dist/components/RescanInstructions/RescanInstructions.test.js +1 -1
  63. package/dist/components/ResponsiveImage/ResponsiveImage.test.js +2 -2
  64. package/dist/components/ResultsTable/ResultsTable.test.js +1 -1
  65. package/dist/components/ResultsTableBody/ResultsTableBody.test.js +1 -1
  66. package/dist/components/ResultsTableHeader/ResultsTableHeader.test.js +1 -1
  67. package/dist/components/ScheduleLayout/ScheduleContext.js +1893 -1123
  68. package/dist/components/SectionedContent/SectionedContent.js +1 -1
  69. package/dist/components/SectionedContent/SectionedContent.test.js +2 -2
  70. package/dist/components/Select/Select.test.js +2 -2
  71. package/dist/components/ShowAboutContent/ShowAboutContent.js +1 -1
  72. package/dist/components/ShowAboutContent/ShowAboutContent.test.js +2 -2
  73. package/dist/components/ShowAboutLayout/ShowAboutLayout.test.js +2 -2
  74. package/dist/components/StringList/StringList.js +1 -1
  75. package/dist/components/StringList/StringList.test.js +1 -1
  76. package/dist/components/TabContent/TabContent.js +1 -1
  77. package/dist/components/TabContent/TabContent.test.js +1 -1
  78. package/dist/components/TabNavigation/TabNavigation.test.js +1 -1
  79. package/dist/components/TabbedContent/TabbedContent.test.js +1 -1
  80. package/dist/components/UpcomingList/UpcomingList.test.js +2 -2
  81. package/dist/index-BCErBUQT.mjs +3 -0
  82. package/dist/{index-sxnwPHiC.mjs → index-CHzqLQze.mjs} +181 -166
  83. package/dist/index-DnEp_Vsr.mjs +3085 -0
  84. package/dist/{index-5kXULIVv.mjs → index-DrfkaNHX.mjs} +16 -16
  85. package/dist/{magic-string.es-uPKorP4O.mjs → magic-string.es-DDAFx1CP.mjs} +93 -93
  86. package/dist/matchers-35e4d3bd-CfhTZpyY.mjs +2572 -0
  87. package/dist/react.esm-CX7MGXBg.mjs +52738 -0
  88. package/dist/src/icons/Facebook.d.ts +2 -1
  89. package/dist/src/icons/Tiktok.d.ts +2 -1
  90. package/dist/src/icons/Twitter.d.ts +2 -1
  91. package/dist/src/utils/analytics.d.ts +24 -5
  92. package/dist/test/setupTests.js +2 -2
  93. package/dist/utils/analytics.js +247 -446
  94. package/package.json +3 -3
  95. package/dist/index-B03xsUba.mjs +0 -3
  96. package/dist/index-C-uizG4-.mjs +0 -3098
  97. package/dist/matchers-35e4d3bd-BckKR3wh.mjs +0 -2404
  98. package/dist/react.esm-CUNRDkfQ.mjs +0 -49632
@@ -1,469 +1,270 @@
1
- import { g as $ } from "../_commonjsHelpers-DaMA6jEr.mjs";
2
- var E = {}, q = {}, T = {}, Q;
3
- function ee() {
4
- return Q || (Q = 1, (function(g) {
5
- Object.defineProperty(g, "__esModule", {
6
- value: !0
7
- }), g.default = void 0;
8
- var h = function() {
9
- for (var b = arguments.length, A = new Array(b), w = 0; w < b; w++)
10
- A[w] = arguments[w];
11
- if (typeof window < "u") {
12
- var o;
13
- typeof window.gtag > "u" && (window.dataLayer = window.dataLayer || [], window.gtag = function() {
14
- window.dataLayer.push(arguments);
15
- }), (o = window).gtag.apply(o, A);
16
- }
17
- }, y = h;
18
- g.default = y;
19
- })(T)), T;
1
+ var h = Object.defineProperty;
2
+ var f = (e, t, n) => t in e ? h(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
3
+ var o = (e, t, n) => f(e, typeof t != "symbol" ? t + "" : t, n);
4
+ const p = (...e) => {
5
+ typeof window < "u" && (typeof window.gtag > "u" && (window.dataLayer = window.dataLayer || [], window.gtag = function() {
6
+ window.dataLayer.push(arguments);
7
+ }), window.gtag(...e));
8
+ }, m = /^(a|an|and|as|at|but|by|en|for|if|in|nor|of|on|or|per|the|to|vs?\.?|via)$/i;
9
+ function w(e) {
10
+ return e.toString().trim().replace(/[A-Za-z0-9\u00C0-\u00FF]+[^\s-]*/g, (t, n, i) => n > 0 && n + t.length !== i.length && t.search(m) > -1 && i.charAt(n - 2) !== ":" && (i.charAt(n + t.length) !== "-" || i.charAt(n - 1) === "-") && i.charAt(n - 1).search(/[^\s-]/) < 0 ? t.toLowerCase() : t.substr(1).search(/[A-Z]|\../) > -1 ? t : t.charAt(0).toUpperCase() + t.substr(1));
20
11
  }
21
- var M = {}, U;
22
- function te() {
23
- return U || (U = 1, (function(g) {
24
- Object.defineProperty(g, "__esModule", {
25
- value: !0
26
- }), g.default = w;
27
- var h = /^(a|an|and|as|at|but|by|en|for|if|in|nor|of|on|or|per|the|to|vs?\.?|via)$/i;
28
- function y(o) {
29
- return o.toString().trim().replace(/[A-Za-z0-9\u00C0-\u00FF]+[^\s-]*/g, function(u, c, l) {
30
- return c > 0 && c + u.length !== l.length && u.search(h) > -1 && l.charAt(c - 2) !== ":" && (l.charAt(c + u.length) !== "-" || l.charAt(c - 1) === "-") && l.charAt(c - 1).search(/[^\s-]/) < 0 ? u.toLowerCase() : u.substr(1).search(/[A-Z]|\../) > -1 ? u : u.charAt(0).toUpperCase() + u.substr(1);
31
- });
32
- }
33
- function S(o) {
34
- return typeof o == "string" && o.indexOf("@") !== -1;
35
- }
36
- var b = "REDACTED (Potential Email Address)";
37
- function A(o) {
38
- return S(o) ? (console.warn("This arg looks like an email address, redacting."), b) : o;
39
- }
40
- function w() {
41
- var o = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : "", u = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : !0, c = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : !0, l = o || "";
42
- return u && (l = y(o)), c && (l = A(l)), l;
43
- }
44
- })(M)), M;
12
+ function v(e) {
13
+ return typeof e == "string" && e.indexOf("@") !== -1;
14
+ }
15
+ const y = "REDACTED (Potential Email Address)";
16
+ function b(e) {
17
+ return v(e) ? (console.warn("This arg looks like an email address, redacting."), y) : e;
45
18
  }
46
- var k;
47
- function ne() {
48
- return k || (k = 1, (function(g) {
49
- Object.defineProperty(g, "__esModule", {
50
- value: !0
51
- }), g.default = g.GA4 = void 0;
52
- var h = w(ee()), y = w(te()), S = ["eventCategory", "eventAction", "eventLabel", "eventValue", "hitType"], b = ["title", "location"], A = ["page", "hitType"];
53
- function w(r) {
54
- return r && r.__esModule ? r : { default: r };
55
- }
56
- function o(r, e) {
57
- if (r == null) return {};
58
- var t = u(r, e), n, a;
59
- if (Object.getOwnPropertySymbols) {
60
- var i = Object.getOwnPropertySymbols(r);
61
- for (a = 0; a < i.length; a++)
62
- n = i[a], !(e.indexOf(n) >= 0) && Object.prototype.propertyIsEnumerable.call(r, n) && (t[n] = r[n]);
19
+ function l(e = "", t = !0, n = !0) {
20
+ let i = e || "";
21
+ return t && (i = w(e)), n && (i = b(i)), i;
22
+ }
23
+ var C = class {
24
+ constructor() {
25
+ o(this, "isInitialized");
26
+ o(this, "_testMode");
27
+ o(this, "_currentMeasurementId");
28
+ o(this, "_hasLoadedGA");
29
+ o(this, "_isQueuing");
30
+ o(this, "_queueGtag");
31
+ o(this, "reset", () => {
32
+ this.isInitialized = !1, this._testMode = !1, this._currentMeasurementId = "", this._hasLoadedGA = !1, this._isQueuing = !1, this._queueGtag = [];
33
+ });
34
+ o(this, "_gtag", (...e) => {
35
+ this._testMode ? this._queueGtag.push(e) : this._isQueuing ? this._queueGtag.push(e) : p(...e);
36
+ });
37
+ o(this, "_loadGA", (e, t, n = "https://www.googletagmanager.com/gtag/js") => {
38
+ if (!(typeof window > "u" || typeof document > "u") && !this._hasLoadedGA) {
39
+ const i = document.createElement("script");
40
+ i.async = !0, i.src = `${n}?id=${e}`, t && i.setAttribute("nonce", t), document.body.appendChild(i), window.dataLayer = window.dataLayer || [], window.gtag = function() {
41
+ window.dataLayer.push(arguments);
42
+ }, this._hasLoadedGA = !0;
63
43
  }
64
- return t;
65
- }
66
- function u(r, e) {
67
- if (r == null) return {};
68
- var t = {}, n = Object.keys(r), a, i;
69
- for (i = 0; i < n.length; i++)
70
- a = n[i], !(e.indexOf(a) >= 0) && (t[a] = r[a]);
71
- return t;
72
- }
73
- function c(r) {
74
- "@babel/helpers - typeof";
75
- return c = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(e) {
76
- return typeof e;
77
- } : function(e) {
78
- return e && typeof Symbol == "function" && e.constructor === Symbol && e !== Symbol.prototype ? "symbol" : typeof e;
79
- }, c(r);
80
- }
81
- function l(r) {
82
- return P(r) || O(r) || L(r) || C();
83
- }
84
- function C() {
85
- throw new TypeError(`Invalid attempt to spread non-iterable instance.
86
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`);
87
- }
88
- function O(r) {
89
- if (typeof Symbol < "u" && r[Symbol.iterator] != null || r["@@iterator"] != null) return Array.from(r);
90
- }
91
- function P(r) {
92
- if (Array.isArray(r)) return I(r);
93
- }
94
- function D(r, e) {
95
- var t = Object.keys(r);
96
- if (Object.getOwnPropertySymbols) {
97
- var n = Object.getOwnPropertySymbols(r);
98
- e && (n = n.filter(function(a) {
99
- return Object.getOwnPropertyDescriptor(r, a).enumerable;
100
- })), t.push.apply(t, n);
44
+ });
45
+ o(this, "_toGtagOptions", (e) => {
46
+ if (!e) return;
47
+ const t = {
48
+ cookieUpdate: "cookie_update",
49
+ cookieExpires: "cookie_expires",
50
+ cookieDomain: "cookie_domain",
51
+ cookieFlags: "cookie_flags",
52
+ userId: "user_id",
53
+ clientId: "client_id",
54
+ anonymizeIp: "anonymize_ip",
55
+ contentGroup1: "content_group1",
56
+ contentGroup2: "content_group2",
57
+ contentGroup3: "content_group3",
58
+ contentGroup4: "content_group4",
59
+ contentGroup5: "content_group5",
60
+ allowAdFeatures: "allow_google_signals",
61
+ allowAdPersonalizationSignals: "allow_ad_personalization_signals",
62
+ nonInteraction: "non_interaction",
63
+ page: "page_path",
64
+ hitCallback: "event_callback"
65
+ };
66
+ return Object.entries(e).reduce((n, [i, a]) => (t[i] ? n[t[i]] = a : n[i] = a, n), {});
67
+ });
68
+ /**
69
+ *
70
+ * @param {InitOptions[]|string} GA_MEASUREMENT_ID
71
+ * @param {Object} [options]
72
+ * @param {string} [options.nonce]
73
+ * @param {boolean} [options.testMode=false]
74
+ * @param {string} [options.gtagUrl=https://www.googletagmanager.com/gtag/js]
75
+ * @param {GaOptions|any} [options.gaOptions]
76
+ * @param {Object} [options.gtagOptions] New parameter
77
+ */
78
+ o(this, "initialize", (e, t = {}) => {
79
+ if (!e) throw new Error("Require GA_MEASUREMENT_ID");
80
+ const n = typeof e == "string" ? [{ trackingId: e }] : e;
81
+ this._currentMeasurementId = n[0].trackingId;
82
+ const { gaOptions: i, gtagOptions: a, nonce: g, testMode: r = !1, gtagUrl: d } = t;
83
+ if (this._testMode = r, r || this._loadGA(this._currentMeasurementId, g, d), this.isInitialized || (this._gtag("js", /* @__PURE__ */ new Date()), n.forEach((s) => {
84
+ const c = {
85
+ ...this._toGtagOptions({
86
+ ...i,
87
+ ...s.gaOptions
88
+ }),
89
+ ...a,
90
+ ...s.gtagOptions
91
+ };
92
+ Object.keys(c).length ? this._gtag("config", s.trackingId, c) : this._gtag("config", s.trackingId);
93
+ })), this.isInitialized = !0, !r) {
94
+ const s = [...this._queueGtag];
95
+ for (this._queueGtag = [], this._isQueuing = !1; s.length; ) {
96
+ const c = s.shift();
97
+ this._gtag(...c), c[0] === "get" && (this._isQueuing = !0);
98
+ }
101
99
  }
102
- return t;
103
- }
104
- function _(r) {
105
- for (var e = 1; e < arguments.length; e++) {
106
- var t = arguments[e] != null ? arguments[e] : {};
107
- e % 2 ? D(Object(t), !0).forEach(function(n) {
108
- d(r, n, t[n]);
109
- }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(r, Object.getOwnPropertyDescriptors(t)) : D(Object(t)).forEach(function(n) {
110
- Object.defineProperty(r, n, Object.getOwnPropertyDescriptor(t, n));
111
- });
100
+ });
101
+ o(this, "set", (e) => {
102
+ if (!e) {
103
+ console.warn("`fieldsObject` is required in .set()");
104
+ return;
112
105
  }
113
- return r;
114
- }
115
- function x(r, e) {
116
- return K(r) || H(r, e) || L(r, e) || B();
117
- }
118
- function B() {
119
- throw new TypeError(`Invalid attempt to destructure non-iterable instance.
120
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`);
121
- }
122
- function L(r, e) {
123
- if (r) {
124
- if (typeof r == "string") return I(r, e);
125
- var t = Object.prototype.toString.call(r).slice(8, -1);
126
- if (t === "Object" && r.constructor && (t = r.constructor.name), t === "Map" || t === "Set") return Array.from(r);
127
- if (t === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)) return I(r, e);
106
+ if (typeof e != "object") {
107
+ console.warn("Expected `fieldsObject` arg to be an Object");
108
+ return;
128
109
  }
129
- }
130
- function I(r, e) {
131
- (e == null || e > r.length) && (e = r.length);
132
- for (var t = 0, n = new Array(e); t < e; t++) n[t] = r[t];
133
- return n;
134
- }
135
- function H(r, e) {
136
- var t = r == null ? null : typeof Symbol < "u" && r[Symbol.iterator] || r["@@iterator"];
137
- if (t != null) {
138
- var n, a, i, f, s = [], p = !0, m = !1;
139
- try {
140
- if (i = (t = t.call(r)).next, e !== 0) for (; !(p = (n = i.call(t)).done) && (s.push(n.value), s.length !== e); p = !0) ;
141
- } catch (v) {
142
- m = !0, a = v;
143
- } finally {
144
- try {
145
- if (!p && t.return != null && (f = t.return(), Object(f) !== f)) return;
146
- } finally {
147
- if (m) throw a;
148
- }
149
- }
150
- return s;
110
+ Object.keys(e).length === 0 && console.warn("empty `fieldsObject` given to .set()"), this._gaCommand("set", e);
111
+ });
112
+ o(this, "_gaCommandSendEvent", (e, t, n, i, a) => {
113
+ this._gtag("event", t, {
114
+ event_category: e,
115
+ event_label: n,
116
+ value: i,
117
+ ...a && { non_interaction: a.nonInteraction },
118
+ ...this._toGtagOptions(a)
119
+ });
120
+ });
121
+ o(this, "_gaCommandSendEventParameters", (...e) => {
122
+ if (typeof e[0] == "string") this._gaCommandSendEvent(...e.slice(1));
123
+ else {
124
+ const { eventCategory: t, eventAction: n, eventLabel: i, eventValue: a, hitType: g, ...r } = e[0];
125
+ this._gaCommandSendEvent(t, n, i, a, r);
151
126
  }
152
- }
153
- function K(r) {
154
- if (Array.isArray(r)) return r;
155
- }
156
- function Z(r, e) {
157
- if (!(r instanceof e))
158
- throw new TypeError("Cannot call a class as a function");
159
- }
160
- function J(r, e) {
161
- for (var t = 0; t < e.length; t++) {
162
- var n = e[t];
163
- n.enumerable = n.enumerable || !1, n.configurable = !0, "value" in n && (n.writable = !0), Object.defineProperty(r, R(n.key), n);
127
+ });
128
+ o(this, "_gaCommandSendTiming", (e, t, n, i) => {
129
+ this._gtag("event", "timing_complete", {
130
+ name: t,
131
+ value: n,
132
+ event_category: e,
133
+ event_label: i
134
+ });
135
+ });
136
+ o(this, "_gaCommandSendPageview", (e, t) => {
137
+ if (t && Object.keys(t).length) {
138
+ const { title: n, location: i, ...a } = this._toGtagOptions(t) || {};
139
+ this._gtag("event", "page_view", {
140
+ ...e && { page_path: e },
141
+ ...n && { page_title: n },
142
+ ...i && { page_location: i },
143
+ ...a
144
+ });
145
+ } else e ? this._gtag("event", "page_view", { page_path: e }) : this._gtag("event", "page_view");
146
+ });
147
+ o(this, "_gaCommandSendPageviewParameters", (...e) => {
148
+ if (typeof e[0] == "string") this._gaCommandSendPageview(...e.slice(1));
149
+ else {
150
+ const { page: t, hitType: n, ...i } = e[0];
151
+ this._gaCommandSendPageview(t, i);
164
152
  }
165
- }
166
- function X(r, e, t) {
167
- return e && J(r.prototype, e), Object.defineProperty(r, "prototype", { writable: !1 }), r;
168
- }
169
- function d(r, e, t) {
170
- return e = R(e), e in r ? Object.defineProperty(r, e, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : r[e] = t, r;
171
- }
172
- function R(r) {
173
- var e = Y(r, "string");
174
- return c(e) === "symbol" ? e : String(e);
175
- }
176
- function Y(r, e) {
177
- if (c(r) !== "object" || r === null) return r;
178
- var t = r[Symbol.toPrimitive];
179
- if (t !== void 0) {
180
- var n = t.call(r, e);
181
- if (c(n) !== "object") return n;
182
- throw new TypeError("@@toPrimitive must return a primitive value.");
153
+ });
154
+ o(this, "_gaCommandSend", (...e) => {
155
+ const t = typeof e[0] == "string" ? e[0] : e[0].hitType;
156
+ switch (t) {
157
+ case "event":
158
+ this._gaCommandSendEventParameters(...e);
159
+ break;
160
+ case "pageview":
161
+ this._gaCommandSendPageviewParameters(...e);
162
+ break;
163
+ case "timing":
164
+ this._gaCommandSendTiming(...e.slice(1));
165
+ break;
166
+ case "screenview":
167
+ case "transaction":
168
+ case "item":
169
+ case "social":
170
+ case "exception":
171
+ console.warn(`Unsupported send command: ${t}`);
172
+ break;
173
+ default:
174
+ console.warn(`Send command doesn't exist: ${t}`);
183
175
  }
184
- return (e === "string" ? String : Number)(r);
185
- }
186
- var z = /* @__PURE__ */ (function() {
187
- function r() {
188
- var e = this;
189
- Z(this, r), d(this, "reset", function() {
190
- e.isInitialized = !1, e._testMode = !1, e._currentMeasurementId, e._hasLoadedGA = !1, e._isQueuing = !1, e._queueGtag = [];
191
- }), d(this, "_gtag", function() {
192
- for (var t = arguments.length, n = new Array(t), a = 0; a < t; a++)
193
- n[a] = arguments[a];
194
- e._testMode || e._isQueuing ? e._queueGtag.push(n) : h.default.apply(void 0, n);
195
- }), d(this, "_loadGA", function(t, n) {
196
- var a = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : "https://www.googletagmanager.com/gtag/js";
197
- if (!(typeof window > "u" || typeof document > "u") && !e._hasLoadedGA) {
198
- var i = document.createElement("script");
199
- i.async = !0, i.src = "".concat(a, "?id=").concat(t), n && i.setAttribute("nonce", n), document.body.appendChild(i), window.dataLayer = window.dataLayer || [], window.gtag = function() {
200
- window.dataLayer.push(arguments);
201
- }, e._hasLoadedGA = !0;
202
- }
203
- }), d(this, "_toGtagOptions", function(t) {
204
- if (t) {
205
- var n = {
206
- // Old https://developers.google.com/analytics/devguides/collection/analyticsjs/field-reference#cookieUpdate
207
- // New https://developers.google.com/analytics/devguides/collection/gtagjs/cookies-user-id#cookie_update
208
- cookieUpdate: "cookie_update",
209
- cookieExpires: "cookie_expires",
210
- cookieDomain: "cookie_domain",
211
- cookieFlags: "cookie_flags",
212
- // must be in set method?
213
- userId: "user_id",
214
- clientId: "client_id",
215
- anonymizeIp: "anonymize_ip",
216
- // https://support.google.com/analytics/answer/2853546?hl=en#zippy=%2Cin-this-article
217
- contentGroup1: "content_group1",
218
- contentGroup2: "content_group2",
219
- contentGroup3: "content_group3",
220
- contentGroup4: "content_group4",
221
- contentGroup5: "content_group5",
222
- // https://support.google.com/analytics/answer/9050852?hl=en
223
- allowAdFeatures: "allow_google_signals",
224
- allowAdPersonalizationSignals: "allow_ad_personalization_signals",
225
- nonInteraction: "non_interaction",
226
- page: "page_path",
227
- hitCallback: "event_callback"
228
- }, a = Object.entries(t).reduce(function(i, f) {
229
- var s = x(f, 2), p = s[0], m = s[1];
230
- return n[p] ? i[n[p]] = m : i[p] = m, i;
231
- }, {});
232
- return a;
233
- }
234
- }), d(this, "initialize", function(t) {
235
- var n = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
236
- if (!t)
237
- throw new Error("Require GA_MEASUREMENT_ID");
238
- var a = typeof t == "string" ? [{
239
- trackingId: t
240
- }] : t;
241
- e._currentMeasurementId = a[0].trackingId;
242
- var i = n.gaOptions, f = n.gtagOptions, s = n.nonce, p = n.testMode, m = p === void 0 ? !1 : p, v = n.gtagUrl;
243
- if (e._testMode = m, m || e._loadGA(e._currentMeasurementId, s, v), e.isInitialized || (e._gtag("js", /* @__PURE__ */ new Date()), a.forEach(function(G) {
244
- var F = _(_(_({}, e._toGtagOptions(_(_({}, i), G.gaOptions))), f), G.gtagOptions);
245
- Object.keys(F).length ? e._gtag("config", G.trackingId, F) : e._gtag("config", G.trackingId);
246
- })), e.isInitialized = !0, !m) {
247
- var j = l(e._queueGtag);
248
- for (e._queueGtag = [], e._isQueuing = !1; j.length; ) {
249
- var W = j.shift();
250
- e._gtag.apply(e, l(W)), W[0] === "get" && (e._isQueuing = !0);
251
- }
252
- }
253
- }), d(this, "set", function(t) {
254
- if (!t) {
255
- console.warn("`fieldsObject` is required in .set()");
256
- return;
257
- }
258
- if (c(t) !== "object") {
259
- console.warn("Expected `fieldsObject` arg to be an Object");
260
- return;
261
- }
262
- Object.keys(t).length === 0 && console.warn("empty `fieldsObject` given to .set()"), e._gaCommand("set", t);
263
- }), d(this, "_gaCommandSendEvent", function(t, n, a, i, f) {
264
- e._gtag("event", n, _(_({
265
- event_category: t,
266
- event_label: a,
267
- value: i
268
- }, f && {
269
- non_interaction: f.nonInteraction
270
- }), e._toGtagOptions(f)));
271
- }), d(this, "_gaCommandSendEventParameters", function() {
272
- for (var t = arguments.length, n = new Array(t), a = 0; a < t; a++)
273
- n[a] = arguments[a];
274
- if (typeof n[0] == "string")
275
- e._gaCommandSendEvent.apply(e, l(n.slice(1)));
276
- else {
277
- var i = n[0], f = i.eventCategory, s = i.eventAction, p = i.eventLabel, m = i.eventValue;
278
- i.hitType;
279
- var v = o(i, S);
280
- e._gaCommandSendEvent(f, s, p, m, v);
281
- }
282
- }), d(this, "_gaCommandSendTiming", function(t, n, a, i) {
283
- e._gtag("event", "timing_complete", {
284
- name: n,
285
- value: a,
286
- event_category: t,
287
- event_label: i
288
- });
289
- }), d(this, "_gaCommandSendPageview", function(t, n) {
290
- if (n && Object.keys(n).length) {
291
- var a = e._toGtagOptions(n), i = a.title, f = a.location, s = o(a, b);
292
- e._gtag("event", "page_view", _(_(_(_({}, t && {
293
- page_path: t
294
- }), i && {
295
- page_title: i
296
- }), f && {
297
- page_location: f
298
- }), s));
299
- } else t ? e._gtag("event", "page_view", {
300
- page_path: t
301
- }) : e._gtag("event", "page_view");
302
- }), d(this, "_gaCommandSendPageviewParameters", function() {
303
- for (var t = arguments.length, n = new Array(t), a = 0; a < t; a++)
304
- n[a] = arguments[a];
305
- if (typeof n[0] == "string")
306
- e._gaCommandSendPageview.apply(e, l(n.slice(1)));
307
- else {
308
- var i = n[0], f = i.page;
309
- i.hitType;
310
- var s = o(i, A);
311
- e._gaCommandSendPageview(f, s);
312
- }
313
- }), d(this, "_gaCommandSend", function() {
314
- for (var t = arguments.length, n = new Array(t), a = 0; a < t; a++)
315
- n[a] = arguments[a];
316
- var i = typeof n[0] == "string" ? n[0] : n[0].hitType;
317
- switch (i) {
318
- case "event":
319
- e._gaCommandSendEventParameters.apply(e, n);
320
- break;
321
- case "pageview":
322
- e._gaCommandSendPageviewParameters.apply(e, n);
323
- break;
324
- case "timing":
325
- e._gaCommandSendTiming.apply(e, l(n.slice(1)));
326
- break;
327
- case "screenview":
328
- case "transaction":
329
- case "item":
330
- case "social":
331
- case "exception":
332
- console.warn("Unsupported send command: ".concat(i));
333
- break;
334
- default:
335
- console.warn("Send command doesn't exist: ".concat(i));
336
- }
337
- }), d(this, "_gaCommandSet", function() {
338
- for (var t = arguments.length, n = new Array(t), a = 0; a < t; a++)
339
- n[a] = arguments[a];
340
- typeof n[0] == "string" && (n[0] = d({}, n[0], n[1])), e._gtag("set", e._toGtagOptions(n[0]));
341
- }), d(this, "_gaCommand", function(t) {
342
- for (var n = arguments.length, a = new Array(n > 1 ? n - 1 : 0), i = 1; i < n; i++)
343
- a[i - 1] = arguments[i];
344
- switch (t) {
345
- case "send":
346
- e._gaCommandSend.apply(e, a);
347
- break;
348
- case "set":
349
- e._gaCommandSet.apply(e, a);
350
- break;
351
- default:
352
- console.warn("Command doesn't exist: ".concat(t));
353
- }
354
- }), d(this, "ga", function() {
355
- for (var t = arguments.length, n = new Array(t), a = 0; a < t; a++)
356
- n[a] = arguments[a];
357
- if (typeof n[0] == "string")
358
- e._gaCommand.apply(e, n);
359
- else {
360
- var i = n[0];
361
- e._gtag("get", e._currentMeasurementId, "client_id", function(f) {
362
- e._isQueuing = !1;
363
- var s = e._queueGtag;
364
- for (i({
365
- get: function(v) {
366
- return v === "clientId" ? f : v === "trackingId" ? e._currentMeasurementId : v === "apiVersion" ? "1" : void 0;
367
- }
368
- }); s.length; ) {
369
- var p = s.shift();
370
- e._gtag.apply(e, l(p));
371
- }
372
- }), e._isQueuing = !0;
373
- }
374
- return e.ga;
375
- }), d(this, "event", function(t, n) {
376
- if (typeof t == "string")
377
- e._gtag("event", t, e._toGtagOptions(n));
378
- else {
379
- var a = t.action, i = t.category, f = t.label, s = t.value, p = t.nonInteraction, m = t.transport;
380
- if (!i || !a) {
381
- console.warn("args.category AND args.action are required in event()");
382
- return;
383
- }
384
- var v = {
385
- hitType: "event",
386
- eventCategory: (0, y.default)(i),
387
- eventAction: (0, y.default)(a)
388
- };
389
- f && (v.eventLabel = (0, y.default)(f)), typeof s < "u" && (typeof s != "number" ? console.warn("Expected `args.value` arg to be a Number.") : v.eventValue = s), typeof p < "u" && (typeof p != "boolean" ? console.warn("`args.nonInteraction` must be a boolean.") : v.nonInteraction = p), typeof m < "u" && (typeof m != "string" ? console.warn("`args.transport` must be a string.") : (["beacon", "xhr", "image"].indexOf(m) === -1 && console.warn("`args.transport` must be either one of these values: `beacon`, `xhr` or `image`"), v.transport = m)), e._gaCommand("send", v);
176
+ });
177
+ o(this, "_gaCommandSet", (...e) => {
178
+ typeof e[0] == "string" && (e[0] = { [e[0]]: e[1] }), this._gtag("set", this._toGtagOptions(e[0]));
179
+ });
180
+ o(this, "_gaCommand", (e, ...t) => {
181
+ switch (e) {
182
+ case "send":
183
+ this._gaCommandSend(...t);
184
+ break;
185
+ case "set":
186
+ this._gaCommandSet(...t);
187
+ break;
188
+ default:
189
+ console.warn(`Command doesn't exist: ${e}`);
190
+ }
191
+ });
192
+ o(this, "ga", (...e) => {
193
+ if (typeof e[0] == "string") this._gaCommand(...e);
194
+ else {
195
+ const [t] = e;
196
+ this._gtag("get", this._currentMeasurementId, "client_id", (n) => {
197
+ this._isQueuing = !1;
198
+ const i = this._queueGtag;
199
+ for (t({ get: (a) => a === "clientId" ? n : a === "trackingId" ? this._currentMeasurementId : a === "apiVersion" ? "1" : void 0 }); i.length; ) {
200
+ const a = i.shift();
201
+ this._gtag(...a);
390
202
  }
391
- }), d(this, "send", function(t) {
392
- e._gaCommand("send", t);
393
- }), this.reset();
203
+ }), this._isQueuing = !0;
394
204
  }
395
- return X(r, [{
396
- key: "gtag",
397
- value: function() {
398
- this._gtag.apply(this, arguments);
399
- }
400
- }]), r;
401
- })();
402
- g.GA4 = z;
403
- var N = new z();
404
- g.default = N;
405
- })(q)), q;
406
- }
407
- var V;
408
- function re() {
409
- return V || (V = 1, (function(g) {
410
- function h(o) {
411
- "@babel/helpers - typeof";
412
- return h = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(u) {
413
- return typeof u;
414
- } : function(u) {
415
- return u && typeof Symbol == "function" && u.constructor === Symbol && u !== Symbol.prototype ? "symbol" : typeof u;
416
- }, h(o);
417
- }
418
- Object.defineProperty(g, "__esModule", {
419
- value: !0
420
- }), g.default = g.ReactGAImplementation = void 0;
421
- var y = b(ne());
422
- function S(o) {
423
- if (typeof WeakMap != "function") return null;
424
- var u = /* @__PURE__ */ new WeakMap(), c = /* @__PURE__ */ new WeakMap();
425
- return (S = function(C) {
426
- return C ? c : u;
427
- })(o);
428
- }
429
- function b(o, u) {
430
- if (o && o.__esModule)
431
- return o;
432
- if (o === null || h(o) !== "object" && typeof o != "function")
433
- return { default: o };
434
- var c = S(u);
435
- if (c && c.has(o))
436
- return c.get(o);
437
- var l = {}, C = Object.defineProperty && Object.getOwnPropertyDescriptor;
438
- for (var O in o)
439
- if (O !== "default" && Object.prototype.hasOwnProperty.call(o, O)) {
440
- var P = C ? Object.getOwnPropertyDescriptor(o, O) : null;
441
- P && (P.get || P.set) ? Object.defineProperty(l, O, P) : l[O] = o[O];
205
+ return this.ga;
206
+ });
207
+ /**
208
+ * @param {UaEventOptions|string} optionsOrName
209
+ * @param {Object} [params]
210
+ */
211
+ o(this, "event", (e, t) => {
212
+ if (typeof e == "string") this._gtag("event", e, this._toGtagOptions(t));
213
+ else {
214
+ const { action: n, category: i, label: a, value: g, nonInteraction: r, transport: d } = e;
215
+ if (!i || !n) {
216
+ console.warn("args.category AND args.action are required in event()");
217
+ return;
442
218
  }
443
- return l.default = o, c && c.set(o, l), l;
444
- }
445
- var A = y.GA4;
446
- g.ReactGAImplementation = A;
447
- var w = y.default;
448
- g.default = w;
449
- })(E)), E;
450
- }
451
- var ae = re();
452
- const ie = /* @__PURE__ */ $(ae), ue = (g, h = "local", y) => {
453
- if (!y) {
219
+ const s = {
220
+ hitType: "event",
221
+ eventCategory: l(i),
222
+ eventAction: l(n)
223
+ };
224
+ a && (s.eventLabel = l(a)), typeof g < "u" && (typeof g != "number" ? console.warn("Expected `args.value` arg to be a Number.") : s.eventValue = g), typeof r < "u" && (typeof r != "boolean" ? console.warn("`args.nonInteraction` must be a boolean.") : s.nonInteraction = r), typeof d < "u" && (typeof d != "string" ? console.warn("`args.transport` must be a string.") : ([
225
+ "beacon",
226
+ "xhr",
227
+ "image"
228
+ ].indexOf(d) === -1 && console.warn("`args.transport` must be either one of these values: `beacon`, `xhr` or `image`"), s.transport = d)), this._gaCommand("send", s);
229
+ }
230
+ });
231
+ o(this, "send", (e) => {
232
+ this._gaCommand("send", e);
233
+ });
234
+ this.reset();
235
+ }
236
+ gtag(...e) {
237
+ this._gtag(...e);
238
+ }
239
+ }, G = new C(), _ = G;
240
+ let u = !1;
241
+ const A = (e, t = "local", n, i = {}) => {
242
+ const { autoPageView: a = !0 } = i;
243
+ if (!n) {
454
244
  console.warn("GA_MEASUREMENT_ID is not set. Google Analytics will not be initialized.");
455
245
  return;
456
246
  }
457
- h === "staging" || h === "production" ? ie.initialize(y, {
247
+ t === "staging" || t === "production" ? (_.initialize(n, {
458
248
  // Use gaOptions to send custom dimensions with every GA event except initial_page_view.
459
249
  // gtagOptions could be used to send custom dimensions to initial_page_view only, if desired.
460
250
  gaOptions: {
461
251
  // custom dimensions to report
462
- scripps_brand: g,
252
+ scripps_brand: e,
463
253
  scripps_platform: "Web"
464
- }
465
- }) : console.warn("** Note: Google Analytics is only initialized in staging and production environments. **");
254
+ },
255
+ // gtagOptions are merged into the gtag `config` call. send_page_view: false stops GA4
256
+ // firing its own page_view on load, leaving the app in sole control of page views.
257
+ ...a ? {} : { gtagOptions: { send_page_view: !1 } }
258
+ }), u = !0) : (u = !1, console.warn("** Note: Google Analytics is only initialized in staging and production environments. **"));
259
+ }, I = (e, t) => {
260
+ !u || typeof window > "u" || _.send({
261
+ hitType: "pageview",
262
+ page: e ?? `${window.location.pathname}${window.location.search}`,
263
+ title: t ?? document.title,
264
+ location: window.location.href
265
+ });
466
266
  };
467
267
  export {
468
- ue as initializeAnalytics
268
+ A as initializeAnalytics,
269
+ I as sendPageView
469
270
  };