@churchapps/content-providers 0.7.3 → 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.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
- return toAuthData(data, { scope: config.scopes.join(" ") });
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 || "",
@@ -17787,7 +17788,7 @@ function getAvailableProviders(ids) {
17787
17788
  }
17788
17789
 
17789
17790
  // src/index.ts
17790
- var VERSION = true ? "0.7.3" : "dev";
17791
+ var VERSION = true ? "0.8.0" : "dev";
17791
17792
  export {
17792
17793
  APlayProvider,
17793
17794
  B1ChurchProvider,