@churchapps/content-providers 0.9.2 → 0.9.3

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
@@ -259,7 +259,10 @@ declare class OAuthHelper {
259
259
  declare function toAuthData(data: Record<string, unknown>, fallbacks?: {
260
260
  refreshToken?: string;
261
261
  scope?: string;
262
- }): ContentProviderAuthData;
262
+ planTypeId?: string;
263
+ }): ContentProviderAuthData & {
264
+ planTypeId?: string;
265
+ };
263
266
  declare class TokenHelper {
264
267
  isAuthValid(auth: ContentProviderAuthData | null | undefined): boolean;
265
268
  isTokenExpired(auth: ContentProviderAuthData): boolean;
package/dist/index.d.ts CHANGED
@@ -259,7 +259,10 @@ declare class OAuthHelper {
259
259
  declare function toAuthData(data: Record<string, unknown>, fallbacks?: {
260
260
  refreshToken?: string;
261
261
  scope?: string;
262
- }): ContentProviderAuthData;
262
+ planTypeId?: string;
263
+ }): ContentProviderAuthData & {
264
+ planTypeId?: string;
265
+ };
263
266
  declare class TokenHelper {
264
267
  isAuthValid(auth: ContentProviderAuthData | null | undefined): boolean;
265
268
  isTokenExpired(auth: ContentProviderAuthData): boolean;
package/dist/index.js CHANGED
@@ -20,13 +20,15 @@ function navigateToPath(instructions, path) {
20
20
 
21
21
  // src/helpers/TokenHelper.ts
22
22
  function toAuthData(data, fallbacks) {
23
+ const planTypeId = data.plan_type_id || fallbacks?.planTypeId;
23
24
  return {
24
25
  access_token: data.access_token,
25
26
  refresh_token: data.refresh_token || fallbacks?.refreshToken || "",
26
27
  token_type: data.token_type || "Bearer",
27
28
  created_at: Math.floor(Date.now() / 1e3),
28
29
  expires_in: data.expires_in,
29
- scope: data.scope || fallbacks?.scope || ""
30
+ scope: data.scope || fallbacks?.scope || "",
31
+ ...planTypeId ? { planTypeId } : {}
30
32
  };
31
33
  }
32
34
  var TokenHelper = class {
@@ -54,7 +56,8 @@ var TokenHelper = class {
54
56
  return null;
55
57
  }
56
58
  const data = await response.json();
57
- return toAuthData(data, { refreshToken: auth.refresh_token, scope: auth.scope });
59
+ const planTypeId = auth.planTypeId;
60
+ return toAuthData(data, { refreshToken: auth.refresh_token, scope: auth.scope, planTypeId });
58
61
  } catch {
59
62
  return null;
60
63
  }
@@ -1432,9 +1435,7 @@ var B1ChurchProvider = class extends BaseProvider {
1432
1435
  setPairingData(data) {
1433
1436
  if (data && typeof data === "object" && "planTypeId" in data) {
1434
1437
  const planTypeId = data.planTypeId;
1435
- this.planTypeId = typeof planTypeId === "string" ? planTypeId : null;
1436
- } else {
1437
- this.planTypeId = null;
1438
+ if (typeof planTypeId === "string") this.planTypeId = planTypeId;
1438
1439
  }
1439
1440
  }
1440
1441
  async getCurrentPlan(authData) {
@@ -17970,7 +17971,7 @@ function getAvailableProviders(ids) {
17970
17971
  }
17971
17972
 
17972
17973
  // src/index.ts
17973
- var VERSION = true ? "0.9.2" : "dev";
17974
+ var VERSION = true ? "0.9.3" : "dev";
17974
17975
  export {
17975
17976
  APlayProvider,
17976
17977
  B1ChurchProvider,