@churchapps/content-providers 0.7.2 → 0.8.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.
- package/dist/index.cjs +7 -6
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +3 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.js +7 -6
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -82,7 +82,9 @@ interface ContentFile {
|
|
|
82
82
|
type ContentItem = ContentFolder | ContentFile;
|
|
83
83
|
declare function isContentFolder(item: ContentItem): item is ContentFolder;
|
|
84
84
|
declare function isContentFile(item: ContentItem): item is ContentFile;
|
|
85
|
-
type DeviceFlowPollResult = ContentProviderAuthData
|
|
85
|
+
type DeviceFlowPollResult = (ContentProviderAuthData & {
|
|
86
|
+
planTypeId?: string;
|
|
87
|
+
}) | {
|
|
86
88
|
error: string;
|
|
87
89
|
shouldSlowDown?: boolean;
|
|
88
90
|
} | null;
|
package/dist/index.d.ts
CHANGED
|
@@ -82,7 +82,9 @@ interface ContentFile {
|
|
|
82
82
|
type ContentItem = ContentFolder | ContentFile;
|
|
83
83
|
declare function isContentFolder(item: ContentItem): item is ContentFolder;
|
|
84
84
|
declare function isContentFile(item: ContentItem): item is ContentFile;
|
|
85
|
-
type DeviceFlowPollResult = ContentProviderAuthData
|
|
85
|
+
type DeviceFlowPollResult = (ContentProviderAuthData & {
|
|
86
|
+
planTypeId?: string;
|
|
87
|
+
}) | {
|
|
86
88
|
error: string;
|
|
87
89
|
shouldSlowDown?: boolean;
|
|
88
90
|
} | null;
|
package/dist/index.js
CHANGED
|
@@ -151,7 +151,8 @@ var DeviceFlowHelper = class {
|
|
|
151
151
|
const response = await fetch(`${config.oauthBase}/token`, { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify({ grant_type: "urn:ietf:params:oauth:grant-type:device_code", device_code: deviceCode, client_id: config.clientId }) });
|
|
152
152
|
if (response.ok) {
|
|
153
153
|
const data = await response.json();
|
|
154
|
-
|
|
154
|
+
const auth = toAuthData(data, { scope: config.scopes.join(" ") });
|
|
155
|
+
return data.plan_type_id ? { ...auth, planTypeId: data.plan_type_id } : auth;
|
|
155
156
|
}
|
|
156
157
|
const errorData = await response.json();
|
|
157
158
|
switch (errorData.error) {
|
|
@@ -659,7 +660,7 @@ async function convertAddOnToFile(addOn) {
|
|
|
659
660
|
} else {
|
|
660
661
|
return null;
|
|
661
662
|
}
|
|
662
|
-
return { type: "file", id: addOn.id, title: addOn.name, mediaType, thumbnail: addOn.image, url, downloadUrl: url, seconds, loopVideo: video?.loopVideo || false };
|
|
663
|
+
return { type: "file", id: addOn.id, title: addOn.name ?? detail.name, mediaType, thumbnail: addOn.image ?? detail.image, url, downloadUrl: url, seconds, loopVideo: video?.loopVideo || false };
|
|
663
664
|
}
|
|
664
665
|
function buildSectionActionsMap(actionsResponse, lessonImage, feedResponse) {
|
|
665
666
|
const sectionActionsMap = /* @__PURE__ */ new Map();
|
|
@@ -1184,7 +1185,7 @@ var SECTION_TYPES = /* @__PURE__ */ new Set(["item", "section", "lessonSection",
|
|
|
1184
1185
|
var ACTION_TYPES = /* @__PURE__ */ new Set(["action", "lessonAction", "providerPresentation", "lessonAddOn", "addon", "providerFile", "file"]);
|
|
1185
1186
|
function collectFilesFromNode(node) {
|
|
1186
1187
|
const files = [];
|
|
1187
|
-
if (node.downloadUrl) {
|
|
1188
|
+
if (node.downloadUrl && (node.itemType === "file" || !node.children?.length)) {
|
|
1188
1189
|
files.push({
|
|
1189
1190
|
id: node.id,
|
|
1190
1191
|
name: node.label || "",
|
|
@@ -1343,8 +1344,8 @@ var B1ChurchProvider = class extends BaseProvider {
|
|
|
1343
1344
|
const allPlans = await fetchPlans(planTypeId, authData);
|
|
1344
1345
|
const yesterday = /* @__PURE__ */ new Date();
|
|
1345
1346
|
yesterday.setDate(yesterday.getDate() - 1);
|
|
1346
|
-
yesterday.
|
|
1347
|
-
const plans = allPlans.filter((p) =>
|
|
1347
|
+
const cutoff = `${yesterday.getFullYear()}-${String(yesterday.getMonth() + 1).padStart(2, "0")}-${String(yesterday.getDate()).padStart(2, "0")}`;
|
|
1348
|
+
const plans = allPlans.filter((p) => String(p.serviceDate).slice(0, 10) >= cutoff);
|
|
1348
1349
|
plans.sort((a, b) => new Date(a.serviceDate).getTime() - new Date(b.serviceDate).getTime());
|
|
1349
1350
|
const imageMap = await this.fetchPlanImages(plans, ministryId, authData);
|
|
1350
1351
|
return plans.map((p) => {
|
|
@@ -17787,7 +17788,7 @@ function getAvailableProviders(ids) {
|
|
|
17787
17788
|
}
|
|
17788
17789
|
|
|
17789
17790
|
// src/index.ts
|
|
17790
|
-
var VERSION = true ? "0.
|
|
17791
|
+
var VERSION = true ? "0.8.0" : "dev";
|
|
17791
17792
|
export {
|
|
17792
17793
|
APlayProvider,
|
|
17793
17794
|
B1ChurchProvider,
|