@oxyhq/services 5.18.2 → 5.18.3

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 (148) hide show
  1. package/lib/commonjs/core/mixins/index.js +36 -13
  2. package/lib/commonjs/core/mixins/index.js.map +1 -1
  3. package/lib/commonjs/index.js +8 -0
  4. package/lib/commonjs/index.js.map +1 -1
  5. package/lib/commonjs/ui/client.js +170 -0
  6. package/lib/commonjs/ui/client.js.map +1 -0
  7. package/lib/commonjs/ui/components/profile/EditFieldModal.js +412 -0
  8. package/lib/commonjs/ui/components/profile/EditFieldModal.js.map +1 -0
  9. package/lib/commonjs/ui/context/OxyContext.js +63 -1
  10. package/lib/commonjs/ui/context/OxyContext.js.map +1 -1
  11. package/lib/commonjs/ui/hooks/useAuth.js +115 -0
  12. package/lib/commonjs/ui/hooks/useAuth.js.map +1 -0
  13. package/lib/commonjs/ui/hooks/useSettingToggle.js +7 -1
  14. package/lib/commonjs/ui/hooks/useSettingToggle.js.map +1 -1
  15. package/lib/commonjs/ui/hooks/useWebSSO.js +75 -0
  16. package/lib/commonjs/ui/hooks/useWebSSO.js.map +1 -0
  17. package/lib/commonjs/ui/index.js +17 -2
  18. package/lib/commonjs/ui/index.js.map +1 -1
  19. package/lib/commonjs/ui/screens/PrivacySettingsScreen.js +59 -65
  20. package/lib/commonjs/ui/screens/PrivacySettingsScreen.js.map +1 -1
  21. package/lib/commonjs/ui/screens/SearchSettingsScreen.js +38 -58
  22. package/lib/commonjs/ui/screens/SearchSettingsScreen.js.map +1 -1
  23. package/lib/commonjs/ui/server.js +105 -0
  24. package/lib/commonjs/ui/server.js.map +1 -0
  25. package/lib/commonjs/ui/utils/iconNames.js +133 -0
  26. package/lib/commonjs/ui/utils/iconNames.js.map +1 -0
  27. package/lib/commonjs/ui/utils/sessionHelpers.js +7 -0
  28. package/lib/commonjs/ui/utils/sessionHelpers.js.map +1 -1
  29. package/lib/commonjs/utils/requestUtils.js +4 -3
  30. package/lib/commonjs/utils/requestUtils.js.map +1 -1
  31. package/lib/module/core/mixins/index.js +36 -13
  32. package/lib/module/core/mixins/index.js.map +1 -1
  33. package/lib/module/index.js +2 -2
  34. package/lib/module/index.js.map +1 -1
  35. package/lib/module/ui/client.js +47 -0
  36. package/lib/module/ui/client.js.map +1 -0
  37. package/lib/module/ui/components/profile/EditFieldModal.js +406 -0
  38. package/lib/module/ui/components/profile/EditFieldModal.js.map +1 -0
  39. package/lib/module/ui/context/OxyContext.js +63 -1
  40. package/lib/module/ui/context/OxyContext.js.map +1 -1
  41. package/lib/module/ui/hooks/useAuth.js +106 -0
  42. package/lib/module/ui/hooks/useAuth.js.map +1 -0
  43. package/lib/module/ui/hooks/useSettingToggle.js +7 -1
  44. package/lib/module/ui/hooks/useSettingToggle.js.map +1 -1
  45. package/lib/module/ui/hooks/useWebSSO.js +71 -0
  46. package/lib/module/ui/hooks/useWebSSO.js.map +1 -0
  47. package/lib/module/ui/index.js +17 -3
  48. package/lib/module/ui/index.js.map +1 -1
  49. package/lib/module/ui/screens/PrivacySettingsScreen.js +59 -65
  50. package/lib/module/ui/screens/PrivacySettingsScreen.js.map +1 -1
  51. package/lib/module/ui/screens/SearchSettingsScreen.js +39 -59
  52. package/lib/module/ui/screens/SearchSettingsScreen.js.map +1 -1
  53. package/lib/module/ui/server.js +65 -0
  54. package/lib/module/ui/server.js.map +1 -0
  55. package/lib/module/ui/utils/iconNames.js +124 -0
  56. package/lib/module/ui/utils/iconNames.js.map +1 -0
  57. package/lib/module/ui/utils/sessionHelpers.js +7 -0
  58. package/lib/module/ui/utils/sessionHelpers.js.map +1 -1
  59. package/lib/module/utils/requestUtils.js +4 -2
  60. package/lib/module/utils/requestUtils.js.map +1 -1
  61. package/lib/typescript/commonjs/core/mixins/index.d.ts +18 -1115
  62. package/lib/typescript/commonjs/core/mixins/index.d.ts.map +1 -1
  63. package/lib/typescript/commonjs/index.d.ts +2 -0
  64. package/lib/typescript/commonjs/index.d.ts.map +1 -1
  65. package/lib/typescript/commonjs/ui/client.d.ts +33 -0
  66. package/lib/typescript/commonjs/ui/client.d.ts.map +1 -0
  67. package/lib/typescript/commonjs/ui/components/profile/EditFieldModal.d.ts +110 -0
  68. package/lib/typescript/commonjs/ui/components/profile/EditFieldModal.d.ts.map +1 -0
  69. package/lib/typescript/commonjs/ui/context/OxyContext.d.ts +3 -0
  70. package/lib/typescript/commonjs/ui/context/OxyContext.d.ts.map +1 -1
  71. package/lib/typescript/commonjs/ui/hooks/mutations/useAccountMutations.d.ts +3 -3
  72. package/lib/typescript/commonjs/ui/hooks/queries/useAccountQueries.d.ts +6 -10
  73. package/lib/typescript/commonjs/ui/hooks/queries/useAccountQueries.d.ts.map +1 -1
  74. package/lib/typescript/commonjs/ui/hooks/queries/useSecurityQueries.d.ts +1 -1
  75. package/lib/typescript/commonjs/ui/hooks/queries/useSecurityQueries.d.ts.map +1 -1
  76. package/lib/typescript/commonjs/ui/hooks/queries/useServicesQueries.d.ts +3 -5
  77. package/lib/typescript/commonjs/ui/hooks/queries/useServicesQueries.d.ts.map +1 -1
  78. package/lib/typescript/commonjs/ui/hooks/useAssets.d.ts +1 -1
  79. package/lib/typescript/commonjs/ui/hooks/useAuth.d.ts +69 -0
  80. package/lib/typescript/commonjs/ui/hooks/useAuth.d.ts.map +1 -0
  81. package/lib/typescript/commonjs/ui/hooks/useSettingToggle.d.ts +4 -2
  82. package/lib/typescript/commonjs/ui/hooks/useSettingToggle.d.ts.map +1 -1
  83. package/lib/typescript/commonjs/ui/hooks/useWebSSO.d.ts +34 -0
  84. package/lib/typescript/commonjs/ui/hooks/useWebSSO.d.ts.map +1 -0
  85. package/lib/typescript/commonjs/ui/index.d.ts +2 -2
  86. package/lib/typescript/commonjs/ui/index.d.ts.map +1 -1
  87. package/lib/typescript/commonjs/ui/screens/PrivacySettingsScreen.d.ts.map +1 -1
  88. package/lib/typescript/commonjs/ui/screens/SearchSettingsScreen.d.ts.map +1 -1
  89. package/lib/typescript/commonjs/ui/server.d.ts +43 -0
  90. package/lib/typescript/commonjs/ui/server.d.ts.map +1 -0
  91. package/lib/typescript/commonjs/ui/utils/iconNames.d.ts +112 -0
  92. package/lib/typescript/commonjs/ui/utils/iconNames.d.ts.map +1 -0
  93. package/lib/typescript/commonjs/ui/utils/sessionHelpers.d.ts +8 -3
  94. package/lib/typescript/commonjs/ui/utils/sessionHelpers.d.ts.map +1 -1
  95. package/lib/typescript/commonjs/utils/requestUtils.d.ts +3 -1
  96. package/lib/typescript/commonjs/utils/requestUtils.d.ts.map +1 -1
  97. package/lib/typescript/module/core/mixins/index.d.ts +18 -1115
  98. package/lib/typescript/module/core/mixins/index.d.ts.map +1 -1
  99. package/lib/typescript/module/index.d.ts +2 -0
  100. package/lib/typescript/module/index.d.ts.map +1 -1
  101. package/lib/typescript/module/ui/client.d.ts +33 -0
  102. package/lib/typescript/module/ui/client.d.ts.map +1 -0
  103. package/lib/typescript/module/ui/components/profile/EditFieldModal.d.ts +110 -0
  104. package/lib/typescript/module/ui/components/profile/EditFieldModal.d.ts.map +1 -0
  105. package/lib/typescript/module/ui/context/OxyContext.d.ts +3 -0
  106. package/lib/typescript/module/ui/context/OxyContext.d.ts.map +1 -1
  107. package/lib/typescript/module/ui/hooks/mutations/useAccountMutations.d.ts +3 -3
  108. package/lib/typescript/module/ui/hooks/queries/useAccountQueries.d.ts +6 -10
  109. package/lib/typescript/module/ui/hooks/queries/useAccountQueries.d.ts.map +1 -1
  110. package/lib/typescript/module/ui/hooks/queries/useSecurityQueries.d.ts +1 -1
  111. package/lib/typescript/module/ui/hooks/queries/useSecurityQueries.d.ts.map +1 -1
  112. package/lib/typescript/module/ui/hooks/queries/useServicesQueries.d.ts +3 -5
  113. package/lib/typescript/module/ui/hooks/queries/useServicesQueries.d.ts.map +1 -1
  114. package/lib/typescript/module/ui/hooks/useAssets.d.ts +1 -1
  115. package/lib/typescript/module/ui/hooks/useAuth.d.ts +69 -0
  116. package/lib/typescript/module/ui/hooks/useAuth.d.ts.map +1 -0
  117. package/lib/typescript/module/ui/hooks/useSettingToggle.d.ts +4 -2
  118. package/lib/typescript/module/ui/hooks/useSettingToggle.d.ts.map +1 -1
  119. package/lib/typescript/module/ui/hooks/useWebSSO.d.ts +34 -0
  120. package/lib/typescript/module/ui/hooks/useWebSSO.d.ts.map +1 -0
  121. package/lib/typescript/module/ui/index.d.ts +2 -2
  122. package/lib/typescript/module/ui/index.d.ts.map +1 -1
  123. package/lib/typescript/module/ui/screens/PrivacySettingsScreen.d.ts.map +1 -1
  124. package/lib/typescript/module/ui/screens/SearchSettingsScreen.d.ts.map +1 -1
  125. package/lib/typescript/module/ui/server.d.ts +43 -0
  126. package/lib/typescript/module/ui/server.d.ts.map +1 -0
  127. package/lib/typescript/module/ui/utils/iconNames.d.ts +112 -0
  128. package/lib/typescript/module/ui/utils/iconNames.d.ts.map +1 -0
  129. package/lib/typescript/module/ui/utils/sessionHelpers.d.ts +8 -3
  130. package/lib/typescript/module/ui/utils/sessionHelpers.d.ts.map +1 -1
  131. package/lib/typescript/module/utils/requestUtils.d.ts +3 -1
  132. package/lib/typescript/module/utils/requestUtils.d.ts.map +1 -1
  133. package/package.json +1 -1
  134. package/src/core/mixins/index.ts +57 -43
  135. package/src/index.ts +3 -1
  136. package/src/ui/client.ts +55 -0
  137. package/src/ui/components/profile/EditFieldModal.tsx +465 -0
  138. package/src/ui/context/OxyContext.tsx +69 -0
  139. package/src/ui/hooks/useAuth.ts +159 -0
  140. package/src/ui/hooks/useSettingToggle.ts +7 -3
  141. package/src/ui/hooks/useWebSSO.ts +93 -0
  142. package/src/ui/index.ts +17 -2
  143. package/src/ui/screens/PrivacySettingsScreen.tsx +54 -63
  144. package/src/ui/screens/SearchSettingsScreen.tsx +42 -64
  145. package/src/ui/server.ts +70 -0
  146. package/src/ui/utils/iconNames.ts +136 -0
  147. package/src/ui/utils/sessionHelpers.ts +10 -3
  148. package/src/utils/requestUtils.ts +10 -7
@@ -0,0 +1,112 @@
1
+ /**
2
+ * Type-safe icon name utilities
3
+ *
4
+ * Provides centralized, typed icon name mappings to eliminate `as any` casts
5
+ * when using dynamic icon names with @expo/vector-icons.
6
+ */
7
+ /**
8
+ * Profile field icons (MaterialCommunityIcons)
9
+ */
10
+ export declare const PROFILE_FIELD_ICONS: {
11
+ readonly displayName: "account-outline";
12
+ readonly username: "at";
13
+ readonly email: "email-outline";
14
+ readonly bio: "text-box-outline";
15
+ readonly location: "map-marker-outline";
16
+ readonly links: "link-variant";
17
+ readonly website: "web";
18
+ readonly phone: "phone-outline";
19
+ readonly birthday: "cake-variant-outline";
20
+ };
21
+ export type ProfileFieldIconKey = keyof typeof PROFILE_FIELD_ICONS;
22
+ /**
23
+ * Get icon name for a profile field
24
+ */
25
+ export declare function getProfileFieldIcon(field: string): string;
26
+ /**
27
+ * Settings section icons (MaterialCommunityIcons)
28
+ */
29
+ export declare const SETTINGS_ICONS: {
30
+ readonly account: "account-cog-outline";
31
+ readonly privacy: "shield-account-outline";
32
+ readonly security: "lock-outline";
33
+ readonly notifications: "bell-outline";
34
+ readonly language: "translate";
35
+ readonly appearance: "palette-outline";
36
+ readonly storage: "folder-outline";
37
+ readonly help: "help-circle-outline";
38
+ readonly about: "information-outline";
39
+ readonly logout: "logout";
40
+ };
41
+ export type SettingsIconKey = keyof typeof SETTINGS_ICONS;
42
+ /**
43
+ * Get icon name for a settings section
44
+ */
45
+ export declare function getSettingsIcon(section: string): string;
46
+ /**
47
+ * File type icons (MaterialCommunityIcons)
48
+ */
49
+ export declare const FILE_TYPE_ICONS: {
50
+ readonly image: "image-outline";
51
+ readonly video: "video-outline";
52
+ readonly audio: "music-note-outline";
53
+ readonly document: "file-document-outline";
54
+ readonly pdf: "file-pdf-box";
55
+ readonly archive: "folder-zip-outline";
56
+ readonly code: "code-tags";
57
+ readonly spreadsheet: "file-excel-outline";
58
+ readonly presentation: "file-presentation-outline";
59
+ readonly text: "file-document-edit-outline";
60
+ readonly unknown: "file-outline";
61
+ };
62
+ export type FileTypeIconKey = keyof typeof FILE_TYPE_ICONS;
63
+ /**
64
+ * Get icon name for a file type
65
+ */
66
+ export declare function getFileTypeIcon(type: string): string;
67
+ /**
68
+ * Action icons (Ionicons)
69
+ */
70
+ export declare const ACTION_ICONS: {
71
+ readonly close: "close";
72
+ readonly back: "chevron-back";
73
+ readonly forward: "chevron-forward";
74
+ readonly add: "add";
75
+ readonly remove: "remove";
76
+ readonly delete: "trash-outline";
77
+ readonly edit: "pencil-outline";
78
+ readonly save: "checkmark";
79
+ readonly cancel: "close";
80
+ readonly search: "search-outline";
81
+ readonly filter: "filter-outline";
82
+ readonly sort: "swap-vertical-outline";
83
+ readonly refresh: "refresh-outline";
84
+ readonly share: "share-outline";
85
+ readonly copy: "copy-outline";
86
+ readonly download: "download-outline";
87
+ readonly upload: "cloud-upload-outline";
88
+ };
89
+ export type ActionIconKey = keyof typeof ACTION_ICONS;
90
+ /**
91
+ * Get icon name for an action
92
+ */
93
+ export declare function getActionIcon(action: string): string;
94
+ /**
95
+ * Status icons (Ionicons)
96
+ */
97
+ export declare const STATUS_ICONS: {
98
+ readonly success: "checkmark-circle";
99
+ readonly error: "alert-circle";
100
+ readonly warning: "warning";
101
+ readonly info: "information-circle";
102
+ readonly loading: "hourglass-outline";
103
+ readonly pending: "time-outline";
104
+ readonly online: "ellipse";
105
+ readonly offline: "ellipse-outline";
106
+ };
107
+ export type StatusIconKey = keyof typeof STATUS_ICONS;
108
+ /**
109
+ * Get icon name for a status
110
+ */
111
+ export declare function getStatusIcon(status: string): string;
112
+ //# sourceMappingURL=iconNames.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"iconNames.d.ts","sourceRoot":"","sources":["../../../../../src/ui/utils/iconNames.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH;;GAEG;AACH,eAAO,MAAM,mBAAmB;;;;;;;;;;CAUtB,CAAC;AAEX,MAAM,MAAM,mBAAmB,GAAG,MAAM,OAAO,mBAAmB,CAAC;AAEnE;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAEzD;AAED;;GAEG;AACH,eAAO,MAAM,cAAc;;;;;;;;;;;CAWjB,CAAC;AAEX,MAAM,MAAM,eAAe,GAAG,MAAM,OAAO,cAAc,CAAC;AAE1D;;GAEG;AACH,wBAAgB,eAAe,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAEvD;AAED;;GAEG;AACH,eAAO,MAAM,eAAe;;;;;;;;;;;;CAYlB,CAAC;AAEX,MAAM,MAAM,eAAe,GAAG,MAAM,OAAO,eAAe,CAAC;AAE3D;;GAEG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAEpD;AAED;;GAEG;AACH,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;;;CAkBf,CAAC;AAEX,MAAM,MAAM,aAAa,GAAG,MAAM,OAAO,YAAY,CAAC;AAEtD;;GAEG;AACH,wBAAgB,aAAa,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAEpD;AAED;;GAEG;AACH,eAAO,MAAM,YAAY;;;;;;;;;CASf,CAAC;AAEX,MAAM,MAAM,aAAa,GAAG,MAAM,OAAO,YAAY,CAAC;AAEtD;;GAEG;AACH,wBAAgB,aAAa,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAEpD"}
@@ -1,4 +1,3 @@
1
- import type { OxyServices } from '../../core';
2
1
  import type { ClientSession } from '../../models/session';
3
2
  interface DeviceSession {
4
3
  sessionId: string;
@@ -15,6 +14,12 @@ interface DeviceSession {
15
14
  userId?: string;
16
15
  isCurrent?: boolean;
17
16
  }
17
+ /**
18
+ * Service type for session helpers.
19
+ * Uses 'any' to work around TypeScript mixin composition type inference issues.
20
+ * The OxyServices class has these methods but TypeScript can't see them due to the mixin pattern.
21
+ */
22
+ type OxyServicesAny = any;
18
23
  export interface FetchSessionsWithFallbackOptions {
19
24
  fallbackDeviceId?: string;
20
25
  fallbackUserId?: string;
@@ -46,7 +51,7 @@ export declare const mapSessionsToClient: (sessions: DeviceSession[], fallbackDe
46
51
  * @param sessionId - Session identifier to fetch
47
52
  * @param options - Optional fallback options
48
53
  */
49
- export declare const fetchSessionsWithFallback: (oxyServices: Pick<OxyServices, "getDeviceSessions" | "getSessionsBySessionId">, sessionId: string, { fallbackDeviceId, fallbackUserId, logger, }?: FetchSessionsWithFallbackOptions) => Promise<ClientSession[]>;
54
+ export declare const fetchSessionsWithFallback: (oxyServices: OxyServicesAny, sessionId: string, { fallbackDeviceId, fallbackUserId, logger, }?: FetchSessionsWithFallbackOptions) => Promise<ClientSession[]>;
50
55
  /**
51
56
  * Validate multiple sessions concurrently with configurable concurrency.
52
57
  *
@@ -54,6 +59,6 @@ export declare const fetchSessionsWithFallback: (oxyServices: Pick<OxyServices,
54
59
  * @param sessionIds - Session identifiers to validate
55
60
  * @param options - Validation options
56
61
  */
57
- export declare const validateSessionBatch: (oxyServices: Pick<OxyServices, "validateSession">, sessionIds: string[], { useHeaderValidation, maxConcurrency }?: ValidateSessionBatchOptions) => Promise<SessionValidationResult[]>;
62
+ export declare const validateSessionBatch: (oxyServices: OxyServicesAny, sessionIds: string[], { useHeaderValidation, maxConcurrency }?: ValidateSessionBatchOptions) => Promise<SessionValidationResult[]>;
58
63
  export {};
59
64
  //# sourceMappingURL=sessionHelpers.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"sessionHelpers.d.ts","sourceRoot":"","sources":["../../../../../src/ui/utils/sessionHelpers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAC9C,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAE1D,UAAU,aAAa;IACrB,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,UAAU,CAAC,E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,MAAM,EACzB,iBAAiB,MAAM,KACtB,aAAa,EAgBf,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,yBAAyB,GACpC,aAAa,cAAc,EAC3B,WAAW,MAAM,EACjB,gDAIG,gCAAqC,KACvC,OAAO,CAAC,aAAa,EAAE,CAYzB,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,oBAAoB,GAC/B,aAAa,cAAc,EAC3B,YAAY,MAAM,EAAE,EACpB,0CAAoD,2BAAgC,KACnF,OAAO,CAAC,uBAAuB,EAAE,CAuCnC,CAAC"}
@@ -87,6 +87,8 @@ export declare class RequestQueue {
87
87
  */
88
88
  runningCount(): number;
89
89
  }
90
+ /** Log level type for SimpleLogger */
91
+ export type LogLevel = 'none' | 'error' | 'warn' | 'info' | 'debug';
90
92
  /**
91
93
  * Simple logger with level support
92
94
  *
@@ -111,7 +113,7 @@ export declare class SimpleLogger {
111
113
  * @param level Minimum log level
112
114
  * @param prefix Prefix for log messages (default: '')
113
115
  */
114
- constructor(enabled?: boolean, level?: string, prefix?: string);
116
+ constructor(enabled?: boolean, level?: LogLevel, prefix?: string);
115
117
  private shouldLog;
116
118
  private formatMessage;
117
119
  error(...args: any[]): void;
@@ -1 +1 @@
1
- {"version":3,"file":"requestUtils.d.ts","sourceRoot":"","sources":["../../../../src/utils/requestUtils.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;;;;;;;;;;;;;;GAeG;AACH,qBAAa,mBAAmB;IAC9B,OAAO,CAAC,eAAe,CAAmC;IAE1D;;;;;OAKG;IACG,WAAW,CAAC,CAAC,EACjB,GAAG,EAAE,MAAM,EACX,SAAS,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,GAC1B,OAAO,CAAC,CAAC,CAAC;IAeb;;OAEG;IACH,KAAK,IAAI,IAAI;IAIb;;OAEG;IACH,IAAI,IAAI,MAAM;CAGf;AAED;;;;;;;;;;;;;;;GAeG;AACH,qBAAa,YAAY;IACvB,OAAO,CAAC,K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GAAG,EAAE,GAAG,IAAI;CAK5B"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@oxyhq/services",
3
- "version": "5.18.2",
3
+ "version": "5.18.3",
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",
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Centralized mixin exports and composition helper
3
- *
3
+ *
4
4
  * This module provides a clean way to compose all mixins
5
5
  * and ensures consistent ordering for better maintainability
6
6
  */
@@ -24,54 +24,68 @@ import { OxyServicesSecurityMixin } from './OxyServices.security';
24
24
  import { OxyServicesUtilityMixin } from './OxyServices.utility';
25
25
  import { OxyServicesFeaturesMixin } from './OxyServices.features';
26
26
 
27
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
28
+ type MixinFunction = (Base: any) => any;
29
+
27
30
  /**
28
- * Composes all OxyServices mixins in the correct order
31
+ * Mixin pipeline - applied in order from first to last.
29
32
  *
30
- * Order matters for mixins - dependencies should be applied first.
31
- * This function ensures consistent composition across the codebase.
33
+ * Order matters for dependencies:
34
+ * 1. Base auth mixin first (required by all others)
35
+ * 2. Cross-domain auth mixins (FedCM, Popup, Redirect)
36
+ * 3. User mixin (requires auth)
37
+ * 4. Feature mixins (can depend on user)
38
+ * 5. Utility mixin last (augments all)
32
39
  *
33
- * New cross-domain auth mixins added:
34
- * - FedCM: Modern browser-native identity federation (Google-style)
35
- * - Popup: OAuth2-style popup authentication
36
- * - Redirect: Traditional redirect-based authentication
40
+ * To add a new mixin: insert it at the appropriate position in this array.
41
+ */
42
+ const MIXIN_PIPELINE: MixinFunction[] = [
43
+ // Base authentication
44
+ OxyServicesAuthMixin,
45
+
46
+ // Cross-domain authentication (web-only)
47
+ // - FedCM: Modern browser-native identity federation (Google-style)
48
+ // - Popup: OAuth2-style popup authentication
49
+ // - Redirect: Traditional redirect-based authentication
50
+ OxyServicesFedCMMixin,
51
+ OxyServicesPopupAuthMixin,
52
+ OxyServicesRedirectAuthMixin,
53
+
54
+ // User management (requires auth)
55
+ OxyServicesUserMixin,
56
+ OxyServicesPrivacyMixin,
57
+
58
+ // Feature mixins
59
+ OxyServicesLanguageMixin,
60
+ OxyServicesPaymentMixin,
61
+ OxyServicesKarmaMixin,
62
+ OxyServicesAssetsMixin,
63
+ OxyServicesDeveloperMixin,
64
+ OxyServicesLocationMixin,
65
+ OxyServicesAnalyticsMixin,
66
+ OxyServicesDevicesMixin,
67
+ OxyServicesSecurityMixin,
68
+ OxyServicesFeaturesMixin,
69
+
70
+ // Utility (last, can use all above)
71
+ OxyServicesUtilityMixin,
72
+ ];
73
+
74
+ /**
75
+ * Composes all OxyServices mixins using a pipeline pattern.
76
+ *
77
+ * This is equivalent to the nested calls but more readable and maintainable.
78
+ * Adding a new mixin: just add it to MIXIN_PIPELINE at the appropriate position.
37
79
  *
38
80
  * @returns The fully composed OxyServices class with all mixins applied
39
81
  */
40
82
  export function composeOxyServices() {
41
- return OxyServicesUtilityMixin(
42
- OxyServicesFeaturesMixin(
43
- OxyServicesSecurityMixin(
44
- OxyServicesDevicesMixin(
45
- OxyServicesAnalyticsMixin(
46
- OxyServicesLocationMixin(
47
- OxyServicesDeveloperMixin(
48
- OxyServicesAssetsMixin(
49
- OxyServicesKarmaMixin(
50
- OxyServicesPaymentMixin(
51
- OxyServicesLanguageMixin(
52
- OxyServicesPrivacyMixin(
53
- OxyServicesUserMixin(
54
- // Cross-domain authentication mixins (web-only)
55
- OxyServicesRedirectAuthMixin(
56
- OxyServicesPopupAuthMixin(
57
- OxyServicesFedCMMixin(
58
- // Base authentication mixin
59
- OxyServicesAuthMixin(OxyServicesBase)
60
- )
61
- )
62
- )
63
- )
64
- )
65
- )
66
- )
67
- )
68
- )
69
- )
70
- )
71
- )
72
- )
73
- )
74
- )
75
- );
83
+ return MIXIN_PIPELINE.reduce(
84
+ (Base, mixin) => mixin(Base),
85
+ OxyServicesBase as unknown as ReturnType<MixinFunction>
86
+ );
76
87
  }
77
88
 
89
+ // Export the pipeline for testing/debugging
90
+ export { MIXIN_PIPELINE };
91
+
package/src/index.ts CHANGED
@@ -31,8 +31,10 @@ export type {
31
31
  RecoveryPhraseResult
32
32
  } from './crypto';
33
33
 
34
- // React context
34
+ // React context and auth hooks
35
35
  export { useOxy } from './ui/context/OxyContext';
36
+ export { useAuth } from './ui/hooks/useAuth';
37
+ export type { AuthState, AuthActions, UseAuthReturn } from './ui/hooks/useAuth';
36
38
 
37
39
  // Streamlined provider with built-in bottom sheet
38
40
  export { default as OxyProvider } from './ui/components/OxyProvider';
@@ -0,0 +1,55 @@
1
+ /**
2
+ * Client-only UI exports (tree-shakeable)
3
+ *
4
+ * Import from this module for client-side bundles where tree-shaking is important.
5
+ * These are direct exports without runtime detection overhead.
6
+ *
7
+ * @example
8
+ * import { OxyProvider, useOxy, Avatar } from '@oxyhq/services/ui/client';
9
+ */
10
+
11
+ // Components
12
+ export { default as OxyProvider } from './components/OxyProvider';
13
+ export { default as OxySignInButton } from './components/OxySignInButton';
14
+ export { default as OxyLogo } from './components/OxyLogo';
15
+ export { default as Avatar } from './components/Avatar';
16
+ export { default as FollowButton } from './components/FollowButton';
17
+ export { default as OxyPayButton } from './components/OxyPayButton';
18
+ export { FontLoader, setupFonts } from './components/FontLoader';
19
+ export { OxyIcon } from './components/icon';
20
+
21
+ // Context
22
+ export { useOxy } from './context/OxyContext';
23
+
24
+ // Hooks
25
+ export { useAuth } from './hooks/useAuth';
26
+ export type { AuthState, AuthActions, UseAuthReturn } from './hooks/useAuth';
27
+ export { useFollow } from './hooks';
28
+ export { useStorage } from './hooks/useStorage';
29
+ export type { UseStorageOptions, UseStorageResult } from './hooks/useStorage';
30
+
31
+ // Screens
32
+ export { default as ProfileScreen } from './screens/ProfileScreen';
33
+
34
+ // Stores
35
+ export { useAuthStore } from './stores/authStore';
36
+ export { useAccountStore } from './stores/accountStore';
37
+
38
+ // Styles
39
+ export { fontFamilies, fontStyles } from './styles/fonts';
40
+
41
+ // Toast
42
+ export { toast } from '../lib/sonner';
43
+
44
+ // Core re-exports for convenience
45
+ export { OxyServices } from '../core';
46
+ export type { User, LoginResponse, ApiError } from '../models/interfaces';
47
+
48
+ // Error handler utilities
49
+ export {
50
+ handleAuthError,
51
+ isInvalidSessionError,
52
+ isTimeoutOrNetworkError,
53
+ extractErrorMessage,
54
+ } from './utils/errorHandlers';
55
+ export type { HandleAuthErrorOptions } from './utils/errorHandlers';