@sudobility/subscription_service 1.0.11 → 1.0.13

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.
@@ -23,6 +23,7 @@ export interface SubscriptionHelperConfig {
23
23
  *
24
24
  * Uses the RevenueCat REST API v1 endpoint `GET /subscribers/{user_id}` to
25
25
  * fetch subscriber data, then filters entitlements by expiration and sandbox status.
26
+ * Detects the subscription platform from the store field in the response.
26
27
  */
27
28
  export declare class SubscriptionHelper {
28
29
  private readonly apiKey;
@@ -46,15 +47,16 @@ export declare class SubscriptionHelper {
46
47
  */
47
48
  getEntitlements(userId: string, testMode?: boolean): Promise<string[]>;
48
49
  /**
49
- * Get full subscription info including entitlements and subscription start date.
50
+ * Get full subscription info including entitlements, subscription start date,
51
+ * and platform.
50
52
  *
51
53
  * Fetches the subscriber data from RevenueCat, filters out expired entitlements
52
54
  * and (optionally) sandbox purchases, and returns the active entitlement names
53
- * along with the earliest purchase date.
55
+ * along with the earliest purchase date and the platform it came from.
54
56
  *
55
57
  * @param userId - The RevenueCat user identifier.
56
58
  * @param testMode - When true, includes sandbox purchases. Defaults to false.
57
- * @returns Subscription info with active entitlements and earliest purchase date.
59
+ * @returns Subscription info with active entitlements, earliest purchase date, and platform.
58
60
  * @throws Error if the RevenueCat API returns a non-404, non-OK response.
59
61
  */
60
62
  getSubscriptionInfo(userId: string, testMode?: boolean): Promise<SubscriptionInfo>;
@@ -1 +1 @@
1
- {"version":3,"file":"SubscriptionHelper.d.ts","sourceRoot":"","sources":["../../src/helpers/SubscriptionHelper.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAIH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAE9D;;GAEG;AACH,MAAM,WAAW,wBAAwB;IACvC,sDAAsD;IACtD,gBAAgB,EAAE,MAAM,CAAC;IACzB,6EAA6E;IAC7E,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,uEAAuE;IACvE,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AAM,EAAE,MAAM,EACd,QAAQ,GAAE,OAAe,GACxB,OAAO,CAAC,gBAAgB,CAAC;CAqF7B"}
@@ -5,13 +5,22 @@
5
5
  * to fetch user entitlements and subscription information. Handles sandbox
6
6
  * filtering via the `testMode` parameter.
7
7
  */
8
- import { NONE_ENTITLEMENT } from "@sudobility/types";
8
+ import { NONE_ENTITLEMENT, SubscriptionPlatform } from "@sudobility/types";
9
+ /** Maps RevenueCat store identifiers to SubscriptionPlatform values. */
10
+ const STORE_PLATFORM_MAP = {
11
+ stripe: SubscriptionPlatform.Web,
12
+ rc_billing: SubscriptionPlatform.Web,
13
+ app_store: SubscriptionPlatform.iOS,
14
+ play_store: SubscriptionPlatform.Android,
15
+ mac_app_store: SubscriptionPlatform.macOS,
16
+ };
9
17
  /**
10
18
  * Helper class for interacting with RevenueCat API to get user entitlements
11
19
  * and subscription information.
12
20
  *
13
21
  * Uses the RevenueCat REST API v1 endpoint `GET /subscribers/{user_id}` to
14
22
  * fetch subscriber data, then filters entitlements by expiration and sandbox status.
23
+ * Detects the subscription platform from the store field in the response.
15
24
  */
16
25
  export class SubscriptionHelper {
17
26
  /**
@@ -42,15 +51,16 @@ export class SubscriptionHelper {
42
51
  return info.entitlements;
43
52
  }
44
53
  /**
45
- * Get full subscription info including entitlements and subscription start date.
54
+ * Get full subscription info including entitlements, subscription start date,
55
+ * and platform.
46
56
  *
47
57
  * Fetches the subscriber data from RevenueCat, filters out expired entitlements
48
58
  * and (optionally) sandbox purchases, and returns the active entitlement names
49
- * along with the earliest purchase date.
59
+ * along with the earliest purchase date and the platform it came from.
50
60
  *
51
61
  * @param userId - The RevenueCat user identifier.
52
62
  * @param testMode - When true, includes sandbox purchases. Defaults to false.
53
- * @returns Subscription info with active entitlements and earliest purchase date.
63
+ * @returns Subscription info with active entitlements, earliest purchase date, and platform.
54
64
  * @throws Error if the RevenueCat API returns a non-404, non-OK response.
55
65
  */
56
66
  async getSubscriptionInfo(userId, testMode = false) {
@@ -78,6 +88,7 @@ export class SubscriptionHelper {
78
88
  return {
79
89
  entitlements: [NONE_ENTITLEMENT],
80
90
  subscriptionStartedAt: null,
91
+ platform: null,
81
92
  };
82
93
  }
83
94
  if (!response.ok) {
@@ -89,30 +100,36 @@ export class SubscriptionHelper {
89
100
  const now = new Date();
90
101
  const activeEntitlements = [];
91
102
  let earliestPurchaseDate = null;
103
+ let resultPlatform = null;
92
104
  for (const [name, entitlement] of Object.entries(entitlements)) {
93
105
  const isActive = !entitlement.expires_date || new Date(entitlement.expires_date) > now;
94
106
  if (!isActive) {
95
107
  continue;
96
108
  }
97
109
  const subscription = subscriptions[entitlement.product_identifier];
98
- if (!testMode && subscription?.sandbox === true) {
110
+ // Filter sandbox purchases in production mode
111
+ if (!testMode && subscription?.environment === "sandbox") {
99
112
  continue;
100
113
  }
101
114
  activeEntitlements.push(name);
102
115
  const purchaseDate = new Date(entitlement.purchase_date);
103
116
  if (!earliestPurchaseDate || purchaseDate < earliestPurchaseDate) {
104
117
  earliestPurchaseDate = purchaseDate;
118
+ resultPlatform =
119
+ STORE_PLATFORM_MAP[subscription?.store ?? ""] ?? null;
105
120
  }
106
121
  }
107
122
  if (activeEntitlements.length === 0) {
108
123
  return {
109
124
  entitlements: [NONE_ENTITLEMENT],
110
125
  subscriptionStartedAt: null,
126
+ platform: null,
111
127
  };
112
128
  }
113
129
  return {
114
130
  entitlements: activeEntitlements,
115
131
  subscriptionStartedAt: earliestPurchaseDate,
132
+ platform: resultPlatform,
116
133
  };
117
134
  }
118
135
  }
@@ -1 +1 @@
1
- {"version":3,"file":"SubscriptionHelper.js","sourceRoot":"","sources":["../../src/helpers/SubscriptionHelper.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAgBrD;;;;;;GAMG;AACH,MAAM,OAAO,kBAAkB;IAK7B;;;;OAIG;IACH,YAAY,MAAgC;QAC1C,IAAI,CAAC,MAAM,GAAG,MAAM,C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AoB,EAAE,CAAC;gBACjE,oBAAoB,GAAG,YAAY,CAAC;gBACpC,cAAc;oBACZ,kBAAkB,CAAC,YAAY,EAAE,KAAK,IAAI,EAAE,CAAC,IAAI,IAAI,CAAC;YAC1D,CAAC;QACH,CAAC;QAED,IAAI,kBAAkB,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YACpC,OAAO;gBACL,YAAY,EAAE,CAAC,gBAAgB,CAAC;gBAChC,qBAAqB,EAAE,IAAI;gBAC3B,QAAQ,EAAE,IAAI;aACf,CAAC;QACJ,CAAC;QAED,OAAO;YACL,YAAY,EAAE,kBAAkB;YAChC,qBAAqB,EAAE,oBAAoB;YAC3C,QAAQ,EAAE,cAAc;SACzB,CAAC;IACJ,CAAC;CACF"}
@@ -29,6 +29,8 @@ export interface RevenueCatSubscription {
29
29
  sandbox: boolean;
30
30
  /** Store where the purchase was made */
31
31
  store: string;
32
+ /** Environment: "sandbox" or "production" (present on iOS/Android/macOS subscriptions) */
33
+ environment?: string;
32
34
  }
33
35
  /**
34
36
  * Response shape from RevenueCat's GET /subscribers/{user_id} endpoint.
@@ -1 +1 @@
1
- {"version":3,"file":"entitlements.d.ts","sourceRoot":"","sources":["../../src/types/entitlements.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH;;GAEG;AACH,MAAM,WAAW,qBAAqB;IACpC,yDAAyD;IACzD,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,mCAAmC;IACnC,yBAAyB,EAAE,MAAM,GAAG,IAAI,CAAC;IACzC,0CAA0C;IAC1C,kBAAkB,EAAE,MAAM,CAAC;IAC3B,kCAAkC;IAClC,aAAa,EAAE,MAAM,CAAC;CACvB;AAED;;GAEG;AACH,MAAM,WAAW,sBAAsB;IACrC,yDAAyD;IACzD,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,kCAAkC;IAClC,aAAa,EAAE,MAAM,CAAC;IACtB,yCAAyC;IACzC,OAAO,EAAE,OAAO,CAAC;IACjB,wCAAwC;IACxC,KAAK,EAAE,MAAM,CAAC;CACf;AAED;;GAEG;AACH,MAAM,WAAW,4BAA4B;IAC3C,UAAU,EAAE;QACV,YAAY,EAAE;YACZ,CAAC,GAAG,EAAE,MAAM,GAAG,qBAAqB,CAAC;SACtC,CAAC;QACF,aAAa,EAAE;YACb,CAAC,GAAG,EAAE,MAAM,GAAG,sBAAsB,CAAC;SACvC,CAAC;KACH,CAAC;CACH"}
1
+ {"version":3,"file":"entitlements.d.ts","sourceRoot":"","sources":["../../src/types/entitlements.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH;;GAEG;AACH,MAAM,WAAW,qBAAqB;IACpC,yDAAyD;IACzD,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,mCAAmC;IACnC,yBAAyB,EAAE,MAAM,GAAG,IAAI,CAAC;IACzC,0CAA0C;IAC1C,kBAAkB,EAAE,MAAM,CAAC;IAC3B,kCAAkC;IAClC,aAAa,EAAE,MAAM,CAAC;CACvB;AAED;;GAEG;AACH,MAAM,WAAW,sBAAsB;IACrC,yDAAyD;IACzD,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,kCAAkC;IAClC,aAAa,EAAE,MAAM,CAAC;IACtB,yCAAyC;IACzC,OAAO,EAAE,OAAO,CAAC;IACjB,wCAAwC;IACxC,KAAK,EAAE,MAAM,CAAC;IACd,0FAA0F;IAC1F,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED;;GAEG;AACH,MAAM,WAAW,4BAA4B;IAC3C,UAAU,EAAE;QACV,YAAY,EAAE;YACZ,CAAC,GAAG,EAAE,MAAM,GAAG,qBAAqB,CAAC;SACtC,CAAC;QACF,aAAa,EAAE;YACb,CAAC,GAAG,EAAE,MAAM,GAAG,sBAAsB,CAAC;SACvC,CAAC;KACH,CAAC;CACH"}
@@ -1,6 +1,7 @@
1
1
  /**
2
2
  * @fileoverview Domain types for subscription information returned by SubscriptionHelper.
3
3
  */
4
+ import { SubscriptionPlatform } from "@sudobility/types";
4
5
  /**
5
6
  * Subscription information returned by SubscriptionHelper.
6
7
  */
@@ -9,5 +10,7 @@ export interface SubscriptionInfo {
9
10
  entitlements: string[];
10
11
  /** When the subscription started (earliest purchase date), or null if no subscription */
11
12
  subscriptionStartedAt: Date | null;
13
+ /** Platform where the subscription was purchased, or null if no subscription */
14
+ platform: SubscriptionPlatform | null;
12
15
  }
13
16
  //# sourceMappingURL=subscription.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"subscription.d.ts","sourceRoot":"","sources":["../../src/types/subscription.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B,+EAA+E;IAC/E,YAAY,EAAE,MAAM,EAAE,CAAC;IACvB,yFAAyF;IACzF,qBAAqB,EAAE,IAAI,GAAG,IAAI,CAAC;CACpC"}
1
+ {"version":3,"file":"subscription.d.ts","sourceRoot":"","sources":["../../src/types/subscription.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AAEzD;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B,+EAA+E;IAC/E,YAAY,EAAE,MAAM,EAAE,CAAC;IACvB,yFAAyF;IACzF,qBAAqB,EAAE,IAAI,GAAG,IAAI,CAAC;IACnC,gFAAgF;IAChF,QAAQ,EAAE,oBAAoB,GAAG,IAAI,CAAC;CACvC"}
package/package.json CHANGED
@@ -1,16 +1,41 @@
1
1
  {
2
2
  "name": "@sudobility/subscription_service",
3
- "version": "1.0.11",
4
- "description": "Shared subscription management library using RevenueCat for entitlements",
5
- "type": "module",
3
+ "version": "1.0.13",
4
+ "author": "Sudobility",
6
5
  "main": "./dist/index.js",
7
- "types": "./dist/index.d.ts",
6
+ "devDependencies": {
7
+ "@sudobility/types": "^1.9.59",
8
+ "@types/bun": "latest",
9
+ "@types/node": "^24.0.0",
10
+ "@typescript-eslint/eslint-plugin": "^8.50.0",
11
+ "@typescript-eslint/parser": "^8.50.0",
12
+ "eslint": "^9.39.0",
13
+ "eslint-plugin-import": "^2.32.0",
14
+ "prettier": "^3.7.0",
15
+ "typescript": "^5.9.0",
16
+ "vitest": "^4.0.4"
17
+ },
8
18
  "exports": {
9
19
  ".": {
10
20
  "import": "./dist/index.js",
11
21
  "types": "./dist/index.d.ts"
12
22
  }
13
23
  },
24
+ "description": "Shared subscription management library using RevenueCat for entitlements",
25
+ "files": [
26
+ "dist/**/*",
27
+ "CLAUDE.md"
28
+ ],
29
+ "keywords": [
30
+ "subscription",
31
+ "revenuecat",
32
+ "entitlements",
33
+ "in-app-purchase"
34
+ ],
35
+ "license": "BUSL-1.1",
36
+ "publishConfig": {
37
+ "access": "public"
38
+ },
14
39
  "scripts": {
15
40
  "build": "tsc -p tsconfig.esm.json",
16
41
  "clean": "rm -rf dist",
@@ -25,33 +50,6 @@
25
50
  "verify": "bun run typecheck && bun run lint && bun run test && bun run build",
26
51
  "prepublishOnly": "bun run clean && bun run verify"
27
52
  },
28
- "files": [
29
- "dist/**/*",
30
- "CLAUDE.md"
31
- ],
32
- "keywords": [
33
- "subscription",
34
- "revenuecat",
35
- "entitlements",
36
- "in-app-purchase"
37
- ],
38
- "author": "Sudobility",
39
- "license": "BUSL-1.1",
40
- "peerDependencies": {
41
- "@sudobility/types": "^1.9.59"
42
- },
43
- "devDependencies": {
44
- "vitest": "^4.0.4",
45
- "@types/bun": "latest",
46
- "@types/node": "^24.0.0",
47
- "@typescript-eslint/eslint-plugin": "^8.50.0",
48
- "@typescript-eslint/parser": "^8.50.0",
49
- "eslint": "^9.39.0",
50
- "eslint-plugin-import": "^2.32.0",
51
- "prettier": "^3.7.0",
52
- "typescript": "^5.9.0"
53
- },
54
- "publishConfig": {
55
- "access": "public"
56
- }
53
+ "type": "module",
54
+ "types": "./dist/index.d.ts"
57
55
  }