@scrippsproduct/networks-ui-library 1.1.0-alpha.9 → 1.1.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.
@@ -1,68 +1,68 @@
1
1
  import { jsx as t, jsxs as b } from "react/jsx-runtime";
2
- import { useRef as d, useCallback as S, useEffect as y } from "react";
2
+ import { useRef as d, useCallback as g, useEffect as h } from "react";
3
3
  import { f as w } from "../../format-YhWt2D8M.mjs";
4
- import { l as i } from "../../logger-C0N7U0YY.mjs";
4
+ import { l } from "../../logger-C0N7U0YY.mjs";
5
5
  import { classes as L } from "../../utils/helpers.js";
6
6
  import { ScheduleProvider as E } from "./ScheduleContext.js";
7
7
  import { useScheduleContext as T } from "./useScheduleContext.js";
8
8
  import { DateNavigation as k } from "../DateNavigation/DateNavigation.js";
9
9
  import { ScheduleList as q } from "../ScheduleList/ScheduleList.js";
10
- i.setComponent("ScheduleLayout");
10
+ l.setComponent("ScheduleLayout");
11
11
  import '../../assets/ScheduleLayout.css';function x({
12
12
  handleScheduleClicks: f = () => !0
13
13
  }) {
14
- const { currentDate: n } = T(), r = d(null), p = d(0), o = d(null), s = d(null), l = d(null), a = S((u) => {
15
- i.log("Determining pointer position for date: ", u);
16
- const c = () => {
14
+ const { currentDate: r } = T(), n = d(null), p = d(0), o = d(null), c = d(null), i = d(null), u = g((a) => {
15
+ l.log("Determining pointer position for date: ", a);
16
+ const s = () => {
17
17
  let e;
18
- const v = document.querySelector(`.date-navigation__day[aria-controls="${w(u, "yyyy-MM-dd")}"]`);
19
- if (v && (e = v.parentElement), e && r.current) {
20
- const g = e.offsetLeft + e.offsetWidth / 2;
21
- p.current = g, r.current.style.setProperty(
18
+ const v = document.querySelector(`.date-navigation__day[aria-controls="${w(a, "yyyy-MM-dd")}"]`);
19
+ if (v && (e = v.parentElement), e && n.current) {
20
+ const S = e.offsetLeft + e.offsetWidth / 2;
21
+ p.current = S, n.current.style.setProperty(
22
22
  "--pointer-position",
23
- `${g}px`
23
+ `${S}px`
24
24
  );
25
25
  }
26
- }, h = () => {
27
- i.log("Scrolling schedule list to top"), i.log("Schedule list element: ", s.current), i.log("Sticky wrapper element: ", l.current);
26
+ }, y = () => {
27
+ l.log("Scrolling schedule list to top"), c.current || (c.current = document.querySelector(".schedule-list")), i.current || (i.current = document.querySelector("sticky-content-wrapper")), l.log("Schedule list element: ", c.current), l.log("Sticky wrapper element: ", i.current);
28
28
  const e = document.querySelector(".mobile-nav");
29
- s.current && l.current && (i.log("Mobile nav element: ", e), window.scrollTo({
29
+ c.current && i.current && (l.log("Mobile nav element: ", e), window.scrollTo({
30
30
  behavior: "auto",
31
- top: e && window.getComputedStyle(e).display !== "none" ? s.current.offsetTop - l.current.offsetHeight - e.offsetHeight - 8 : s.current.offsetTop - l.current.offsetHeight - 16,
31
+ top: e && window.getComputedStyle(e).display !== "none" ? c.current.offsetTop - i.current.offsetHeight - e.offsetHeight - 8 : c.current.offsetTop - i.current.offsetHeight - 16,
32
32
  left: 0
33
33
  }));
34
34
  };
35
- if (!r.current) {
35
+ if (!n.current) {
36
36
  const e = setInterval(() => {
37
- r.current = document.querySelector(".date-navigation__list"), r.current && (clearInterval(e), s.current = document.querySelector(".schedule-list"), l.current = document.querySelector("sticky-content-wrapper"), c(), h());
37
+ n.current = document.querySelector(".date-navigation__list"), n.current && (clearInterval(e), c.current = document.querySelector(".schedule-list"), i.current = document.querySelector("sticky-content-wrapper"), s(), y());
38
38
  }, 100);
39
39
  setTimeout(() => {
40
40
  clearInterval(e);
41
41
  }, 3e3);
42
42
  return;
43
43
  }
44
- c(), h();
45
- }, []), m = S(() => {
44
+ s(), y();
45
+ }, []), m = g(() => {
46
46
  o.current && clearTimeout(o.current), o.current = window.setTimeout(() => {
47
- a(n);
47
+ u(r);
48
48
  }, 250);
49
- }, [n, a]);
50
- return y(() => (window.addEventListener("resize", m), () => {
49
+ }, [r, u]);
50
+ return h(() => (window.addEventListener("resize", m), () => {
51
51
  window.removeEventListener("resize", m), o.current && clearTimeout(o.current);
52
- }), [a, m]), y(() => {
53
- const u = document.querySelector(".header-divider"), c = document.querySelector("sticky-content-wrapper");
54
- c && u && new IntersectionObserver(
52
+ }), [u, m]), h(() => {
53
+ const a = document.querySelector(".header-divider"), s = document.querySelector("sticky-content-wrapper");
54
+ s && a && new IntersectionObserver(
55
55
  ([e]) => {
56
- e.intersectionRatio < 1 ? c.dataset.pinnedState = "pinned" : c.dataset.pinnedState = "unpinned";
56
+ e.intersectionRatio < 1 ? s.dataset.pinnedState = "pinned" : s.dataset.pinnedState = "unpinned";
57
57
  },
58
58
  {
59
59
  threshold: [1],
60
60
  rootMargin: "-37px"
61
61
  }
62
- ).observe(u);
63
- }, []), y(() => {
64
- a(n);
65
- }, [n, a]), /* @__PURE__ */ b("schedule-layout", { children: [
62
+ ).observe(a);
63
+ }, []), h(() => {
64
+ u(r);
65
+ }, [r, u]), /* @__PURE__ */ b("schedule-layout", { children: [
66
66
  /* @__PURE__ */ t("sticky-content-wrapper", { "data-pinned-state": "unpinned", children: /* @__PURE__ */ t(
67
67
  "content-constrainer",
68
68
  {
@@ -75,13 +75,13 @@ import '../../assets/ScheduleLayout.css';function x({
75
75
  children: /* @__PURE__ */ t(k, {})
76
76
  }
77
77
  ) }),
78
- /* @__PURE__ */ t("section", { className: "page-section", id: "schedule-section", children: /* @__PURE__ */ t("content-constrainer", { class: "content-constrainer--no-border schedule-content-constrainer", children: /* @__PURE__ */ t("div", { id: w(n, "yyyy-MM-dd"), role: "tabpanel", children: /* @__PURE__ */ t(q, { handleClicks: f }) }) }) })
78
+ /* @__PURE__ */ t("section", { className: "page-section", id: "schedule-section", children: /* @__PURE__ */ t("content-constrainer", { class: "content-constrainer--no-border schedule-content-constrainer", children: /* @__PURE__ */ t("div", { id: w(r, "yyyy-MM-dd"), role: "tabpanel", children: /* @__PURE__ */ t(q, { handleClicks: f }) }) }) })
79
79
  ] });
80
80
  }
81
81
  function N({
82
82
  fetchSchedule: f,
83
- initialSchedule: n = [],
84
- weeks: r = [],
83
+ initialSchedule: r = [],
84
+ weeks: n = [],
85
85
  handleScheduleClicks: p = () => !0,
86
86
  handleDateChanged: o = () => !0
87
87
  }) {
@@ -90,8 +90,8 @@ function N({
90
90
  {
91
91
  fetchSchedule: f,
92
92
  handleDateChanged: o,
93
- initialSchedule: n,
94
- weeks: r,
93
+ initialSchedule: r,
94
+ weeks: n,
95
95
  children: /* @__PURE__ */ t(x, { handleScheduleClicks: p })
96
96
  }
97
97
  );
@@ -1,31 +1,29 @@
1
- import { jsx as a, jsxs as g } from "react/jsx-runtime";
2
- import { useReducer as R, useState as A, useRef as w, useCallback as L, useEffect as E } from "react";
3
- import { classes as T, getMinutesFromStr as u } from "../../utils/helpers.js";
4
- import { useScheduleContext as b } from "../ScheduleLayout/useScheduleContext.js";
5
- import { Loading as x } from "../Loading/Loading.js";
6
- import { SportsItem as D } from "./schedule-list-items/SportsItem.js";
7
- import { SeriesItem as M } from "./schedule-list-items/SeriesItem.js";
8
- import { MovieItem as k } from "./schedule-list-items/MovieItem.js";
1
+ import { jsx as t, jsxs as g } from "react/jsx-runtime";
2
+ import { useReducer as A, useState as u, useRef as S, useCallback as x, useEffect as y } from "react";
3
+ import { classes as R, getMinutesFromStr as b } from "../../utils/helpers.js";
4
+ import { useScheduleContext as w } from "../ScheduleLayout/useScheduleContext.js";
5
+ import { Loading as D } from "../Loading/Loading.js";
6
+ import { SportsItem as M } from "./schedule-list-items/SportsItem.js";
7
+ import { SeriesItem as C } from "./schedule-list-items/SeriesItem.js";
8
+ import { MovieItem as O } from "./schedule-list-items/MovieItem.js";
9
9
  import '../../assets/ScheduleList.css';const l = {
10
- "schedule-list__item": "_schedule-list__item_wmqq1_1",
11
- "schedule-list__airdate": "_schedule-list__airdate_wmqq1_14",
12
- "airdate-formatter__date": "_airdate-formatter__date_wmqq1_22",
13
- "airdate-formatter__day": "_airdate-formatter__day_wmqq1_23",
14
- "airdate-formatter__time-wrap": "_airdate-formatter__time-wrap_wmqq1_26",
15
- "schedule-list": "_schedule-list_wmqq1_1",
16
- "fade-out": "_fade-out_wmqq1_1",
17
- "fade-in": "_fade-in_wmqq1_1",
18
- "schedule-list__no-schedule": "_schedule-list__no-schedule_wmqq1_50",
19
- "schedule-content-constrainer": "_schedule-content-constrainer_wmqq1_102",
20
- "date-navigation__weekday": "_date-navigation__weekday_wmqq1_110",
21
- "date-navigation__date": "_date-navigation__date_wmqq1_113",
22
- "image-card__content": "_image-card__content_wmqq1_122"
10
+ "schedule-list__item": "_schedule-list__item_686v7_1",
11
+ "schedule-list__airdate": "_schedule-list__airdate_686v7_14",
12
+ "airdate-formatter__date": "_airdate-formatter__date_686v7_22",
13
+ "airdate-formatter__day": "_airdate-formatter__day_686v7_23",
14
+ "airdate-formatter__time-wrap": "_airdate-formatter__time-wrap_686v7_26",
15
+ "schedule-list": "_schedule-list_686v7_1",
16
+ "fade-out": "_fade-out_686v7_1",
17
+ "fade-in": "_fade-in_686v7_1",
18
+ "schedule-list__no-schedule": "_schedule-list__no-schedule_686v7_50",
19
+ "schedule-content-constrainer": "_schedule-content-constrainer_686v7_102",
20
+ "image-card__content": "_image-card__content_686v7_116"
23
21
  };
24
- function S(r) {
22
+ function L(r) {
25
23
  return typeof r == "object" && !Array.isArray(r) && (r == null ? void 0 : r.queryStatus) && r.queryStatus === "no-results";
26
24
  }
27
- function C(r, t) {
28
- switch (t.type) {
25
+ function P(r, a) {
26
+ switch (a.type) {
29
27
  case "START_EXIT":
30
28
  return "exiting";
31
29
  case "EXIT_COMPLETE":
@@ -38,9 +36,9 @@ function C(r, t) {
38
36
  return r;
39
37
  }
40
38
  }
41
- const v = (r) => {
42
- var t, s, y, n, e, o, d, f, _, p, i;
43
- return (t = r.video) != null && t.brightcove_id ? {
39
+ const d = (r) => {
40
+ var a, o, v, n, s, _, E, f, p, e, i;
41
+ return (a = r.video) != null && a.brightcove_id ? {
44
42
  label: "Watch Preview",
45
43
  type: "play-video",
46
44
  href: "",
@@ -71,10 +69,10 @@ const v = (r) => {
71
69
  //'film',
72
70
  position: void 0
73
71
  //'inline',
74
- } : (((s = r == null ? void 0 : r.content) == null ? void 0 : s.external_link) !== void 0 && ((y = r == null ? void 0 : r.content) == null ? void 0 : y.external_link) !== "" || ((n = r == null ? void 0 : r.content) == null ? void 0 : n.slug) !== void 0 && ((e = r == null ? void 0 : r.content) == null ? void 0 : e.slug) !== "") && !((o = r == null ? void 0 : r.content) != null && o.prevent_detail_page) ? {
72
+ } : (((o = r == null ? void 0 : r.content) == null ? void 0 : o.external_link) !== void 0 && ((v = r == null ? void 0 : r.content) == null ? void 0 : v.external_link) !== "" || ((n = r == null ? void 0 : r.content) == null ? void 0 : n.slug) !== void 0 && ((s = r == null ? void 0 : r.content) == null ? void 0 : s.slug) !== "") && !((_ = r == null ? void 0 : r.content) != null && _.prevent_detail_page) ? {
75
73
  label: (r == null ? void 0 : r.program_class) === "Episode" ? "View Series Details" : (r == null ? void 0 : r.program_class) === "Film" ? "View Movie Details" : "Learn More",
76
- type: (d = r == null ? void 0 : r.content) != null && d.external_link ? "external-link" : "internal-link",
77
- href: (f = r == null ? void 0 : r.content) != null && f.external_link ? (_ = r == null ? void 0 : r.content) == null ? void 0 : _.external_link : r.program_class === "Episode" ? `/show/${(p = r == null ? void 0 : r.content) == null ? void 0 : p.slug}` : `/movie/${(i = r == null ? void 0 : r.content) == null ? void 0 : i.slug}`,
74
+ type: (E = r == null ? void 0 : r.content) != null && E.external_link ? "external-link" : "internal-link",
75
+ href: (f = r == null ? void 0 : r.content) != null && f.external_link ? (p = r == null ? void 0 : r.content) == null ? void 0 : p.external_link : r.program_class === "Episode" ? `/show/${(e = r == null ? void 0 : r.content) == null ? void 0 : e.slug}` : `/movie/${(i = r == null ? void 0 : r.content) == null ? void 0 : i.slug}`,
78
76
  position: "inline"
79
77
  } : {
80
78
  label: "",
@@ -83,26 +81,28 @@ const v = (r) => {
83
81
  position: void 0
84
82
  };
85
83
  };
86
- function H({
84
+ function q({
87
85
  handleClicks: r = () => !0
88
86
  }) {
89
- const { schedule: t, isLoading: s, isError: y } = b(), [n, e] = R(C, "idle"), [o, d] = A(t), f = w(null), _ = w(null), p = L(() => {
90
- _.current && (clearTimeout(_.current), _.current = null), n === "exiting" ? e({ type: "EXIT_COMPLETE" }) : n === "entering" && e({ type: "ENTER_COMPLETE" });
87
+ const { schedule: a, isLoading: o, isError: v } = w(), [n, s] = A(P, "idle"), [_, E] = u(a), f = S(null), p = S(null), e = x(() => {
88
+ p.current && (clearTimeout(p.current), p.current = null), n === "exiting" ? s({ type: "EXIT_COMPLETE" }) : n === "entering" && s({ type: "ENTER_COMPLETE" });
91
89
  }, [n]);
92
- return E(() => {
90
+ return y(() => {
93
91
  const i = f.current;
94
92
  if (i)
95
- return i.addEventListener("animationend", p), () => {
96
- i.removeEventListener("animationend", p);
93
+ return i.addEventListener("animationend", e), () => {
94
+ i.removeEventListener("animationend", e);
97
95
  };
98
- }, [p]), E(() => {
99
- s && n === "idle" && e({ type: "START_EXIT" });
100
- }, [s, n]), E(() => {
101
- const i = S(t) || Array.isArray(t) && t.length >= 0;
102
- !s && n === "loading" && i && (d(t), e({ type: "SCHEDULE_LOADED" }));
103
- }, [s, n, t]), E(() => () => {
104
- _.current && clearTimeout(_.current);
105
- }, []), n === "loading" ? /* @__PURE__ */ a(
96
+ }, [e]), y(() => {
97
+ o && n === "idle" && s({ type: "START_EXIT" });
98
+ }, [o, n]), y(() => {
99
+ !o && n === "exiting" && s({ type: "EXIT_COMPLETE" });
100
+ }, [o, n]), y(() => {
101
+ const i = L(a) || Array.isArray(a) && a.length >= 0;
102
+ !o && n === "loading" && i && (E(a), s({ type: "SCHEDULE_LOADED" }));
103
+ }, [o, n, a]), y(() => () => {
104
+ p.current && clearTimeout(p.current);
105
+ }, []), n === "loading" ? /* @__PURE__ */ t(
106
106
  "div",
107
107
  {
108
108
  style: {
@@ -111,81 +111,81 @@ function H({
111
111
  minHeight: "100dvh",
112
112
  paddingTop: "6rem"
113
113
  },
114
- children: /* @__PURE__ */ a(x, {})
114
+ children: /* @__PURE__ */ t(D, {})
115
115
  }
116
- ) : y ? /* @__PURE__ */ g("div", { className: "schedule-list__no-schedule", children: [
117
- /* @__PURE__ */ a("h2", { children: "There was an error loading the schedule for this day." }),
116
+ ) : v ? /* @__PURE__ */ g("div", { className: "schedule-list__no-schedule", children: [
117
+ /* @__PURE__ */ t("h2", { children: "There was an error loading the schedule for this day." }),
118
118
  /* @__PURE__ */ g("p", { children: [
119
119
  "Please try again later. If this problem persists report it at ",
120
- /* @__PURE__ */ a("a", { href: "https://support.iontelevision.com/support/home", children: "our support page" }),
120
+ /* @__PURE__ */ t("a", { href: "https://support.iontelevision.com/support/home", children: "our support page" }),
121
121
  "."
122
122
  ] })
123
- ] }) : S(o) ? /* @__PURE__ */ g(
123
+ ] }) : L(_) ? /* @__PURE__ */ g(
124
124
  "div",
125
125
  {
126
- className: T([
126
+ className: R([
127
127
  l["schedule-list__no-schedule"],
128
128
  "schedule-list__no-schedule"
129
129
  ]),
130
130
  "data-state": n,
131
131
  style: { animationDelay: "500ms" },
132
132
  children: [
133
- /* @__PURE__ */ a("h2", { children: "There are no shows scheduled for this day." }),
133
+ /* @__PURE__ */ t("h2", { children: "There are no shows scheduled for this day." }),
134
134
  /* @__PURE__ */ g("p", { children: [
135
135
  "Please try again later. If this problem persists report it at ",
136
- /* @__PURE__ */ a("a", { href: "https://support.iontelevision.com/support/home", children: "our support page" }),
136
+ /* @__PURE__ */ t("a", { href: "https://support.iontelevision.com/support/home", children: "our support page" }),
137
137
  "."
138
138
  ] })
139
139
  ]
140
140
  }
141
- ) : Array.isArray(o) && o.length === 0 ? /* @__PURE__ */ g(
141
+ ) : Array.isArray(_) && _.length === 0 ? /* @__PURE__ */ g(
142
142
  "div",
143
143
  {
144
- className: T([
144
+ className: R([
145
145
  l["schedule-list__no-schedule"],
146
146
  "schedule-list__no-schedule"
147
147
  ]),
148
148
  "data-state": n,
149
149
  children: [
150
- /* @__PURE__ */ a("h2", { children: "Our programming schedule for today has completed." }),
151
- /* @__PURE__ */ a("p", { children: "Our programming will restart at 6am." })
150
+ /* @__PURE__ */ t("h2", { children: "Our programming schedule for today has completed." }),
151
+ /* @__PURE__ */ t("p", { children: "Our programming will restart at 6am." })
152
152
  ]
153
153
  }
154
- ) : /* @__PURE__ */ a(
154
+ ) : /* @__PURE__ */ t(
155
155
  "ul",
156
156
  {
157
157
  className: `${l["schedule-list"]} schedule-list`,
158
158
  "data-state": n,
159
159
  ref: f,
160
- children: Array.isArray(o) && o.map((i) => {
161
- const c = u(i.element_length), q = v(i).type === "" ? [c, i.rating] : [c, i.rating, "&nbsp;"];
162
- return i.program_class === "Episode" ? /* @__PURE__ */ a(
163
- M,
160
+ children: Array.isArray(_) && _.map((i) => {
161
+ const T = b(i.element_length), c = d(i).type === "" ? [T, i.rating] : [T, i.rating, "&nbsp;"];
162
+ return i.program_class === "Episode" ? /* @__PURE__ */ t(
163
+ C,
164
164
  {
165
- determineCTA: v,
165
+ determineCTA: d,
166
166
  handleClicks: r,
167
167
  scheduleItem: i,
168
- strListArr: q,
168
+ strListArr: c,
169
169
  styles: l
170
170
  },
171
171
  `schedule-list-${i.id}`
172
- ) : i.program_class === "Film" || i.program_class === "Movie" || i.program_class === "Special" ? /* @__PURE__ */ a(
173
- k,
172
+ ) : i.program_class === "Film" || i.program_class === "Movie" || i.program_class === "Special" ? /* @__PURE__ */ t(
173
+ O,
174
174
  {
175
- determineCTA: v,
175
+ determineCTA: d,
176
176
  handleClicks: r,
177
177
  scheduleItem: i,
178
- strListArr: q,
178
+ strListArr: c,
179
179
  styles: l
180
180
  },
181
181
  `schedule-list-${i.id}`
182
- ) : i.program_class === "Sports" ? /* @__PURE__ */ a(
183
- D,
182
+ ) : i.program_class === "Sports" ? /* @__PURE__ */ t(
183
+ M,
184
184
  {
185
- determineCTA: v,
185
+ determineCTA: d,
186
186
  handleClicks: r,
187
187
  scheduleItem: i,
188
- strListArr: q,
188
+ strListArr: c,
189
189
  styles: l
190
190
  },
191
191
  `schedule-list-${i.id}`
@@ -195,6 +195,6 @@ function H({
195
195
  );
196
196
  }
197
197
  export {
198
- H as ScheduleList,
199
- H as default
198
+ q as ScheduleList,
199
+ q as default
200
200
  };
@@ -1,49 +1,49 @@
1
- import { jsx as r, jsxs as l } from "react/jsx-runtime";
2
- import { classes as e } from "../../../utils/helpers.js";
3
- import { determineProgramTitle as a } from "../../../utils/program-helpers.js";
4
- import { Concat as y } from "../../Concat/Concat.js";
5
- import { StringList as C } from "../../StringList/StringList.js";
6
- import { AirDateSegment as S } from "./AirDateSegment.js";
1
+ import { jsx as r, jsxs as f } from "react/jsx-runtime";
2
+ import { classes as l } from "../../../utils/helpers.js";
3
+ import { determineProgramTitle as n } from "../../../utils/program-helpers.js";
4
+ import { Concat as C } from "../../Concat/Concat.js";
5
+ import { StringList as y } from "../../StringList/StringList.js";
6
+ import { AirDateSegment as e } from "./AirDateSegment.js";
7
7
  import { ImageCard as v } from "../../ImageCard/ImageCard.js";
8
- import { l as p } from "../../../logger-C0N7U0YY.mjs";
9
- p.setComponent("SeriesItem");
8
+ import { l as S } from "../../../logger-C0N7U0YY.mjs";
9
+ S.setComponent("SeriesItem");
10
10
  function D({
11
11
  scheduleItem: i,
12
12
  styles: o,
13
- strListArr: m,
14
- handleClicks: s,
15
- determineCTA: g
13
+ strListArr: a,
14
+ handleClicks: p,
15
+ determineCTA: m
16
16
  }) {
17
- var n;
18
- const _ = i.episode_number ? `${i.episode_number}:` : "", t = i.program_synopsis !== null ? i.program_synopsis : "";
19
- p.log("SeriesItem - programSynopsis: ", t), i.title_name && (i.title_name = i.title_name.trim());
20
- const f = [
21
- i.title_name !== a(i).trim() ? `<div>${_} ${i.title_name}</div>` : "",
22
- i.program_synopsis !== null && i.program_synopsis !== void 0 ? `<div>${t}</div>` : "",
23
- /* @__PURE__ */ r(C, { list: m, separatorType: "pipe" })
17
+ var t;
18
+ const s = i.episode_number ? `${i.episode_number}:` : "", _ = i.program_synopsis !== null ? i.program_synopsis : "";
19
+ i.title_name && (i.title_name = i.title_name.trim());
20
+ const g = [
21
+ i.title_name !== n(i).trim() ? `<div>${s} ${i.title_name}</div>` : "",
22
+ i.program_synopsis !== null && i.program_synopsis !== void 0 ? `<div>${_}</div>` : "",
23
+ /* @__PURE__ */ r(y, { list: a, separatorType: "pipe" })
24
24
  ];
25
- return /* @__PURE__ */ l(
25
+ return /* @__PURE__ */ f(
26
26
  "li",
27
27
  {
28
- className: e([o["schedule-list__item"], "schedule-list__item"]),
28
+ className: l([o["schedule-list__item"], "schedule-list__item"]),
29
29
  children: [
30
- /* @__PURE__ */ r(S, { scheduleItem: i, styles: o }),
30
+ /* @__PURE__ */ r(e, { scheduleItem: i, styles: o }),
31
31
  /* @__PURE__ */ r(
32
32
  v,
33
33
  {
34
34
  clampContentLines: !0,
35
35
  displayInline: !0,
36
- content: /* @__PURE__ */ r(y, { list: f }),
37
- cta: g(i),
38
- handleClicks: s,
36
+ content: /* @__PURE__ */ r(C, { list: g }),
37
+ cta: m(i),
38
+ handleClicks: p,
39
39
  id: i.id,
40
40
  image: {
41
- url: ((n = i == null ? void 0 : i.content) == null ? void 0 : n.image) ?? "",
41
+ url: ((t = i == null ? void 0 : i.content) == null ? void 0 : t.image) ?? "",
42
42
  altText: "",
43
43
  aspectRatio: 543 / 305
44
44
  },
45
45
  numberOfLinesToClamp: 5,
46
- title: a(i)
46
+ title: n(i)
47
47
  }
48
48
  )
49
49
  ]
@@ -16,7 +16,7 @@ type UseGetScheduleParams = {
16
16
  *
17
17
  * @returns {Object[]|{ queryStatus: 'no-results' }} - Array of objects or an object with a queryStatus of 'no-results'
18
18
  */
19
- declare const getSchedule: ({ dateStr, schedEndpoint, network, showEpisodeNumber, showUpcoming, }: UseGetScheduleParams) => Promise<ScheduleItem[] | [{
19
+ declare const getSchedule: ({ dateStr, schedEndpoint, network, showEpisodeNumber, showUpcoming, }: UseGetScheduleParams) => Promise<ScheduleItem[] | {
20
20
  queryStatus: string;
21
- }]>;
21
+ }>;
22
22
  export default getSchedule;
@@ -55,7 +55,7 @@ const P = async ({
55
55
  episode_number: r
56
56
  };
57
57
  }), a = await y();
58
- return a === void 0 || a.length === 0 ? [{ queryStatus: "no-results" }] : D(a);
58
+ return a === void 0 || a.length === 0 ? { queryStatus: "no-results" } : D(a);
59
59
  };
60
60
  export {
61
61
  P as default
@@ -0,0 +1,22 @@
1
+ import { ScheduleItem } from '../types';
2
+ type UseGetScheduleParams = {
3
+ dateStr: string;
4
+ schedEndpoint: string;
5
+ network?: string | null;
6
+ showEpisodeNumber?: boolean;
7
+ showUpcoming?: boolean;
8
+ };
9
+ /**
10
+ *
11
+ * @param {*} param0
12
+ * @param {string} param0.dateStr - The date to get the schedule for
13
+ * @param {string} param0.schedEndpoint - The endpoint to get the schedule from
14
+ * @param {string|null} param0.network - The network to get the schedule for
15
+ * @param {boolean} param0.showEpisodeNumber - Whether episode numbers should be shown
16
+ *
17
+ * @returns {Object[]|{ queryStatus: 'no-results' }} - Array of objects or an object with a queryStatus of 'no-results'
18
+ */
19
+ declare const useGetSchedule: ({ dateStr, schedEndpoint, network, showEpisodeNumber, showUpcoming, }: UseGetScheduleParams) => Promise<ScheduleItem[] | [{
20
+ queryStatus: string;
21
+ }]>;
22
+ export default useGetSchedule;
@@ -0,0 +1,62 @@
1
+ import { a as p } from "../add-UWUc_nrO.mjs";
2
+ import { f as d } from "../format-YhWt2D8M.mjs";
3
+ import { determineSeasonNumber as S, determineEpisodeNumber as _, determineSeasonNumberFromSeriesPrefix as b } from "../utils/series-helpers.js";
4
+ import { convert12to24 as O } from "../utils/helpers.js";
5
+ import { determineIfShowIsOnNow as v } from "../utils/date-helpers.js";
6
+ import { g as x } from "../index-0wieGV50.mjs";
7
+ const P = async ({
8
+ dateStr: o,
9
+ schedEndpoint: h,
10
+ network: $ = null,
11
+ showEpisodeNumber: u = !1,
12
+ showUpcoming: w = !1
13
+ }) => {
14
+ const c = x("America/New_York", new Date(o)) / 36e5, T = d(/* @__PURE__ */ new Date(`${o}T00:00:00`), "yyyy-MM-dd"), i = d(new Date(p(/* @__PURE__ */ new Date(`${o}T00:00:00`), { days: 1 })), "yyyy-MM-dd"), m = (s) => {
15
+ const e = /* @__PURE__ */ new Date(`${o}T06:00:00-0${c * -1}:00`), r = /* @__PURE__ */ new Date(`${i}T06:00:00-0${c * -1}:00`);
16
+ return s.filter((n) => {
17
+ if (!(n != null && n.start_ts_parse)) return !1;
18
+ const l = (n == null ? void 0 : n.start_ts_parse) * 1e3;
19
+ return l >= e.valueOf() && l < r.valueOf();
20
+ });
21
+ }, y = async () => {
22
+ let s = [], e = {
23
+ next: null,
24
+ results: []
25
+ }, r = 0, f = "";
26
+ const n = T, l = i;
27
+ do {
28
+ f = `${h}/${$}?ordering=start_ts_parse&start_date__range=${n},${l}&limit=100&offset=${r}`;
29
+ try {
30
+ const t = await fetch(f);
31
+ if (t != null && t.ok)
32
+ e = await t.json(), s = [...s, ...e.results];
33
+ else {
34
+ console.error(`An error was returned from fetch. HTTP Response Code: ', ${t == null ? void 0 : t.status}`);
35
+ break;
36
+ }
37
+ } catch (t) {
38
+ console.error("Fetch failed with error:", t);
39
+ break;
40
+ }
41
+ r += 100;
42
+ } while (e.next !== null);
43
+ return s.length === 0 ? void 0 : m(s).map((t) => ({
44
+ ...t,
45
+ showUpcoming: w
46
+ }));
47
+ }, D = (s) => s.filter((e) => {
48
+ if (e.series_prefix === null && e.title_code === null) return !1;
49
+ const r = /* @__PURE__ */ new Date();
50
+ return e.start_ts_parse ? !!(e.start_ts_parse * 1e3 > r.valueOf() || v(`${e.start_date_parse}T${O(e.start_time)}`, e.element_length)) : !1;
51
+ }).map((e) => {
52
+ let r = "";
53
+ return e.series_prefix === null ? r = u ? `${S(e)}${_(e)}` : "" : r = u ? `${b(e)}${_(e)}` : "", {
54
+ ...e,
55
+ episode_number: r
56
+ };
57
+ }), a = await y();
58
+ return a === void 0 || a.length === 0 ? [{ queryStatus: "no-results" }] : D(a);
59
+ };
60
+ export {
61
+ P as default
62
+ };
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "1.1.0-alpha.9",
2
+ "version": "1.1.0",
3
3
  "name": "@scrippsproduct/networks-ui-library",
4
4
  "description": "React Component Library for use in Scripps Networks external applications",
5
5
  "author": {