@umituz/react-native-subscription 2.37.17 → 2.37.19

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.37.17",
3
+ "version": "2.37.19",
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",
@@ -25,9 +25,17 @@ function isTransientError(error: any): boolean {
25
25
  error?.code === 'DEADLINE_EXCEEDED' ||
26
26
  error?.code === 'UNAVAILABLE' ||
27
27
  error?.code === 'RESOURCE_EXHAUSTED' ||
28
+ // Firestore transaction contention: document was modified between our read and write.
29
+ // runTransaction does not auto-retry on failed-precondition, so we do it here.
30
+ error?.code === 'failed-precondition' ||
31
+ error?.code === 'FAILED_PRECONDITION' ||
32
+ // Firestore transaction aborted due to concurrent modification.
33
+ error?.code === 'aborted' ||
34
+ error?.code === 'ABORTED' ||
28
35
  error?.message?.includes('already-exists') ||
29
36
  error?.message?.includes('timeout') ||
30
- error?.message?.includes('unavailable')
37
+ error?.message?.includes('unavailable') ||
38
+ error?.message?.includes('failed-precondition')
31
39
  );
32
40
  }
33
41
 
@@ -54,6 +54,13 @@ export const PaywallContainer: React.FC<PaywallContainerProps> = (props) => {
54
54
  return createCreditAmountsFromPackages(packages, packageAllocations);
55
55
  }, [providedCreditAmounts, packageAllocations, packages]);
56
56
 
57
+ // When using credit system, only show packages that have a credit allocation.
58
+ // This filters out lifetime/"unlimited" plans that aren't part of the credit model.
59
+ const displayPackages = useMemo(() => {
60
+ if (!creditAmounts || Object.keys(creditAmounts).length === 0) return packages;
61
+ return packages.filter((pkg) => creditAmounts[pkg.product.identifier] != null);
62
+ }, [packages, creditAmounts]);
63
+
57
64
  if (!isVisible) return null;
58
65
 
59
66
  return (
@@ -61,7 +68,7 @@ export const PaywallContainer: React.FC<PaywallContainerProps> = (props) => {
61
68
  visible={isVisible}
62
69
  onClose={handleClose}
63
70
  translations={translations}
64
- packages={packages}
71
+ packages={displayPackages}
65
72
  legalUrls={legalUrls}
66
73
  features={features ? [...features] : undefined}
67
74
  heroImage={heroImage}