@umituz/react-native-subscription 1.1.1 → 1.2.0

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 (61) hide show
  1. package/package.json +7 -23
  2. package/lib/application/ports/ISubscriptionRepository.d.ts +0 -25
  3. package/lib/application/ports/ISubscriptionRepository.d.ts.map +0 -1
  4. package/lib/application/ports/ISubscriptionRepository.js +0 -9
  5. package/lib/application/ports/ISubscriptionRepository.js.map +0 -1
  6. package/lib/application/ports/ISubscriptionService.d.ts +0 -28
  7. package/lib/application/ports/ISubscriptionService.d.ts.map +0 -1
  8. package/lib/application/ports/ISubscriptionService.js +0 -6
  9. package/lib/application/ports/ISubscriptionService.js.map +0 -1
  10. package/lib/domain/entities/SubscriptionStatus.d.ts +0 -31
  11. package/lib/domain/entities/SubscriptionStatus.d.ts.map +0 -1
  12. package/lib/domain/entities/SubscriptionStatus.js +0 -39
  13. package/lib/domain/entities/SubscriptionStatus.js.map +0 -1
  14. package/lib/domain/errors/SubscriptionError.d.ts +0 -18
  15. package/lib/domain/errors/SubscriptionError.d.ts.map +0 -1
  16. package/lib/domain/errors/SubscriptionError.js +0 -30
  17. package/lib/domain/errors/SubscriptionError.js.map +0 -1
  18. package/lib/domain/value-objects/SubscriptionConfig.d.ts +0 -15
  19. package/lib/domain/value-objects/SubscriptionConfig.d.ts.map +0 -1
  20. package/lib/domain/value-objects/SubscriptionConfig.js +0 -6
  21. package/lib/domain/value-objects/SubscriptionConfig.js.map +0 -1
  22. package/lib/index.d.ts +0 -33
  23. package/lib/index.d.ts.map +0 -1
  24. package/lib/index.js +0 -43
  25. package/lib/index.js.map +0 -1
  26. package/lib/infrastructure/services/ActivationHandler.d.ts +0 -20
  27. package/lib/infrastructure/services/ActivationHandler.d.ts.map +0 -1
  28. package/lib/infrastructure/services/ActivationHandler.js +0 -71
  29. package/lib/infrastructure/services/ActivationHandler.js.map +0 -1
  30. package/lib/infrastructure/services/SubscriptionService.d.ts +0 -22
  31. package/lib/infrastructure/services/SubscriptionService.d.ts.map +0 -1
  32. package/lib/infrastructure/services/SubscriptionService.js +0 -110
  33. package/lib/infrastructure/services/SubscriptionService.js.map +0 -1
  34. package/lib/presentation/hooks/useSubscription.d.ts +0 -33
  35. package/lib/presentation/hooks/useSubscription.d.ts.map +0 -1
  36. package/lib/presentation/hooks/useSubscription.js +0 -129
  37. package/lib/presentation/hooks/useSubscription.js.map +0 -1
  38. package/lib/utils/dateUtils.d.ts +0 -39
  39. package/lib/utils/dateUtils.d.ts.map +0 -1
  40. package/lib/utils/dateUtils.js +0 -117
  41. package/lib/utils/dateUtils.js.map +0 -1
  42. package/lib/utils/dateValidationUtils.d.ts +0 -20
  43. package/lib/utils/dateValidationUtils.d.ts.map +0 -1
  44. package/lib/utils/dateValidationUtils.js +0 -39
  45. package/lib/utils/dateValidationUtils.js.map +0 -1
  46. package/lib/utils/periodUtils.d.ts +0 -38
  47. package/lib/utils/periodUtils.d.ts.map +0 -1
  48. package/lib/utils/periodUtils.js +0 -70
  49. package/lib/utils/periodUtils.js.map +0 -1
  50. package/lib/utils/planDetectionUtils.d.ts +0 -17
  51. package/lib/utils/planDetectionUtils.d.ts.map +0 -1
  52. package/lib/utils/planDetectionUtils.js +0 -31
  53. package/lib/utils/planDetectionUtils.js.map +0 -1
  54. package/lib/utils/priceUtils.d.ts +0 -23
  55. package/lib/utils/priceUtils.d.ts.map +0 -1
  56. package/lib/utils/priceUtils.js +0 -29
  57. package/lib/utils/priceUtils.js.map +0 -1
  58. package/lib/utils/subscriptionConstants.d.ts +0 -62
  59. package/lib/utils/subscriptionConstants.d.ts.map +0 -1
  60. package/lib/utils/subscriptionConstants.js +0 -61
  61. package/lib/utils/subscriptionConstants.js.map +0 -1
@@ -1,29 +0,0 @@
1
- /**
2
- * Price Utilities
3
- * Subscription price-related helper functions
4
- *
5
- * Following SOLID, DRY, KISS principles:
6
- * - Single Responsibility: Only price-related operations
7
- * - DRY: No code duplication
8
- * - KISS: Simple, clear implementations
9
- */
10
- import { DATE_CONSTANTS } from './subscriptionConstants';
11
- /**
12
- * Format price for display
13
- * Formats a price value with currency code using Intl.NumberFormat
14
- *
15
- * @param price - Price value (e.g., 9.99)
16
- * @param currencyCode - ISO 4217 currency code (e.g., "USD", "EUR", "TRY")
17
- * @returns Formatted price string (e.g., "$9.99", "€9.99", "₺9.99")
18
- *
19
- * @example
20
- * formatPrice(9.99, "USD") // Returns: "$9.99"
21
- * formatPrice(229.99, "TRY") // Returns: "₺229.99"
22
- */
23
- export function formatPrice(price, currencyCode) {
24
- return new Intl.NumberFormat(DATE_CONSTANTS.DEFAULT_LOCALE, {
25
- style: 'currency',
26
- currency: currencyCode,
27
- }).format(price);
28
- }
29
- //# sourceMappingURL=priceUtils.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"priceUtils.js","sourceRoot":"","sources":["../../src/utils/priceUtils.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAEzD;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,WAAW,CAAC,KAAa,EAAE,YAAoB;IAC7D,OAAO,IAAI,IAAI,CAAC,YAAY,CAAC,cAAc,CAAC,cAAc,EAAE;QAC1D,KAAK,EAAE,UAAU;QACjB,QAAQ,EAAE,YAAY;KACvB,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;AACnB,CAAC"}
@@ -1,62 +0,0 @@
1
- /**
2
- * Subscription Constants
3
- * Centralized constants for subscription operations
4
- *
5
- * Following SOLID, DRY, KISS principles:
6
- * - Single Responsibility: Only constants, no logic
7
- * - DRY: All constants in one place
8
- * - KISS: Simple, clear constant definitions
9
- */
10
- /**
11
- * Subscription plan types
12
- */
13
- export declare const SUBSCRIPTION_PLAN_TYPES: {
14
- readonly WEEKLY: "weekly";
15
- readonly MONTHLY: "monthly";
16
- readonly YEARLY: "yearly";
17
- readonly UNKNOWN: "unknown";
18
- };
19
- export type SubscriptionPlanType = (typeof SUBSCRIPTION_PLAN_TYPES)[keyof typeof SUBSCRIPTION_PLAN_TYPES];
20
- /**
21
- * Minimum expected subscription durations in days
22
- * Used to detect sandbox accelerated timers
23
- * Includes 1 day tolerance for clock skew
24
- */
25
- export declare const MIN_SUBSCRIPTION_DURATIONS_DAYS: {
26
- readonly WEEKLY: 6;
27
- readonly MONTHLY: 28;
28
- readonly YEARLY: 360;
29
- readonly UNKNOWN: 28;
30
- };
31
- /**
32
- * Subscription period multipliers
33
- * Days to add for each subscription type
34
- */
35
- export declare const SUBSCRIPTION_PERIOD_DAYS: {
36
- readonly WEEKLY: 7;
37
- };
38
- /**
39
- * Date calculation constants
40
- */
41
- export declare const DATE_CONSTANTS: {
42
- readonly MILLISECONDS_PER_DAY: number;
43
- readonly DEFAULT_LOCALE: "en-US";
44
- };
45
- /**
46
- * Subscription period unit mappings
47
- * Maps RevenueCat period units to our internal types
48
- */
49
- export declare const SUBSCRIPTION_PERIOD_UNITS: {
50
- readonly WEEK: "WEEK";
51
- readonly MONTH: "MONTH";
52
- readonly YEAR: "YEAR";
53
- };
54
- /**
55
- * Product ID keywords for plan detection
56
- */
57
- export declare const PRODUCT_ID_KEYWORDS: {
58
- readonly WEEKLY: readonly ["weekly", "week"];
59
- readonly MONTHLY: readonly ["monthly", "month"];
60
- readonly YEARLY: readonly ["yearly", "year", "annual"];
61
- };
62
- //# sourceMappingURL=subscriptionConstants.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"subscriptionConstants.d.ts","sourceRoot":"","sources":["../../src/utils/subscriptionConstants.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH;;GAEG;AACH,eAAO,MAAM,uBAAuB;;;;;CAK1B,CAAC;AAEX,MAAM,MAAM,oBAAoB,GAC9B,CAAC,OAAO,uBAAuB,CAAC,CAAC,MAAM,OAAO,uBAAuB,CAAC,CAAC;AAEzE;;;;GAIG;AACH,eAAO,MAAM,+BAA+B;;;;;CAKlC,CAAC;AAEX;;;GAGG;AACH,eAAO,MAAM,wBAAwB;;CAE3B,CAAC;AAEX;;GAEG;AACH,eAAO,MAAM,cAAc;;;CAGjB,CAAC;AAEX;;;GAGG;AACH,eAAO,MAAM,yBAAyB;;;;CAI5B,CAAC;AAEX;;GAEG;AACH,eAAO,MAAM,mBAAmB;;;;CAItB,CAAC"}
@@ -1,61 +0,0 @@
1
- /**
2
- * Subscription Constants
3
- * Centralized constants for subscription operations
4
- *
5
- * Following SOLID, DRY, KISS principles:
6
- * - Single Responsibility: Only constants, no logic
7
- * - DRY: All constants in one place
8
- * - KISS: Simple, clear constant definitions
9
- */
10
- /**
11
- * Subscription plan types
12
- */
13
- export const SUBSCRIPTION_PLAN_TYPES = {
14
- WEEKLY: 'weekly',
15
- MONTHLY: 'monthly',
16
- YEARLY: 'yearly',
17
- UNKNOWN: 'unknown',
18
- };
19
- /**
20
- * Minimum expected subscription durations in days
21
- * Used to detect sandbox accelerated timers
22
- * Includes 1 day tolerance for clock skew
23
- */
24
- export const MIN_SUBSCRIPTION_DURATIONS_DAYS = {
25
- WEEKLY: 6,
26
- MONTHLY: 28,
27
- YEARLY: 360,
28
- UNKNOWN: 28,
29
- };
30
- /**
31
- * Subscription period multipliers
32
- * Days to add for each subscription type
33
- */
34
- export const SUBSCRIPTION_PERIOD_DAYS = {
35
- WEEKLY: 7,
36
- };
37
- /**
38
- * Date calculation constants
39
- */
40
- export const DATE_CONSTANTS = {
41
- MILLISECONDS_PER_DAY: 1000 * 60 * 60 * 24,
42
- DEFAULT_LOCALE: 'en-US',
43
- };
44
- /**
45
- * Subscription period unit mappings
46
- * Maps RevenueCat period units to our internal types
47
- */
48
- export const SUBSCRIPTION_PERIOD_UNITS = {
49
- WEEK: 'WEEK',
50
- MONTH: 'MONTH',
51
- YEAR: 'YEAR',
52
- };
53
- /**
54
- * Product ID keywords for plan detection
55
- */
56
- export const PRODUCT_ID_KEYWORDS = {
57
- WEEKLY: ['weekly', 'week'],
58
- MONTHLY: ['monthly', 'month'],
59
- YEARLY: ['yearly', 'year', 'annual'],
60
- };
61
- //# sourceMappingURL=subscriptionConstants.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"subscriptionConstants.js","sourceRoot":"","sources":["../../src/utils/subscriptionConstants.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH;;GAEG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAAG;IACrC,MAAM,EAAE,QAAQ;IAChB,OAAO,EAAE,SAAS;IAClB,MAAM,EAAE,QAAQ;IAChB,OAAO,EAAE,SAAS;CACV,CAAC;AAKX;;;;GAIG;AACH,MAAM,CAAC,MAAM,+BAA+B,GAAG;IAC7C,MAAM,EAAE,CAAC;IACT,OAAO,EAAE,EAAE;IACX,MAAM,EAAE,GAAG;IACX,OAAO,EAAE,EAAE;CACH,CAAC;AAEX;;;GAGG;AACH,MAAM,CAAC,MAAM,wBAAwB,GAAG;IACtC,MAAM,EAAE,CAAC;CACD,CAAC;AAEX;;GAEG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG;IAC5B,oBAAoB,EAAE,IAAI,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE;IACzC,cAAc,EAAE,OAAO;CACf,CAAC;AAEX;;;GAGG;AACH,MAAM,CAAC,MAAM,yBAAyB,GAAG;IACvC,IAAI,EAAE,MAAM;IACZ,KAAK,EAAE,OAAO;IACd,IAAI,EAAE,MAAM;CACJ,CAAC;AAEX;;GAEG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG;IACjC,MAAM,EAAE,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,OAAO,EAAE,CAAC,SAAS,EAAE,OAAO,CAAC;IAC7B,MAAM,EAAE,CAAC,QAAQ,EAAE,MAAM,EAAE,QAAQ,CAAC;CAC5B,CAAC"}