@churchapps/content-providers 0.1.4 → 0.1.5
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.
- package/dist/index.cjs +33 -18
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +33 -18
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -12497,13 +12497,13 @@ var JesusFilmProvider = class {
|
|
|
12497
12497
|
const { segments, depth } = parsePath(path);
|
|
12498
12498
|
if (depth === 0) return this.getCategories();
|
|
12499
12499
|
if (depth === 1) return this.getItemsInCategory(segments[0]);
|
|
12500
|
-
|
|
12501
|
-
|
|
12502
|
-
|
|
12503
|
-
|
|
12504
|
-
|
|
12505
|
-
if (
|
|
12506
|
-
return
|
|
12500
|
+
const category = segments[0];
|
|
12501
|
+
const lastId = segments[depth - 1];
|
|
12502
|
+
if (depth === 2 && category === "feature-films") return this.getVideoFile(lastId);
|
|
12503
|
+
const pathPrefix = "/" + segments.join("/");
|
|
12504
|
+
const children = await this.getContainerChildren(lastId, pathPrefix);
|
|
12505
|
+
if (children.length > 0) return children;
|
|
12506
|
+
return this.getVideoFile(lastId);
|
|
12507
12507
|
}
|
|
12508
12508
|
getCategories() {
|
|
12509
12509
|
return [
|
|
@@ -12552,7 +12552,7 @@ var JesusFilmProvider = class {
|
|
|
12552
12552
|
})
|
|
12553
12553
|
];
|
|
12554
12554
|
}
|
|
12555
|
-
async getContainerChildren(containerId,
|
|
12555
|
+
async getContainerChildren(containerId, pathPrefix) {
|
|
12556
12556
|
const linksData = await this.fetchApi(
|
|
12557
12557
|
`/media-component-links/${containerId}`
|
|
12558
12558
|
);
|
|
@@ -12566,9 +12566,9 @@ var JesusFilmProvider = class {
|
|
|
12566
12566
|
return childrenData._embedded.mediaComponents.map((item) => createFolder(
|
|
12567
12567
|
item.mediaComponentId,
|
|
12568
12568
|
item.title,
|
|
12569
|
-
|
|
12569
|
+
`${pathPrefix}/${item.mediaComponentId}`,
|
|
12570
12570
|
item.imageUrls.mobileCinematicHigh || item.imageUrls.videoStill || item.imageUrls.thumbnail,
|
|
12571
|
-
|
|
12571
|
+
item.containsCount === 0
|
|
12572
12572
|
));
|
|
12573
12573
|
}
|
|
12574
12574
|
extractMuxPlaybackId(url) {
|
|
@@ -12579,10 +12579,13 @@ var JesusFilmProvider = class {
|
|
|
12579
12579
|
const { segments, depth } = parsePath(path);
|
|
12580
12580
|
if (depth < 1) return null;
|
|
12581
12581
|
const category = segments[0];
|
|
12582
|
-
if (depth
|
|
12583
|
-
const
|
|
12584
|
-
|
|
12585
|
-
|
|
12582
|
+
if (depth >= 3) {
|
|
12583
|
+
const lastId = segments[depth - 1];
|
|
12584
|
+
const items = await this.getVideoFile(lastId);
|
|
12585
|
+
const files2 = items.filter((item) => item.type === "file");
|
|
12586
|
+
if (files2.length > 0) return files2;
|
|
12587
|
+
const containerFiles = await this.fetchContainerVideoFiles(lastId);
|
|
12588
|
+
return containerFiles.length > 0 ? containerFiles : null;
|
|
12586
12589
|
}
|
|
12587
12590
|
if (depth === 2) {
|
|
12588
12591
|
if (category === "feature-films") {
|
|
@@ -12598,7 +12601,7 @@ var JesusFilmProvider = class {
|
|
|
12598
12601
|
const data = await this.fetchApi(
|
|
12599
12602
|
`/media-components?filter=master&subTypes=${subType}&languageIds=${LANGUAGE_ID}&limit=100`
|
|
12600
12603
|
);
|
|
12601
|
-
const contentComponents = data._embedded.mediaComponents.filter((item) => item.
|
|
12604
|
+
const contentComponents = data._embedded.mediaComponents.filter((item) => item.containsCount === 0);
|
|
12602
12605
|
const files = await this.fetchVideoFiles(contentComponents);
|
|
12603
12606
|
return files.length > 0 ? files : null;
|
|
12604
12607
|
}
|
|
@@ -12637,7 +12640,14 @@ var JesusFilmProvider = class {
|
|
|
12637
12640
|
`/media-components?ids=${idsParam}&languageIds=${LANGUAGE_ID}`
|
|
12638
12641
|
);
|
|
12639
12642
|
if (!childrenData._embedded?.mediaComponents) return [];
|
|
12640
|
-
|
|
12643
|
+
const contentItems = childrenData._embedded.mediaComponents.filter((c) => c.containsCount === 0);
|
|
12644
|
+
const containerItems = childrenData._embedded.mediaComponents.filter((c) => c.containsCount > 0);
|
|
12645
|
+
const files = await this.fetchVideoFiles(contentItems);
|
|
12646
|
+
for (const container of containerItems) {
|
|
12647
|
+
const nested = await this.fetchContainerVideoFiles(container.mediaComponentId);
|
|
12648
|
+
files.push(...nested);
|
|
12649
|
+
}
|
|
12650
|
+
return files;
|
|
12641
12651
|
}
|
|
12642
12652
|
async buildVideoInstructions(mediaComponentId, category) {
|
|
12643
12653
|
const items = await this.getVideoFile(mediaComponentId);
|
|
@@ -12712,7 +12722,7 @@ var JesusFilmProvider = class {
|
|
|
12712
12722
|
const actionItems = await Promise.all(
|
|
12713
12723
|
data._embedded.mediaComponents.map(async (component) => {
|
|
12714
12724
|
let downloadUrl;
|
|
12715
|
-
if (component.
|
|
12725
|
+
if (component.containsCount === 0) {
|
|
12716
12726
|
try {
|
|
12717
12727
|
const variant = await this.fetchApi(
|
|
12718
12728
|
`/media-components/${component.mediaComponentId}/languages/${LANGUAGE_ID}?platform=web`
|
|
@@ -12750,7 +12760,12 @@ var JesusFilmProvider = class {
|
|
|
12750
12760
|
if (category === "feature-films") return this.buildVideoInstructions(segments[1], category);
|
|
12751
12761
|
return this.buildContainerInstructions(segments[1], category);
|
|
12752
12762
|
}
|
|
12753
|
-
if (depth
|
|
12763
|
+
if (depth >= 3) {
|
|
12764
|
+
const lastId = segments[depth - 1];
|
|
12765
|
+
const videoResult = await this.buildVideoInstructions(lastId, category);
|
|
12766
|
+
if (videoResult) return videoResult;
|
|
12767
|
+
return this.buildContainerInstructions(lastId, category);
|
|
12768
|
+
}
|
|
12754
12769
|
return null;
|
|
12755
12770
|
}
|
|
12756
12771
|
supportsDeviceFlow() {
|