@scrippsproduct/networks-ui-library 1.1.0-alpha.5 → 1.1.0-alpha.7
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,33 +1,33 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { createContext as
|
|
3
|
-
const
|
|
4
|
-
function
|
|
1
|
+
import { jsx as S } from "react/jsx-runtime";
|
|
2
|
+
import { createContext as g, useState as y, useRef as v, useCallback as x, useEffect as b, useMemo as j } from "react";
|
|
3
|
+
const D = g(void 0);
|
|
4
|
+
function L({
|
|
5
5
|
schedule: r,
|
|
6
6
|
weeks: a,
|
|
7
7
|
handleDateChanged: o = () => !0,
|
|
8
|
-
children:
|
|
8
|
+
children: c
|
|
9
9
|
}) {
|
|
10
|
-
const [i, A] =
|
|
11
|
-
|
|
10
|
+
const [i, A] = y(a[0][0].date), [n, f] = y(!1), t = v(r), u = x((e) => {
|
|
11
|
+
f(!0), A(e), o(e);
|
|
12
12
|
}, [o]);
|
|
13
|
-
|
|
13
|
+
b(() => {
|
|
14
14
|
let e = !1;
|
|
15
|
-
typeof r == "object" && !Array.isArray(r) &&
|
|
16
|
-
var
|
|
17
|
-
return
|
|
18
|
-
}) : e = !0, e && n && (
|
|
15
|
+
typeof r == "object" && !Array.isArray(r) && (r != null && r.queryStatus) ? e = !(typeof t.current == "object" && !Array.isArray(t.current) && "queryStatus" in t.current) : Array.isArray(r) && Array.isArray(t.current) ? e = t.current.length !== r.length || t.current.some((p, C) => {
|
|
16
|
+
var s;
|
|
17
|
+
return p.id !== ((s = r[C]) == null ? void 0 : s.id);
|
|
18
|
+
}) : e = !0, e && n && (f(!1), t.current = r);
|
|
19
19
|
}, [r, n]);
|
|
20
|
-
const
|
|
20
|
+
const m = j(() => ({
|
|
21
21
|
schedule: r,
|
|
22
22
|
weeks: a,
|
|
23
23
|
currentDate: i,
|
|
24
24
|
isLoading: n,
|
|
25
|
-
setCurrentDate:
|
|
26
|
-
}), [r, a, i, n,
|
|
27
|
-
return /* @__PURE__ */
|
|
25
|
+
setCurrentDate: u
|
|
26
|
+
}), [r, a, i, n, u]);
|
|
27
|
+
return /* @__PURE__ */ S(D.Provider, { value: m, children: c });
|
|
28
28
|
}
|
|
29
29
|
export {
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
30
|
+
D as ScheduleContext,
|
|
31
|
+
L as ScheduleProvider,
|
|
32
|
+
L as default
|
|
33
33
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { jsx as a, jsxs as
|
|
2
|
-
import { useReducer as
|
|
3
|
-
import { classes as T, getMinutesFromStr as
|
|
1
|
+
import { jsx as a, jsxs as y } from "react/jsx-runtime";
|
|
2
|
+
import { useReducer as R, useState as A, useRef as w, useCallback as L, useEffect as v } from "react";
|
|
3
|
+
import { classes as T, getMinutesFromStr as u } from "../../utils/helpers.js";
|
|
4
4
|
import { useScheduleContext as b } from "../ScheduleLayout/useScheduleContext.js";
|
|
5
5
|
import { Loading as x } from "../Loading/Loading.js";
|
|
6
6
|
import { SportsItem as D } from "./schedule-list-items/SportsItem.js";
|
|
@@ -22,7 +22,7 @@ import '../../assets/ScheduleList.css';const f = {
|
|
|
22
22
|
"image-card__content": "_image-card__content_wmqq1_122"
|
|
23
23
|
};
|
|
24
24
|
function S(r) {
|
|
25
|
-
return typeof r == "object" && !Array.isArray(r) &&
|
|
25
|
+
return typeof r == "object" && !Array.isArray(r) && (r == null ? void 0 : r.queryStatus) && r.queryStatus === "no-results";
|
|
26
26
|
}
|
|
27
27
|
function C(r, p) {
|
|
28
28
|
switch (p.type) {
|
|
@@ -38,8 +38,8 @@ function C(r, p) {
|
|
|
38
38
|
return r;
|
|
39
39
|
}
|
|
40
40
|
}
|
|
41
|
-
const
|
|
42
|
-
var p, t, s, n, e, o,
|
|
41
|
+
const E = (r) => {
|
|
42
|
+
var p, t, s, n, e, o, d, g, _, l, i;
|
|
43
43
|
return (p = r.video) != null && p.brightcove_id ? {
|
|
44
44
|
label: "Watch Preview",
|
|
45
45
|
type: "play-video",
|
|
@@ -73,7 +73,7 @@ const v = (r) => {
|
|
|
73
73
|
//'inline',
|
|
74
74
|
} : (((t = r == null ? void 0 : r.content) == null ? void 0 : t.external_link) !== void 0 && ((s = r == null ? void 0 : r.content) == null ? void 0 : s.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) ? {
|
|
75
75
|
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: (
|
|
76
|
+
type: (d = r == null ? void 0 : r.content) != null && d.external_link ? "external-link" : "internal-link",
|
|
77
77
|
href: (g = r == null ? void 0 : r.content) != null && g.external_link ? (_ = r == null ? void 0 : r.content) == null ? void 0 : _.external_link : r.program_class === "Episode" ? `/show/${(l = r == null ? void 0 : r.content) == null ? void 0 : l.slug}` : `/movie/${(i = r == null ? void 0 : r.content) == null ? void 0 : i.slug}`,
|
|
78
78
|
position: "inline"
|
|
79
79
|
} : {
|
|
@@ -87,21 +87,21 @@ function H({
|
|
|
87
87
|
handleClicks: r = () => !0,
|
|
88
88
|
fetchError: p = !1
|
|
89
89
|
}) {
|
|
90
|
-
const { schedule: t, isLoading: s } = b(), [n, e] =
|
|
90
|
+
const { schedule: t, isLoading: s } = b(), [n, e] = R(C, "idle"), [o, d] = A(t), g = w(null), _ = w(null), l = L(() => {
|
|
91
91
|
_.current && (clearTimeout(_.current), _.current = null), n === "exiting" ? e({ type: "EXIT_COMPLETE" }) : n === "entering" && e({ type: "ENTER_COMPLETE" });
|
|
92
92
|
}, [n]);
|
|
93
|
-
return
|
|
93
|
+
return v(() => {
|
|
94
94
|
const i = g.current;
|
|
95
95
|
if (i)
|
|
96
96
|
return i.addEventListener("animationend", l), () => {
|
|
97
97
|
i.removeEventListener("animationend", l);
|
|
98
98
|
};
|
|
99
|
-
}, [l]),
|
|
99
|
+
}, [l]), v(() => {
|
|
100
100
|
s && n === "idle" && e({ type: "START_EXIT" });
|
|
101
|
-
}, [s, n]),
|
|
101
|
+
}, [s, n]), v(() => {
|
|
102
102
|
const i = S(t) || Array.isArray(t) && t.length >= 0;
|
|
103
|
-
!s && n === "loading" && i && (
|
|
104
|
-
}, [s, n, t]),
|
|
103
|
+
!s && n === "loading" && i && (d(t), e({ type: "SCHEDULE_LOADED" }));
|
|
104
|
+
}, [s, n, t]), v(() => () => {
|
|
105
105
|
_.current && clearTimeout(_.current);
|
|
106
106
|
}, []), n === "loading" ? /* @__PURE__ */ a(
|
|
107
107
|
"div",
|
|
@@ -114,14 +114,14 @@ function H({
|
|
|
114
114
|
},
|
|
115
115
|
children: /* @__PURE__ */ a(x, {})
|
|
116
116
|
}
|
|
117
|
-
) : p ? /* @__PURE__ */
|
|
117
|
+
) : p ? /* @__PURE__ */ y("div", { className: "schedule-list__no-schedule", children: [
|
|
118
118
|
/* @__PURE__ */ a("h2", { children: "There was an error loading the schedule for this day." }),
|
|
119
|
-
/* @__PURE__ */
|
|
119
|
+
/* @__PURE__ */ y("p", { children: [
|
|
120
120
|
"Please try again later. If this problem persists report it at ",
|
|
121
121
|
/* @__PURE__ */ a("a", { href: "https://support.iontelevision.com/support/home", children: "our support page" }),
|
|
122
122
|
"."
|
|
123
123
|
] })
|
|
124
|
-
] }) : S(o) ? /* @__PURE__ */
|
|
124
|
+
] }) : S(o) ? /* @__PURE__ */ y(
|
|
125
125
|
"div",
|
|
126
126
|
{
|
|
127
127
|
className: T([
|
|
@@ -132,14 +132,14 @@ function H({
|
|
|
132
132
|
style: { animationDelay: "500ms" },
|
|
133
133
|
children: [
|
|
134
134
|
/* @__PURE__ */ a("h2", { children: "There are no shows scheduled for this day." }),
|
|
135
|
-
/* @__PURE__ */
|
|
135
|
+
/* @__PURE__ */ y("p", { children: [
|
|
136
136
|
"Please try again later. If this problem persists report it at ",
|
|
137
137
|
/* @__PURE__ */ a("a", { href: "https://support.iontelevision.com/support/home", children: "our support page" }),
|
|
138
138
|
"."
|
|
139
139
|
] })
|
|
140
140
|
]
|
|
141
141
|
}
|
|
142
|
-
) : Array.isArray(o) && o.length === 0 ? /* @__PURE__ */
|
|
142
|
+
) : Array.isArray(o) && o.length === 0 ? /* @__PURE__ */ y(
|
|
143
143
|
"div",
|
|
144
144
|
{
|
|
145
145
|
className: T([
|
|
@@ -159,34 +159,34 @@ function H({
|
|
|
159
159
|
"data-state": n,
|
|
160
160
|
ref: g,
|
|
161
161
|
children: Array.isArray(o) && o.map((i) => {
|
|
162
|
-
const
|
|
162
|
+
const c = u(i.element_length), q = E(i).type === "" ? [c, i.rating] : [c, i.rating, " "];
|
|
163
163
|
return i.program_class === "Episode" ? /* @__PURE__ */ a(
|
|
164
164
|
M,
|
|
165
165
|
{
|
|
166
|
-
determineCTA:
|
|
166
|
+
determineCTA: E,
|
|
167
167
|
handleClicks: r,
|
|
168
168
|
scheduleItem: i,
|
|
169
|
-
strListArr:
|
|
169
|
+
strListArr: q,
|
|
170
170
|
styles: f
|
|
171
171
|
},
|
|
172
172
|
`schedule-list-${i.id}`
|
|
173
173
|
) : i.program_class === "Film" || i.program_class === "Movie" || i.program_class === "Special" ? /* @__PURE__ */ a(
|
|
174
174
|
k,
|
|
175
175
|
{
|
|
176
|
-
determineCTA:
|
|
176
|
+
determineCTA: E,
|
|
177
177
|
handleClicks: r,
|
|
178
178
|
scheduleItem: i,
|
|
179
|
-
strListArr:
|
|
179
|
+
strListArr: q,
|
|
180
180
|
styles: f
|
|
181
181
|
},
|
|
182
182
|
`schedule-list-${i.id}`
|
|
183
183
|
) : i.program_class === "Sports" ? /* @__PURE__ */ a(
|
|
184
184
|
D,
|
|
185
185
|
{
|
|
186
|
-
determineCTA:
|
|
186
|
+
determineCTA: E,
|
|
187
187
|
handleClicks: r,
|
|
188
188
|
scheduleItem: i,
|
|
189
|
-
strListArr:
|
|
189
|
+
strListArr: q,
|
|
190
190
|
styles: f
|
|
191
191
|
},
|
|
192
192
|
`schedule-list-${i.id}`
|
package/package.json
CHANGED