@umituz/react-native-subscription 2.13.21 → 2.14.1

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@umituz/react-native-subscription",
3
- "version": "2.13.21",
3
+ "version": "2.14.1",
4
4
  "description": "Complete subscription management with RevenueCat, paywall UI, and credits system for React Native apps",
5
5
  "main": "./src/index.ts",
6
6
  "types": "./src/index.ts",
@@ -39,6 +39,8 @@ export interface RevenueCatConfig {
39
39
  productId: string,
40
40
  renewalId: string
41
41
  ) => Promise<void> | void;
42
+ /** Callback after credits are successfully updated (for cache invalidation) */
43
+ onCreditsUpdated?: (userId: string) => void;
42
44
  }
43
45
 
44
46
  export interface RevenueCatConfigRequired {
@@ -125,6 +125,11 @@ export class CustomerInfoListenerManager {
125
125
  productId,
126
126
  }
127
127
  );
128
+
129
+ // Notify app to invalidate credits cache
130
+ if (config.onCreditsUpdated && this.currentUserId) {
131
+ config.onCreditsUpdated(this.currentUserId);
132
+ }
128
133
  } catch (error) {
129
134
  if (__DEV__) {
130
135
  console.error("[CustomerInfoListener] ❌ Credit renewal failed", {
@@ -68,8 +68,7 @@ describe('Date Validation Utils', () => {
68
68
  syncedAt: '2024-01-01T00:00:00.000Z',
69
69
  };
70
70
 
71
- const result = getDaysUntilExpiration(status);
72
- expect(result === 0 || result === -0).toBe(true);
71
+ expect(getDaysUntilExpiration(status)).toBe(0);
73
72
  });
74
73
  });
75
74