@oxyhq/services 5.26.0 → 5.26.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.
Files changed (149) hide show
  1. package/lib/commonjs/core/HttpService.js +3 -3
  2. package/lib/commonjs/core/HttpService.js.map +1 -1
  3. package/lib/commonjs/crypto/keyManager.js +16 -21
  4. package/lib/commonjs/crypto/keyManager.js.map +1 -1
  5. package/lib/commonjs/index.js +65 -0
  6. package/lib/commonjs/index.js.map +1 -1
  7. package/lib/commonjs/lib/sonner.js +13 -17
  8. package/lib/commonjs/lib/sonner.js.map +1 -1
  9. package/lib/commonjs/lib/sonner.native.js +24 -0
  10. package/lib/commonjs/lib/sonner.native.js.map +1 -0
  11. package/lib/commonjs/lib/sonner.web.js +24 -0
  12. package/lib/commonjs/lib/sonner.web.js.map +1 -0
  13. package/lib/commonjs/ui/client.js +1 -1
  14. package/lib/commonjs/ui/components/FollowButton.js +1 -1
  15. package/lib/commonjs/ui/components/OxyProvider.js +1 -1
  16. package/lib/commonjs/ui/components/payment/PaymentDetailsStep.js +1 -1
  17. package/lib/commonjs/ui/context/OxyContext.js +1 -1
  18. package/lib/commonjs/ui/hooks/mutations/mutationFactory.js +1 -1
  19. package/lib/commonjs/ui/hooks/mutations/useAccountMutations.js +1 -1
  20. package/lib/commonjs/ui/hooks/mutations/useServicesMutations.js +1 -1
  21. package/lib/commonjs/ui/hooks/useAsyncAction.js +1 -1
  22. package/lib/commonjs/ui/hooks/useSessionSocket.js +1 -1
  23. package/lib/commonjs/ui/hooks/useSettingToggle.js +1 -1
  24. package/lib/commonjs/ui/screens/AccountCenterScreen.js +1 -1
  25. package/lib/commonjs/ui/screens/AccountOverviewScreen.js +1 -1
  26. package/lib/commonjs/ui/screens/AccountSettingsScreen.js +1 -1
  27. package/lib/commonjs/ui/screens/AccountSwitcherScreen.js +1 -1
  28. package/lib/commonjs/ui/screens/AccountVerificationScreen.js +1 -1
  29. package/lib/commonjs/ui/screens/AppInfoScreen.js +1 -1
  30. package/lib/commonjs/ui/screens/EditProfileFieldScreen.js +1 -1
  31. package/lib/commonjs/ui/screens/FAQScreen.js +1 -1
  32. package/lib/commonjs/ui/screens/FeedbackScreen.js +1 -1
  33. package/lib/commonjs/ui/screens/FileManagementScreen.js +1 -1
  34. package/lib/commonjs/ui/screens/HelpSupportScreen.js +1 -1
  35. package/lib/commonjs/ui/screens/HistoryViewScreen.js +1 -1
  36. package/lib/commonjs/ui/screens/LanguageSelectorScreen.js +1 -1
  37. package/lib/commonjs/ui/screens/LegalDocumentsScreen.js +1 -1
  38. package/lib/commonjs/ui/screens/PremiumSubscriptionScreen.js +1 -1
  39. package/lib/commonjs/ui/screens/PrivacySettingsScreen.js +1 -1
  40. package/lib/commonjs/ui/screens/SavesCollectionsScreen.js +1 -1
  41. package/lib/commonjs/ui/screens/SessionManagementScreen.js +1 -1
  42. package/lib/commonjs/ui/screens/WelcomeNewUserScreen.js +1 -1
  43. package/lib/commonjs/ui/utils/fileManagement.js +1 -1
  44. package/lib/commonjs/utils/platform.js +129 -0
  45. package/lib/commonjs/utils/platform.js.map +1 -0
  46. package/lib/module/core/HttpService.js +3 -3
  47. package/lib/module/core/HttpService.js.map +1 -1
  48. package/lib/module/crypto/keyManager.js +16 -21
  49. package/lib/module/crypto/keyManager.js.map +1 -1
  50. package/lib/module/index.js +7 -1
  51. package/lib/module/index.js.map +1 -1
  52. package/lib/module/lib/sonner.js +11 -16
  53. package/lib/module/lib/sonner.js.map +1 -1
  54. package/lib/module/lib/sonner.native.js +19 -0
  55. package/lib/module/lib/sonner.native.js.map +1 -0
  56. package/lib/module/lib/sonner.web.js +19 -0
  57. package/lib/module/lib/sonner.web.js.map +1 -0
  58. package/lib/module/ui/client.js +1 -1
  59. package/lib/module/ui/client.js.map +1 -1
  60. package/lib/module/ui/components/FollowButton.js +1 -1
  61. package/lib/module/ui/components/FollowButton.js.map +1 -1
  62. package/lib/module/ui/components/OxyProvider.js +1 -1
  63. package/lib/module/ui/components/OxyProvider.js.map +1 -1
  64. package/lib/module/ui/components/payment/PaymentDetailsStep.js +1 -1
  65. package/lib/module/ui/components/payment/PaymentDetailsStep.js.map +1 -1
  66. package/lib/module/ui/context/OxyContext.js +1 -1
  67. package/lib/module/ui/context/OxyContext.js.map +1 -1
  68. package/lib/module/ui/hooks/mutations/mutationFactory.js +1 -1
  69. package/lib/module/ui/hooks/mutations/mutationFactory.js.map +1 -1
  70. package/lib/module/ui/hooks/mutations/useAccountMutations.js +1 -1
  71. package/lib/module/ui/hooks/mutations/useAccountMutations.js.map +1 -1
  72. package/lib/module/ui/hooks/mutations/useServicesMutations.js +1 -1
  73. package/lib/module/ui/hooks/mutations/useServicesMutations.js.map +1 -1
  74. package/lib/module/ui/hooks/useAsyncAction.js +1 -1
  75. package/lib/module/ui/hooks/useAsyncAction.js.map +1 -1
  76. package/lib/module/ui/hooks/useSessionSocket.js +1 -1
  77. package/lib/module/ui/hooks/useSessionSocket.js.map +1 -1
  78. package/lib/module/ui/hooks/useSettingToggle.js +1 -1
  79. package/lib/module/ui/hooks/useSettingToggle.js.map +1 -1
  80. package/lib/module/ui/screens/AccountCenterScreen.js +1 -1
  81. package/lib/module/ui/screens/AccountCenterScreen.js.map +1 -1
  82. package/lib/module/ui/screens/AccountOverviewScreen.js +1 -1
  83. package/lib/module/ui/screens/AccountOverviewScreen.js.map +1 -1
  84. package/lib/module/ui/screens/AccountSettingsScreen.js +1 -1
  85. package/lib/module/ui/screens/AccountSettingsScreen.js.map +1 -1
  86. package/lib/module/ui/screens/AccountSwitcherScreen.js +1 -1
  87. package/lib/module/ui/screens/AccountSwitcherScreen.js.map +1 -1
  88. package/lib/module/ui/screens/AccountVerificationScreen.js +1 -1
  89. package/lib/module/ui/screens/AccountVerificationScreen.js.map +1 -1
  90. package/lib/module/ui/screens/AppInfoScreen.js +1 -1
  91. package/lib/module/ui/screens/AppInfoScreen.js.map +1 -1
  92. package/lib/module/ui/screens/EditProfileFieldScreen.js +1 -1
  93. package/lib/module/ui/screens/EditProfileFieldScreen.js.map +1 -1
  94. package/lib/module/ui/screens/FAQScreen.js +1 -1
  95. package/lib/module/ui/screens/FAQScreen.js.map +1 -1
  96. package/lib/module/ui/screens/FeedbackScreen.js +1 -1
  97. package/lib/module/ui/screens/FeedbackScreen.js.map +1 -1
  98. package/lib/module/ui/screens/FileManagementScreen.js +1 -1
  99. package/lib/module/ui/screens/FileManagementScreen.js.map +1 -1
  100. package/lib/module/ui/screens/HelpSupportScreen.js +1 -1
  101. package/lib/module/ui/screens/HelpSupportScreen.js.map +1 -1
  102. package/lib/module/ui/screens/HistoryViewScreen.js +1 -1
  103. package/lib/module/ui/screens/HistoryViewScreen.js.map +1 -1
  104. package/lib/module/ui/screens/LanguageSelectorScreen.js +1 -1
  105. package/lib/module/ui/screens/LanguageSelectorScreen.js.map +1 -1
  106. package/lib/module/ui/screens/LegalDocumentsScreen.js +1 -1
  107. package/lib/module/ui/screens/LegalDocumentsScreen.js.map +1 -1
  108. package/lib/module/ui/screens/PremiumSubscriptionScreen.js +1 -1
  109. package/lib/module/ui/screens/PremiumSubscriptionScreen.js.map +1 -1
  110. package/lib/module/ui/screens/PrivacySettingsScreen.js +1 -1
  111. package/lib/module/ui/screens/PrivacySettingsScreen.js.map +1 -1
  112. package/lib/module/ui/screens/SavesCollectionsScreen.js +1 -1
  113. package/lib/module/ui/screens/SavesCollectionsScreen.js.map +1 -1
  114. package/lib/module/ui/screens/SessionManagementScreen.js +1 -1
  115. package/lib/module/ui/screens/SessionManagementScreen.js.map +1 -1
  116. package/lib/module/ui/screens/WelcomeNewUserScreen.js +1 -1
  117. package/lib/module/ui/screens/WelcomeNewUserScreen.js.map +1 -1
  118. package/lib/module/ui/utils/fileManagement.js +1 -1
  119. package/lib/module/ui/utils/fileManagement.js.map +1 -1
  120. package/lib/module/utils/platform.js +118 -0
  121. package/lib/module/utils/platform.js.map +1 -0
  122. package/lib/typescript/commonjs/crypto/keyManager.d.ts.map +1 -1
  123. package/lib/typescript/commonjs/index.d.ts.map +1 -1
  124. package/lib/typescript/commonjs/lib/sonner.d.ts +11 -14
  125. package/lib/typescript/commonjs/lib/sonner.d.ts.map +1 -1
  126. package/lib/typescript/commonjs/lib/sonner.native.d.ts +15 -0
  127. package/lib/typescript/commonjs/lib/sonner.native.d.ts.map +1 -0
  128. package/lib/typescript/commonjs/lib/sonner.web.d.ts +15 -0
  129. package/lib/typescript/commonjs/lib/sonner.web.d.ts.map +1 -0
  130. package/lib/typescript/commonjs/utils/platform.d.ts +41 -0
  131. package/lib/typescript/commonjs/utils/platform.d.ts.map +1 -0
  132. package/lib/typescript/module/crypto/keyManager.d.ts.map +1 -1
  133. package/lib/typescript/module/index.d.ts.map +1 -1
  134. package/lib/typescript/module/lib/sonner.d.ts +11 -14
  135. package/lib/typescript/module/lib/sonner.d.ts.map +1 -1
  136. package/lib/typescript/module/lib/sonner.native.d.ts +15 -0
  137. package/lib/typescript/module/lib/sonner.native.d.ts.map +1 -0
  138. package/lib/typescript/module/lib/sonner.web.d.ts +15 -0
  139. package/lib/typescript/module/lib/sonner.web.d.ts.map +1 -0
  140. package/lib/typescript/module/utils/platform.d.ts +41 -0
  141. package/lib/typescript/module/utils/platform.d.ts.map +1 -0
  142. package/package.json +1 -1
  143. package/src/core/HttpService.ts +3 -3
  144. package/src/crypto/keyManager.ts +16 -21
  145. package/src/index.ts +7 -1
  146. package/src/lib/sonner.native.ts +28 -0
  147. package/src/lib/sonner.ts +11 -28
  148. package/src/lib/sonner.web.ts +28 -0
  149. package/src/utils/platform.ts +117 -0
@@ -1,15 +1,12 @@
1
- interface ToastFunction {
2
- (message: string, options?: Record<string, unknown>): void;
3
- success: (message: string, options?: Record<string, unknown>) => void;
4
- error: (message: string, options?: Record<string, unknown>) => void;
5
- info: (message: string, options?: Record<string, unknown>) => void;
6
- warning: (message: string, options?: Record<string, unknown>) => void;
7
- loading: (message: string, options?: Record<string, unknown>) => void;
8
- }
9
- type ToasterComponent = (props?: Record<string, unknown>) => React.ReactElement | null;
10
- declare const webToast: ToastFunction;
11
- export declare const toast: ToastFunction;
12
- export declare const Toaster: ToasterComponent;
13
- export type ToastT = typeof webToast;
14
- export {};
1
+ /**
2
+ * Sonner Toast - Platform-Agnostic Entry Point
3
+ *
4
+ * Bundlers resolve platform-specific implementations:
5
+ * - Metro (React Native): resolves to sonner.native.ts
6
+ * - Vite/Webpack (Web): resolves to sonner.web.ts
7
+ * - Node.js/SSR: uses this file (web fallback)
8
+ *
9
+ * This file exports web as the default for /core and /web entry points.
10
+ */
11
+ export { toast, Toaster, type ToastT } from './sonner.web';
15
12
  //# sourceMappingURL=sonner.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"sonner.d.ts","sourceRoot":"","sources":["../../../../src/lib/sonner.ts"],"names":[],"mappings":"AAKA,UAAU,aAAa;IACrB,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAAC;IAC3D,OAAO,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,IAAI,CAAC;IACtE,KAAK,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,IAAI,CAAC;IACpE,IAAI,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,IAAI,CAAC;IACnE,OAAO,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,IAAI,CAAC;IACtE,OAAO,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,IAAI,CAAC;CACvE;AAED,KAAK,gBAAgB,GAAG,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,KAAK,CAAC,YAAY,GAAG,IAAI,CAAC;AAEvF,QAAA,MAAe,QAAQ,eAGtB,CAAC;AAMF,eAAO,MAAM,KAAK,eAAiD,CAAC;AACpE,eAAO,MAAM,OAAO,kBAAqD,CAAC;AAC1E,MAAM,MAAM,MAAM,GAAG,OAAO,QAAQ,CAAC"}
1
+ {"version":3,"file":"sonner.d.ts","sourceRoot":"","sources":["../../../../src/lib/sonner.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,KAAK,MAAM,EAAE,MAAM,cAAc,CAAC"}
@@ -0,0 +1,15 @@
1
+ interface ToastFunction {
2
+ (message: string, options?: Record<string, unknown>): void;
3
+ success: (message: string, options?: Record<string, unknown>) => void;
4
+ error: (message: string, options?: Record<string, unknown>) => void;
5
+ info: (message: string, options?: Record<string, unknown>) => void;
6
+ warning: (message: string, options?: Record<string, unknown>) => void;
7
+ loading: (message: string, options?: Record<string, unknown>) => void;
8
+ }
9
+ type ToasterComponent = (props?: Record<string, unknown>) => React.ReactElement | null;
10
+ declare const nativeToast: ToastFunction;
11
+ export declare const toast: ToastFunction;
12
+ export declare const Toaster: ToasterComponent;
13
+ export type ToastT = typeof nativeToast;
14
+ export {};
15
+ //# sourceMappingURL=sonner.native.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sonner.native.d.ts","sourceRoot":"","sources":["../../../../src/lib/sonner.native.ts"],"names":[],"mappings":"AASA,UAAU,aAAa;IACrB,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAAC;IAC3D,OAAO,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,IAAI,CAAC;IACtE,KAAK,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,IAAI,CAAC;IACpE,IAAI,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,IAAI,CAAC;IACnE,OAAO,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,IAAI,CAAC;IACtE,OAAO,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,IAAI,CAAC;CACvE;AAED,KAAK,gBAAgB,GAAG,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,KAAK,CAAC,YAAY,GAAG,IAAI,CAAC;AAEvF,QAAA,MAAe,WAAW,eAGzB,CAAC;AAEF,eAAO,MAAM,KAAK,eAAc,CAAC;AACjC,eAAO,MAAM,OAAO,kBAAgB,CAAC;AACrC,MAAM,MAAM,MAAM,GAAG,OAAO,WAAW,CAAC"}
@@ -0,0 +1,15 @@
1
+ interface ToastFunction {
2
+ (message: string, options?: Record<string, unknown>): void;
3
+ success: (message: string, options?: Record<string, unknown>) => void;
4
+ error: (message: string, options?: Record<string, unknown>) => void;
5
+ info: (message: string, options?: Record<string, unknown>) => void;
6
+ warning: (message: string, options?: Record<string, unknown>) => void;
7
+ loading: (message: string, options?: Record<string, unknown>) => void;
8
+ }
9
+ type ToasterComponent = (props?: Record<string, unknown>) => React.ReactElement | null;
10
+ declare const webToast: ToastFunction;
11
+ export declare const toast: ToastFunction;
12
+ export declare const Toaster: ToasterComponent;
13
+ export type ToastT = typeof webToast;
14
+ export {};
15
+ //# sourceMappingURL=sonner.web.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sonner.web.d.ts","sourceRoot":"","sources":["../../../../src/lib/sonner.web.ts"],"names":[],"mappings":"AASA,UAAU,aAAa;IACrB,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAAC;IAC3D,OAAO,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,IAAI,CAAC;IACtE,KAAK,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,IAAI,CAAC;IACpE,IAAI,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,IAAI,CAAC;IACnE,OAAO,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,IAAI,CAAC;IACtE,OAAO,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,IAAI,CAAC;CACvE;AAED,KAAK,gBAAgB,GAAG,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,KAAK,CAAC,YAAY,GAAG,IAAI,CAAC;AAEvF,QAAA,MAAe,QAAQ,eAGtB,CAAC;AAEF,eAAO,MAAM,KAAK,eAAW,CAAC;AAC9B,eAAO,MAAM,OAAO,kBAAa,CAAC;AAClC,MAAM,MAAM,MAAM,GAAG,OAAO,QAAQ,CAAC"}
@@ -0,0 +1,41 @@
1
+ /**
2
+ * Platform Detection Utility
3
+ *
4
+ * Provides platform detection WITHOUT importing from 'react-native'.
5
+ * This allows core modules to be used in web/Node.js environments
6
+ * without bundlers failing on react-native imports.
7
+ */
8
+ export type PlatformOS = 'ios' | 'android' | 'web' | 'windows' | 'macos' | 'unknown';
9
+ /**
10
+ * Get the current platform OS
11
+ * Safe to call from any environment (web, Node.js, React Native)
12
+ */
13
+ export declare function getPlatformOS(): PlatformOS;
14
+ /**
15
+ * Check if running on web platform (browser or Node.js)
16
+ */
17
+ export declare function isWeb(): boolean;
18
+ /**
19
+ * Check if running in a native app (iOS or Android)
20
+ */
21
+ export declare function isNative(): boolean;
22
+ /**
23
+ * Check if running on iOS
24
+ */
25
+ export declare function isIOS(): boolean;
26
+ /**
27
+ * Check if running on Android
28
+ */
29
+ export declare function isAndroid(): boolean;
30
+ /**
31
+ * Set the platform OS explicitly
32
+ * Called by React Native entry point to register the platform
33
+ * This allows lazy detection in environments where react-native is available
34
+ */
35
+ export declare function setPlatformOS(os: PlatformOS): void;
36
+ /**
37
+ * Try to initialize platform from react-native if available
38
+ * This is called lazily when needed, avoiding top-level imports
39
+ */
40
+ export declare function initPlatformFromReactNative(): Promise<void>;
41
+ //# sourceMappingURL=platform.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"platform.d.ts","sourceRoot":"","sources":["../../../../src/utils/platform.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,MAAM,MAAM,UAAU,GAAG,KAAK,GAAG,SAAS,GAAG,KAAK,GAAG,SAAS,GAAG,OAAO,GAAG,SAAS,CAAC;AA0CrF;;;GAGG;AACH,wBAAgB,aAAa,IAAI,UAAU,CAK1C;AAED;;GAEG;AACH,wBAAgB,KAAK,IAAI,OAAO,CAE/B;AAED;;GAEG;AACH,wBAAgB,QAAQ,IAAI,OAAO,CAGlC;AAED;;GAEG;AACH,wBAAgB,KAAK,IAAI,OAAO,CAE/B;AAED;;GAEG;AACH,wBAAgB,SAAS,IAAI,OAAO,CAEnC;AAED;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,EAAE,EAAE,UAAU,GAAG,IAAI,CAGlD;AAED;;;GAGG;AACH,wBAAsB,2BAA2B,IAAI,OAAO,CAAC,IAAI,CAAC,CAYjE"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@oxyhq/services",
3
- "version": "5.26.0",
3
+ "version": "5.26.1",
4
4
  "description": "Reusable OxyHQ module to handle authentication, user management, karma system, device-based session management and more 🚀",
5
5
  "main": "lib/commonjs/index.js",
6
6
  "module": "lib/module/index.js",
@@ -18,14 +18,14 @@ import { RequestDeduplicator, RequestQueue, SimpleLogger } from '../utils/reques
18
18
  import { retryAsync } from '../utils/asyncUtils';
19
19
  import { handleHttpError } from '../utils/errorUtils';
20
20
  import { jwtDecode } from 'jwt-decode';
21
- import { Platform } from 'react-native';
21
+ import { isNative, getPlatformOS } from '../utils/platform';
22
22
  import type { OxyConfig } from '../models/interfaces';
23
23
 
24
24
  /**
25
25
  * Check if we're running in a native app environment (React Native, not web)
26
26
  * This is used to determine CSRF handling mode
27
27
  */
28
- const isNativeApp = Platform.OS !== 'web';
28
+ const isNativeApp = isNative();
29
29
 
30
30
  interface JwtPayload {
31
31
  exp?: number;
@@ -284,7 +284,7 @@ export class HttpService {
284
284
  url,
285
285
  method,
286
286
  isNativeApp,
287
- platformOS: Platform.OS,
287
+ platformOS: getPlatformOS(),
288
288
  hasCsrfToken: !!csrfToken,
289
289
  csrfTokenLength: csrfToken?.length,
290
290
  hasNativeAppHeader: headers['X-Native-App'] === 'true',
@@ -7,7 +7,7 @@
7
7
 
8
8
  import { ec as EC } from 'elliptic';
9
9
  import type { ECKeyPair } from 'elliptic';
10
- import { Platform } from 'react-native';
10
+ import { isWeb, isIOS, isAndroid } from '../utils/platform';
11
11
  import { logger } from '../utils/loggerUtils';
12
12
 
13
13
  // Lazy imports for React Native specific modules
@@ -80,12 +80,7 @@ function isNodeJS(): boolean {
80
80
  * Identity storage is only available on native platforms (iOS/Android)
81
81
  */
82
82
  function isWebPlatform(): boolean {
83
- try {
84
- return Platform.OS === 'web';
85
- } catch {
86
- // Fallback if Platform is not available
87
- return typeof window !== 'undefined' && typeof navigator !== 'undefined' && navigator.product !== 'ReactNative';
88
- }
83
+ return isWeb();
89
84
  }
90
85
 
91
86
  async function initExpoCrypto(): Promise<typeof import('expo-crypto')> {
@@ -212,7 +207,7 @@ export class KeyManager {
212
207
  const store = await initSecureStore();
213
208
  const { privateKey, publicKey } = await KeyManager.generateKeyPair();
214
209
 
215
- if (Platform.OS === 'ios') {
210
+ if (isIOS()) {
216
211
  // iOS: Store in shared keychain group
217
212
  // Note: keychainAccessGroup requires Keychain Sharing capability in Xcode
218
213
  try {
@@ -229,7 +224,7 @@ export class KeyManager {
229
224
  `Failed to create shared identity on iOS. Ensure your app has the Keychain Sharing capability enabled with access group "${IOS_KEYCHAIN_GROUP}". Error: ${error}`
230
225
  );
231
226
  }
232
- } else if (Platform.OS === 'android') {
227
+ } else if (isAndroid()) {
233
228
  // Android: Store in secure store (accessible via sharedUserId)
234
229
  // Note: All Oxy apps must have the same sharedUserId in AndroidManifest.xml
235
230
  await store.setItemAsync(STORAGE_KEYS.SHARED_PRIVATE_KEY, privateKey, {
@@ -269,11 +264,11 @@ export class KeyManager {
269
264
  const store = await initSecureStore();
270
265
  let publicKey: string | null = null;
271
266
 
272
- if (Platform.OS === 'ios') {
267
+ if (isIOS()) {
273
268
  publicKey = await store.getItemAsync(STORAGE_KEYS.SHARED_PUBLIC_KEY, {
274
269
  keychainAccessGroup: IOS_KEYCHAIN_GROUP,
275
270
  } as any);
276
- } else if (Platform.OS === 'android') {
271
+ } else if (isAndroid()) {
277
272
  publicKey = await store.getItemAsync(STORAGE_KEYS.SHARED_PUBLIC_KEY);
278
273
  }
279
274
 
@@ -307,11 +302,11 @@ export class KeyManager {
307
302
  const store = await initSecureStore();
308
303
  let privateKey: string | null = null;
309
304
 
310
- if (Platform.OS === 'ios') {
305
+ if (isIOS()) {
311
306
  privateKey = await store.getItemAsync(STORAGE_KEYS.SHARED_PRIVATE_KEY, {
312
307
  keychainAccessGroup: IOS_KEYCHAIN_GROUP,
313
308
  } as any);
314
- } else if (Platform.OS === 'android') {
309
+ } else if (isAndroid()) {
315
310
  privateKey = await store.getItemAsync(STORAGE_KEYS.SHARED_PRIVATE_KEY);
316
311
  }
317
312
 
@@ -376,7 +371,7 @@ export class KeyManager {
376
371
  const keyPair = ec.keyFromPrivate(privateKey);
377
372
  const publicKey = keyPair.getPublic('hex');
378
373
 
379
- if (Platform.OS === 'ios') {
374
+ if (isIOS()) {
380
375
  await store.setItemAsync(STORAGE_KEYS.SHARED_PRIVATE_KEY, privateKey, {
381
376
  keychainAccessible: store.WHEN_UNLOCKED_THIS_DEVICE_ONLY,
382
377
  keychainAccessGroup: IOS_KEYCHAIN_GROUP,
@@ -385,7 +380,7 @@ export class KeyManager {
385
380
  await store.setItemAsync(STORAGE_KEYS.SHARED_PUBLIC_KEY, publicKey, {
386
381
  keychainAccessGroup: IOS_KEYCHAIN_GROUP,
387
382
  } as any);
388
- } else if (Platform.OS === 'android') {
383
+ } else if (isAndroid()) {
389
384
  await store.setItemAsync(STORAGE_KEYS.SHARED_PRIVATE_KEY, privateKey, {
390
385
  keychainAccessible: store.WHEN_UNLOCKED_THIS_DEVICE_ONLY,
391
386
  });
@@ -422,7 +417,7 @@ export class KeyManager {
422
417
  try {
423
418
  const store = await initSecureStore();
424
419
 
425
- if (Platform.OS === 'ios') {
420
+ if (isIOS()) {
426
421
  await store.setItemAsync(STORAGE_KEYS.SHARED_SESSION_ID, sessionId, {
427
422
  keychainAccessGroup: IOS_KEYCHAIN_GROUP,
428
423
  } as any);
@@ -431,7 +426,7 @@ export class KeyManager {
431
426
  keychainAccessible: store.WHEN_UNLOCKED,
432
427
  keychainAccessGroup: IOS_KEYCHAIN_GROUP,
433
428
  } as any);
434
- } else if (Platform.OS === 'android') {
429
+ } else if (isAndroid()) {
435
430
  await store.setItemAsync(STORAGE_KEYS.SHARED_SESSION_ID, sessionId);
436
431
  await store.setItemAsync(STORAGE_KEYS.SHARED_SESSION_TOKEN, accessToken);
437
432
  }
@@ -465,7 +460,7 @@ export class KeyManager {
465
460
  let sessionId: string | null = null;
466
461
  let accessToken: string | null = null;
467
462
 
468
- if (Platform.OS === 'ios') {
463
+ if (isIOS()) {
469
464
  sessionId = await store.getItemAsync(STORAGE_KEYS.SHARED_SESSION_ID, {
470
465
  keychainAccessGroup: IOS_KEYCHAIN_GROUP,
471
466
  } as any);
@@ -473,7 +468,7 @@ export class KeyManager {
473
468
  accessToken = await store.getItemAsync(STORAGE_KEYS.SHARED_SESSION_TOKEN, {
474
469
  keychainAccessGroup: IOS_KEYCHAIN_GROUP,
475
470
  } as any);
476
- } else if (Platform.OS === 'android') {
471
+ } else if (isAndroid()) {
477
472
  sessionId = await store.getItemAsync(STORAGE_KEYS.SHARED_SESSION_ID);
478
473
  accessToken = await store.getItemAsync(STORAGE_KEYS.SHARED_SESSION_TOKEN);
479
474
  }
@@ -505,14 +500,14 @@ export class KeyManager {
505
500
  try {
506
501
  const store = await initSecureStore();
507
502
 
508
- if (Platform.OS === 'ios') {
503
+ if (isIOS()) {
509
504
  await store.deleteItemAsync(STORAGE_KEYS.SHARED_SESSION_ID, {
510
505
  keychainAccessGroup: IOS_KEYCHAIN_GROUP,
511
506
  } as any);
512
507
  await store.deleteItemAsync(STORAGE_KEYS.SHARED_SESSION_TOKEN, {
513
508
  keychainAccessGroup: IOS_KEYCHAIN_GROUP,
514
509
  } as any);
515
- } else if (Platform.OS === 'android') {
510
+ } else if (isAndroid()) {
516
511
  await store.deleteItemAsync(STORAGE_KEYS.SHARED_SESSION_ID);
517
512
  await store.deleteItemAsync(STORAGE_KEYS.SHARED_SESSION_TOKEN);
518
513
  }
package/src/index.ts CHANGED
@@ -1,11 +1,17 @@
1
1
  /**
2
2
  * OxyHQServices Main Export File - Universal (Frontend + Backend)
3
- *
3
+ *
4
4
  * This exports everything but uses environment detection to avoid crashes.
5
5
  * - Frontend: Full UI + Core functionality
6
6
  * - Backend: Core functionality only (UI components are no-ops)
7
7
  */
8
8
 
9
+ // IMPORTANT: Initialize platform detection first (before any other imports that may use it)
10
+ // This allows core modules to detect the platform without importing react-native directly
11
+ import { setPlatformOS, type PlatformOS } from './utils/platform';
12
+ import { Platform } from 'react-native';
13
+ setPlatformOS(Platform.OS as PlatformOS);
14
+
9
15
  // IMPORTANT: Import crypto module first to ensure polyfills are loaded
10
16
  // before any other code that might use Buffer or other polyfilled APIs
11
17
  import './crypto/polyfill';
@@ -0,0 +1,28 @@
1
+ /**
2
+ * Sonner Toast - Native Implementation
3
+ *
4
+ * This file is resolved by React Native bundlers (Metro)
5
+ * Only imports 'sonner-native', not 'sonner'
6
+ */
7
+ import * as NativeSonner from 'sonner-native';
8
+
9
+ // Define proper types for the toast components
10
+ interface ToastFunction {
11
+ (message: string, options?: Record<string, unknown>): void;
12
+ success: (message: string, options?: Record<string, unknown>) => void;
13
+ error: (message: string, options?: Record<string, unknown>) => void;
14
+ info: (message: string, options?: Record<string, unknown>) => void;
15
+ warning: (message: string, options?: Record<string, unknown>) => void;
16
+ loading: (message: string, options?: Record<string, unknown>) => void;
17
+ }
18
+
19
+ type ToasterComponent = (props?: Record<string, unknown>) => React.ReactElement | null;
20
+
21
+ const { toast: nativeToast, Toaster: NativeToaster } = NativeSonner as {
22
+ toast: ToastFunction;
23
+ Toaster: ToasterComponent;
24
+ };
25
+
26
+ export const toast = nativeToast;
27
+ export const Toaster = NativeToaster;
28
+ export type ToastT = typeof nativeToast;
package/src/lib/sonner.ts CHANGED
@@ -1,28 +1,11 @@
1
- import { Platform } from 'react-native';
2
- import * as WebSonner from 'sonner';
3
- import * as NativeSonner from 'sonner-native';
4
-
5
- // Define proper types for the toast components
6
- interface ToastFunction {
7
- (message: string, options?: Record<string, unknown>): void;
8
- success: (message: string, options?: Record<string, unknown>) => void;
9
- error: (message: string, options?: Record<string, unknown>) => void;
10
- info: (message: string, options?: Record<string, unknown>) => void;
11
- warning: (message: string, options?: Record<string, unknown>) => void;
12
- loading: (message: string, options?: Record<string, unknown>) => void;
13
- }
14
-
15
- type ToasterComponent = (props?: Record<string, unknown>) => React.ReactElement | null;
16
-
17
- const { toast: webToast, Toaster: WebToaster } = WebSonner as {
18
- toast: ToastFunction;
19
- Toaster: ToasterComponent;
20
- };
21
- const { toast: nativeToast, Toaster: NativeToaster } = NativeSonner as {
22
- toast: ToastFunction;
23
- Toaster: ToasterComponent;
24
- };
25
-
26
- export const toast = Platform.OS === 'web' ? webToast : nativeToast;
27
- export const Toaster = Platform.OS === 'web' ? WebToaster : NativeToaster;
28
- export type ToastT = typeof webToast;
1
+ /**
2
+ * Sonner Toast - Platform-Agnostic Entry Point
3
+ *
4
+ * Bundlers resolve platform-specific implementations:
5
+ * - Metro (React Native): resolves to sonner.native.ts
6
+ * - Vite/Webpack (Web): resolves to sonner.web.ts
7
+ * - Node.js/SSR: uses this file (web fallback)
8
+ *
9
+ * This file exports web as the default for /core and /web entry points.
10
+ */
11
+ export { toast, Toaster, type ToastT } from './sonner.web';
@@ -0,0 +1,28 @@
1
+ /**
2
+ * Sonner Toast - Web Implementation
3
+ *
4
+ * This file is resolved by web bundlers (Vite, Webpack, etc.)
5
+ * Only imports 'sonner' (web version), not 'sonner-native'
6
+ */
7
+ import * as WebSonner from 'sonner';
8
+
9
+ // Define proper types for the toast components
10
+ interface ToastFunction {
11
+ (message: string, options?: Record<string, unknown>): void;
12
+ success: (message: string, options?: Record<string, unknown>) => void;
13
+ error: (message: string, options?: Record<string, unknown>) => void;
14
+ info: (message: string, options?: Record<string, unknown>) => void;
15
+ warning: (message: string, options?: Record<string, unknown>) => void;
16
+ loading: (message: string, options?: Record<string, unknown>) => void;
17
+ }
18
+
19
+ type ToasterComponent = (props?: Record<string, unknown>) => React.ReactElement | null;
20
+
21
+ const { toast: webToast, Toaster: WebToaster } = WebSonner as {
22
+ toast: ToastFunction;
23
+ Toaster: ToasterComponent;
24
+ };
25
+
26
+ export const toast = webToast;
27
+ export const Toaster = WebToaster;
28
+ export type ToastT = typeof webToast;
@@ -0,0 +1,117 @@
1
+ /**
2
+ * Platform Detection Utility
3
+ *
4
+ * Provides platform detection WITHOUT importing from 'react-native'.
5
+ * This allows core modules to be used in web/Node.js environments
6
+ * without bundlers failing on react-native imports.
7
+ */
8
+
9
+ export type PlatformOS = 'ios' | 'android' | 'web' | 'windows' | 'macos' | 'unknown';
10
+
11
+ /**
12
+ * Detect the current platform without importing react-native
13
+ *
14
+ * Detection order:
15
+ * 1. Check for React Native's Platform object on globalThis (set by RN runtime)
16
+ * 2. Check for Node.js environment
17
+ * 3. Check for browser environment
18
+ * 4. Fall back to 'unknown'
19
+ */
20
+ function detectPlatform(): PlatformOS {
21
+ // Check if React Native Platform is available globally (set by RN runtime)
22
+ // This avoids static imports while still detecting RN environment
23
+ const rnPlatform = (globalThis as any).__REACT_NATIVE_PLATFORM__;
24
+ if (rnPlatform) {
25
+ return rnPlatform as PlatformOS;
26
+ }
27
+
28
+ // Check navigator.product for React Native
29
+ if (typeof navigator !== 'undefined' && navigator.product === 'ReactNative') {
30
+ // We're in React Native but Platform wasn't set globally
31
+ // Try to get OS from userAgent or default to 'unknown'
32
+ return 'unknown';
33
+ }
34
+
35
+ // Check for Node.js environment
36
+ if (typeof process !== 'undefined' && process.versions?.node) {
37
+ return 'web'; // Treat Node.js as 'web' for compatibility (no native features)
38
+ }
39
+
40
+ // Check for browser/web environment
41
+ if (typeof window !== 'undefined' && typeof document !== 'undefined') {
42
+ return 'web';
43
+ }
44
+
45
+ return 'unknown';
46
+ }
47
+
48
+ // Cache the platform detection result
49
+ let cachedPlatform: PlatformOS | null = null;
50
+
51
+ /**
52
+ * Get the current platform OS
53
+ * Safe to call from any environment (web, Node.js, React Native)
54
+ */
55
+ export function getPlatformOS(): PlatformOS {
56
+ if (cachedPlatform === null) {
57
+ cachedPlatform = detectPlatform();
58
+ }
59
+ return cachedPlatform;
60
+ }
61
+
62
+ /**
63
+ * Check if running on web platform (browser or Node.js)
64
+ */
65
+ export function isWeb(): boolean {
66
+ return getPlatformOS() === 'web';
67
+ }
68
+
69
+ /**
70
+ * Check if running in a native app (iOS or Android)
71
+ */
72
+ export function isNative(): boolean {
73
+ const os = getPlatformOS();
74
+ return os === 'ios' || os === 'android';
75
+ }
76
+
77
+ /**
78
+ * Check if running on iOS
79
+ */
80
+ export function isIOS(): boolean {
81
+ return getPlatformOS() === 'ios';
82
+ }
83
+
84
+ /**
85
+ * Check if running on Android
86
+ */
87
+ export function isAndroid(): boolean {
88
+ return getPlatformOS() === 'android';
89
+ }
90
+
91
+ /**
92
+ * Set the platform OS explicitly
93
+ * Called by React Native entry point to register the platform
94
+ * This allows lazy detection in environments where react-native is available
95
+ */
96
+ export function setPlatformOS(os: PlatformOS): void {
97
+ cachedPlatform = os;
98
+ (globalThis as any).__REACT_NATIVE_PLATFORM__ = os;
99
+ }
100
+
101
+ /**
102
+ * Try to initialize platform from react-native if available
103
+ * This is called lazily when needed, avoiding top-level imports
104
+ */
105
+ export async function initPlatformFromReactNative(): Promise<void> {
106
+ if (cachedPlatform !== null && cachedPlatform !== 'unknown') {
107
+ return; // Already initialized
108
+ }
109
+
110
+ try {
111
+ // Dynamic import to avoid bundler issues
112
+ const { Platform } = await import('react-native');
113
+ setPlatformOS(Platform.OS as PlatformOS);
114
+ } catch {
115
+ // react-native not available, use detected platform
116
+ }
117
+ }