@umituz/react-native-subscription 2.13.14 → 2.13.15

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.14",
3
+ "version": "2.13.15",
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",
@@ -97,18 +97,52 @@ export function createCreditAmountsFromPackages(
97
97
  ): Record<string, number> {
98
98
  const result: Record<string, number> = {};
99
99
 
100
+ if (__DEV__) {
101
+ console.log("[CreditMapper] Input packages count:", packages?.length || 0);
102
+ }
103
+
104
+ if (!packages || packages.length === 0) {
105
+ if (__DEV__) {
106
+ console.log("[CreditMapper] No packages provided, returning empty object");
107
+ }
108
+ return result;
109
+ }
110
+
100
111
  for (const pkg of packages) {
101
- const identifier = pkg.product.identifier;
112
+ const identifier = pkg?.product?.identifier;
113
+
114
+ if (__DEV__) {
115
+ console.log("[CreditMapper] Processing package:", {
116
+ hasProduct: !!pkg?.product,
117
+ identifier,
118
+ });
119
+ }
120
+
121
+ if (!identifier) {
122
+ if (__DEV__) {
123
+ console.warn("[CreditMapper] Package missing product.identifier:", pkg);
124
+ }
125
+ continue;
126
+ }
127
+
102
128
  const packageType = detectPackageType(identifier);
103
129
  const credits = getImageCreditsForPackage(packageType);
104
130
 
131
+ if (__DEV__) {
132
+ console.log("[CreditMapper] Package mapping:", {
133
+ identifier,
134
+ packageType,
135
+ credits,
136
+ });
137
+ }
138
+
105
139
  if (credits !== null) {
106
140
  result[identifier] = credits;
107
141
  }
108
142
  }
109
143
 
110
144
  if (__DEV__) {
111
- console.log("[CreditMapper] Created credit amounts from packages:", result);
145
+ console.log("[CreditMapper] Final credit amounts:", result);
112
146
  }
113
147
 
114
148
  return result;