@umituz/react-native-subscription 2.27.115 → 2.27.117

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.
Files changed (36) hide show
  1. package/package.json +4 -4
  2. package/src/domains/credits/infrastructure/CreditsRepository.ts +16 -19
  3. package/src/domains/credits/utils/creditCalculations.ts +6 -11
  4. package/src/domains/wallet/infrastructure/repositories/TransactionRepository.ts +17 -41
  5. package/src/domains/wallet/infrastructure/services/ProductMetadataService.ts +2 -6
  6. package/src/shared/infrastructure/firestore/collectionUtils.ts +67 -0
  7. package/src/shared/infrastructure/firestore/index.ts +6 -0
  8. package/src/shared/infrastructure/firestore/resultUtils.ts +68 -0
  9. package/src/shared/infrastructure/index.ts +6 -0
  10. package/src/shared/presentation/hooks/index.ts +6 -0
  11. package/src/shared/presentation/hooks/useAsyncState.ts +72 -0
  12. package/src/shared/presentation/hooks/useServiceCall.ts +66 -0
  13. package/src/shared/types/CommonTypes.ts +6 -1
  14. package/src/shared/types/ReactTypes.ts +80 -0
  15. package/src/shared/utils/arrayUtils.core.ts +81 -0
  16. package/src/shared/utils/arrayUtils.query.ts +118 -0
  17. package/src/shared/utils/arrayUtils.transforms.ts +116 -0
  18. package/src/shared/utils/arrayUtils.ts +19 -0
  19. package/src/shared/utils/index.ts +14 -0
  20. package/src/shared/utils/numberUtils.aggregate.ts +35 -0
  21. package/src/shared/utils/numberUtils.core.ts +73 -0
  22. package/src/shared/utils/numberUtils.format.ts +42 -0
  23. package/src/shared/utils/numberUtils.math.ts +48 -0
  24. package/src/shared/utils/numberUtils.ts +9 -0
  25. package/src/shared/utils/stringUtils.case.ts +64 -0
  26. package/src/shared/utils/stringUtils.check.ts +65 -0
  27. package/src/shared/utils/stringUtils.format.ts +84 -0
  28. package/src/shared/utils/stringUtils.generate.ts +47 -0
  29. package/src/shared/utils/stringUtils.modify.ts +67 -0
  30. package/src/shared/utils/stringUtils.ts +10 -0
  31. package/src/shared/utils/validators.ts +187 -0
  32. package/src/utils/dateUtils.compare.ts +65 -0
  33. package/src/utils/dateUtils.core.ts +67 -0
  34. package/src/utils/dateUtils.format.ts +138 -0
  35. package/src/utils/dateUtils.math.ts +112 -0
  36. package/src/utils/dateUtils.ts +6 -28
@@ -0,0 +1,112 @@
1
+ /**
2
+ * Date Utilities - Math Operations
3
+ * Date arithmetic and manipulation functions
4
+ */
5
+
6
+ import type { DateLike } from "./dateUtils.core";
7
+
8
+ /**
9
+ * Add days to a date
10
+ */
11
+ export function addDays(date: DateLike, days: number): Date {
12
+ const result = new Date(date);
13
+ result.setDate(result.getDate() + days);
14
+ return result;
15
+ }
16
+
17
+ /**
18
+ * Add hours to a date
19
+ */
20
+ export function addHours(date: DateLike, hours: number): Date {
21
+ const result = new Date(date);
22
+ result.setHours(result.getHours() + hours);
23
+ return result;
24
+ }
25
+
26
+ /**
27
+ * Add minutes to a date
28
+ */
29
+ export function addMinutes(date: DateLike, minutes: number): Date {
30
+ const result = new Date(date);
31
+ result.setMinutes(result.getMinutes() + minutes);
32
+ return result;
33
+ }
34
+
35
+ /**
36
+ * Add months to a date
37
+ */
38
+ export function addMonths(date: DateLike, months: number): Date {
39
+ const result = new Date(date);
40
+ result.setMonth(result.getMonth() + months);
41
+ return result;
42
+ }
43
+
44
+ /**
45
+ * Add years to a date
46
+ */
47
+ export function addYears(date: DateLike, years: number): Date {
48
+ const result = new Date(date);
49
+ result.setFullYear(result.getFullYear() + years);
50
+ return result;
51
+ }
52
+
53
+ /**
54
+ * Subtract days from a date
55
+ */
56
+ export function subtractDays(date: DateLike, days: number): Date {
57
+ return addDays(date, -days);
58
+ }
59
+
60
+ /**
61
+ * Get start of day (midnight)
62
+ */
63
+ export function startOfDay(date: DateLike): Date {
64
+ const d = new Date(date);
65
+ d.setHours(0, 0, 0, 0);
66
+ return d;
67
+ }
68
+
69
+ /**
70
+ * Get end of day (23:59:59.999)
71
+ */
72
+ export function endOfDay(date: DateLike): Date {
73
+ const d = new Date(date);
74
+ d.setHours(23, 59, 59, 999);
75
+ return d;
76
+ }
77
+
78
+ /**
79
+ * Get start of week (Sunday)
80
+ */
81
+ export function startOfWeek(date: DateLike): Date {
82
+ const d = new Date(date);
83
+ const day = d.getDay();
84
+ const diff = d.getDate() - day;
85
+ return new Date(d.setDate(diff));
86
+ }
87
+
88
+ /**
89
+ * Get end of week (Saturday)
90
+ */
91
+ export function endOfWeek(date: DateLike): Date {
92
+ const d = new Date(date);
93
+ const day = d.getDay();
94
+ const diff = d.getDate() - day + 6;
95
+ return new Date(d.setDate(diff));
96
+ }
97
+
98
+ /**
99
+ * Get start of month
100
+ */
101
+ export function startOfMonth(date: DateLike): Date {
102
+ const d = new Date(date);
103
+ return new Date(d.getFullYear(), d.getMonth(), 1);
104
+ }
105
+
106
+ /**
107
+ * Get end of month
108
+ */
109
+ export function endOfMonth(date: DateLike): Date {
110
+ const d = new Date(date);
111
+ return new Date(d.getFullYear(), d.getMonth() + 1, 0);
112
+ }
@@ -1,32 +1,10 @@
1
1
  /**
2
2
  * Date Utilities
3
+ * Re-exports all date utility modules
3
4
  */
4
5
 
5
- /**
6
- * Checks if a date is in the past
7
- */
8
- export function isPast(date: Date | string | number): boolean {
9
- const d = new Date(date);
10
- return d.getTime() < Date.now();
11
- }
12
-
13
- /**
14
- * Converts various timestamp formats to a safe Date object
15
- */
16
- export function toSafeDate(ts: any): Date | null {
17
- if (!ts) return null;
18
- if (typeof ts.toDate === "function") return ts.toDate();
19
- if (ts instanceof Date) return ts;
20
- if (typeof ts === "string" || typeof ts === "number") {
21
- const d = new Date(ts);
22
- return isNaN(d.getTime()) ? null : d;
23
- }
24
- return null;
25
- }
26
-
27
- /**
28
- * Formats a date to ISO string safely
29
- */
30
- export function formatISO(date: Date | null): string | null {
31
- return date ? date.toISOString() : null;
32
- }
6
+ export type { DateLike } from "./dateUtils.core";
7
+ export * from "./dateUtils.core";
8
+ export * from "./dateUtils.compare";
9
+ export * from "./dateUtils.format";
10
+ export * from "./dateUtils.math";