@oxyhq/services 5.13.12 → 5.13.16

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 (209) hide show
  1. package/README.md +10 -0
  2. package/lib/commonjs/core/OxyServices.base.js +271 -0
  3. package/lib/commonjs/core/OxyServices.base.js.map +1 -0
  4. package/lib/commonjs/core/OxyServices.errors.js +26 -0
  5. package/lib/commonjs/core/OxyServices.errors.js.map +1 -0
  6. package/lib/commonjs/core/OxyServices.js +58 -2009
  7. package/lib/commonjs/core/OxyServices.js.map +1 -1
  8. package/lib/commonjs/core/mixins/OxyServices.analytics.js +60 -0
  9. package/lib/commonjs/core/mixins/OxyServices.analytics.js.map +1 -0
  10. package/lib/commonjs/core/mixins/OxyServices.assets.js +406 -0
  11. package/lib/commonjs/core/mixins/OxyServices.assets.js.map +1 -0
  12. package/lib/commonjs/core/mixins/OxyServices.auth.js +303 -0
  13. package/lib/commonjs/core/mixins/OxyServices.auth.js.map +1 -0
  14. package/lib/commonjs/core/mixins/OxyServices.developer.js +115 -0
  15. package/lib/commonjs/core/mixins/OxyServices.developer.js.map +1 -0
  16. package/lib/commonjs/core/mixins/OxyServices.devices.js +119 -0
  17. package/lib/commonjs/core/mixins/OxyServices.devices.js.map +1 -0
  18. package/lib/commonjs/core/mixins/OxyServices.karma.js +117 -0
  19. package/lib/commonjs/core/mixins/OxyServices.karma.js.map +1 -0
  20. package/lib/commonjs/core/mixins/OxyServices.language.js +124 -0
  21. package/lib/commonjs/core/mixins/OxyServices.language.js.map +1 -0
  22. package/lib/commonjs/core/mixins/OxyServices.location.js +55 -0
  23. package/lib/commonjs/core/mixins/OxyServices.location.js.map +1 -0
  24. package/lib/commonjs/core/mixins/OxyServices.payment.js +66 -0
  25. package/lib/commonjs/core/mixins/OxyServices.payment.js.map +1 -0
  26. package/lib/commonjs/core/mixins/OxyServices.privacy.js +174 -0
  27. package/lib/commonjs/core/mixins/OxyServices.privacy.js.map +1 -0
  28. package/lib/commonjs/core/mixins/OxyServices.totp.js +53 -0
  29. package/lib/commonjs/core/mixins/OxyServices.totp.js.map +1 -0
  30. package/lib/commonjs/core/mixins/OxyServices.user.js +389 -0
  31. package/lib/commonjs/core/mixins/OxyServices.user.js.map +1 -0
  32. package/lib/commonjs/core/mixins/OxyServices.utility.js +161 -0
  33. package/lib/commonjs/core/mixins/OxyServices.utility.js.map +1 -0
  34. package/lib/commonjs/core/mixins/index.js +39 -0
  35. package/lib/commonjs/core/mixins/index.js.map +1 -0
  36. package/lib/commonjs/core/mixins/mixinHelpers.js +62 -0
  37. package/lib/commonjs/core/mixins/mixinHelpers.js.map +1 -0
  38. package/lib/commonjs/index.js.map +1 -1
  39. package/lib/commonjs/ui/context/OxyContext.js +26 -47
  40. package/lib/commonjs/ui/context/OxyContext.js.map +1 -1
  41. package/lib/commonjs/ui/screens/PrivacySettingsScreen.js +239 -1
  42. package/lib/commonjs/ui/screens/PrivacySettingsScreen.js.map +1 -1
  43. package/lib/commonjs/utils/apiUtils.js +0 -14
  44. package/lib/commonjs/utils/apiUtils.js.map +1 -1
  45. package/lib/commonjs/utils/asyncUtils.js +0 -20
  46. package/lib/commonjs/utils/asyncUtils.js.map +1 -1
  47. package/lib/module/core/OxyServices.base.js +265 -0
  48. package/lib/module/core/OxyServices.base.js.map +1 -0
  49. package/lib/module/core/OxyServices.errors.js +20 -0
  50. package/lib/module/core/OxyServices.errors.js.map +1 -0
  51. package/lib/module/core/OxyServices.js +43 -2005
  52. package/lib/module/core/OxyServices.js.map +1 -1
  53. package/lib/module/core/mixins/OxyServices.analytics.js +56 -0
  54. package/lib/module/core/mixins/OxyServices.analytics.js.map +1 -0
  55. package/lib/module/core/mixins/OxyServices.assets.js +402 -0
  56. package/lib/module/core/mixins/OxyServices.assets.js.map +1 -0
  57. package/lib/module/core/mixins/OxyServices.auth.js +299 -0
  58. package/lib/module/core/mixins/OxyServices.auth.js.map +1 -0
  59. package/lib/module/core/mixins/OxyServices.developer.js +111 -0
  60. package/lib/module/core/mixins/OxyServices.developer.js.map +1 -0
  61. package/lib/module/core/mixins/OxyServices.devices.js +115 -0
  62. package/lib/module/core/mixins/OxyServices.devices.js.map +1 -0
  63. package/lib/module/core/mixins/OxyServices.karma.js +113 -0
  64. package/lib/module/core/mixins/OxyServices.karma.js.map +1 -0
  65. package/lib/module/core/mixins/OxyServices.language.js +120 -0
  66. package/lib/module/core/mixins/OxyServices.language.js.map +1 -0
  67. package/lib/module/core/mixins/OxyServices.location.js +51 -0
  68. package/lib/module/core/mixins/OxyServices.location.js.map +1 -0
  69. package/lib/module/core/mixins/OxyServices.payment.js +62 -0
  70. package/lib/module/core/mixins/OxyServices.payment.js.map +1 -0
  71. package/lib/module/core/mixins/OxyServices.privacy.js +170 -0
  72. package/lib/module/core/mixins/OxyServices.privacy.js.map +1 -0
  73. package/lib/module/core/mixins/OxyServices.totp.js +49 -0
  74. package/lib/module/core/mixins/OxyServices.totp.js.map +1 -0
  75. package/lib/module/core/mixins/OxyServices.user.js +385 -0
  76. package/lib/module/core/mixins/OxyServices.user.js.map +1 -0
  77. package/lib/module/core/mixins/OxyServices.utility.js +156 -0
  78. package/lib/module/core/mixins/OxyServices.utility.js.map +1 -0
  79. package/lib/module/core/mixins/index.js +36 -0
  80. package/lib/module/core/mixins/index.js.map +1 -0
  81. package/lib/module/core/mixins/mixinHelpers.js +56 -0
  82. package/lib/module/core/mixins/mixinHelpers.js.map +1 -0
  83. package/lib/module/index.js.map +1 -1
  84. package/lib/module/ui/context/OxyContext.js +26 -47
  85. package/lib/module/ui/context/OxyContext.js.map +1 -1
  86. package/lib/module/ui/navigation/types.js.map +1 -1
  87. package/lib/module/ui/screens/PrivacySettingsScreen.js +241 -3
  88. package/lib/module/ui/screens/PrivacySettingsScreen.js.map +1 -1
  89. package/lib/module/utils/apiUtils.js +0 -13
  90. package/lib/module/utils/apiUtils.js.map +1 -1
  91. package/lib/module/utils/asyncUtils.js +0 -20
  92. package/lib/module/utils/asyncUtils.js.map +1 -1
  93. package/lib/typescript/core/OxyServices.base.d.ts +123 -0
  94. package/lib/typescript/core/OxyServices.base.d.ts.map +1 -0
  95. package/lib/typescript/core/OxyServices.d.ts +969 -682
  96. package/lib/typescript/core/OxyServices.d.ts.map +1 -1
  97. package/lib/typescript/core/OxyServices.errors.d.ts +12 -0
  98. package/lib/typescript/core/OxyServices.errors.d.ts.map +1 -0
  99. package/lib/typescript/core/mixins/OxyServices.analytics.d.ts +70 -0
  100. package/lib/typescript/core/mixins/OxyServices.analytics.d.ts.map +1 -0
  101. package/lib/typescript/core/mixins/OxyServices.assets.d.ts +159 -0
  102. package/lib/typescript/core/mixins/OxyServices.assets.d.ts.map +1 -0
  103. package/lib/typescript/core/mixins/OxyServices.auth.d.ts +168 -0
  104. package/lib/typescript/core/mixins/OxyServices.auth.d.ts.map +1 -0
  105. package/lib/typescript/core/mixins/OxyServices.developer.d.ts +103 -0
  106. package/lib/typescript/core/mixins/OxyServices.developer.d.ts.map +1 -0
  107. package/lib/typescript/core/mixins/OxyServices.devices.d.ts +93 -0
  108. package/lib/typescript/core/mixins/OxyServices.devices.d.ts.map +1 -0
  109. package/lib/typescript/core/mixins/OxyServices.karma.d.ts +89 -0
  110. package/lib/typescript/core/mixins/OxyServices.karma.d.ts.map +1 -0
  111. package/lib/typescript/core/mixins/OxyServices.language.d.ts +85 -0
  112. package/lib/typescript/core/mixins/OxyServices.language.d.ts.map +1 -0
  113. package/lib/typescript/core/mixins/OxyServices.location.d.ts +68 -0
  114. package/lib/typescript/core/mixins/OxyServices.location.d.ts.map +1 -0
  115. package/lib/typescript/core/mixins/OxyServices.payment.d.ts +74 -0
  116. package/lib/typescript/core/mixins/OxyServices.payment.d.ts.map +1 -0
  117. package/lib/typescript/core/mixins/OxyServices.privacy.d.ts +126 -0
  118. package/lib/typescript/core/mixins/OxyServices.privacy.d.ts.map +1 -0
  119. package/lib/typescript/core/mixins/OxyServices.totp.d.ts +69 -0
  120. package/lib/typescript/core/mixins/OxyServices.totp.d.ts.map +1 -0
  121. package/lib/typescript/core/mixins/OxyServices.user.d.ts +189 -0
  122. package/lib/typescript/core/mixins/OxyServices.user.d.ts.map +1 -0
  123. package/lib/typescript/core/mixins/OxyServices.utility.d.ts +97 -0
  124. package/lib/typescript/core/mixins/OxyServices.utility.d.ts.map +1 -0
  125. package/lib/typescript/core/mixins/index.d.ts +898 -0
  126. package/lib/typescript/core/mixins/index.d.ts.map +1 -0
  127. package/lib/typescript/core/mixins/mixinHelpers.d.ts +32 -0
  128. package/lib/typescript/core/mixins/mixinHelpers.d.ts.map +1 -0
  129. package/lib/typescript/index.d.ts +1 -1
  130. package/lib/typescript/index.d.ts.map +1 -1
  131. package/lib/typescript/models/interfaces.d.ts +36 -0
  132. package/lib/typescript/models/interfaces.d.ts.map +1 -1
  133. package/lib/typescript/ui/context/OxyContext.d.ts +2 -6
  134. package/lib/typescript/ui/context/OxyContext.d.ts.map +1 -1
  135. package/lib/typescript/ui/navigation/types.d.ts +0 -1
  136. package/lib/typescript/ui/navigation/types.d.ts.map +1 -1
  137. package/lib/typescript/ui/screens/PrivacySettingsScreen.d.ts.map +1 -1
  138. package/lib/typescript/utils/apiUtils.d.ts +0 -7
  139. package/lib/typescript/utils/apiUtils.d.ts.map +1 -1
  140. package/lib/typescript/utils/asyncUtils.d.ts +0 -11
  141. package/lib/typescript/utils/asyncUtils.d.ts.map +1 -1
  142. package/package.json +1 -1
  143. package/src/core/OxyServices.base.ts +311 -0
  144. package/src/core/OxyServices.errors.ts +26 -0
  145. package/src/core/OxyServices.ts +43 -2026
  146. package/src/core/mixins/OxyServices.analytics.ts +53 -0
  147. package/src/core/mixins/OxyServices.assets.ts +390 -0
  148. package/src/core/mixins/OxyServices.auth.ts +275 -0
  149. package/src/core/mixins/OxyServices.developer.ts +114 -0
  150. package/src/core/mixins/OxyServices.devices.ts +103 -0
  151. package/src/core/mixins/OxyServices.karma.ts +111 -0
  152. package/src/core/mixins/OxyServices.language.ts +127 -0
  153. package/src/core/mixins/OxyServices.location.ts +46 -0
  154. package/src/core/mixins/OxyServices.payment.ts +59 -0
  155. package/src/core/mixins/OxyServices.privacy.ts +182 -0
  156. package/src/core/mixins/OxyServices.totp.ts +36 -0
  157. package/src/core/mixins/OxyServices.user.ts +380 -0
  158. package/src/core/mixins/OxyServices.utility.ts +187 -0
  159. package/src/core/mixins/index.ts +58 -0
  160. package/src/core/mixins/mixinHelpers.ts +69 -0
  161. package/src/index.ts +4 -0
  162. package/src/models/interfaces.ts +40 -0
  163. package/src/ui/context/OxyContext.tsx +35 -53
  164. package/src/ui/navigation/types.ts +0 -1
  165. package/src/ui/screens/PrivacySettingsScreen.tsx +240 -2
  166. package/src/utils/apiUtils.ts +0 -14
  167. package/src/utils/asyncUtils.ts +0 -20
  168. package/lib/commonjs/ui/screens/internal/SignInPasswordStep.js +0 -192
  169. package/lib/commonjs/ui/screens/internal/SignInPasswordStep.js.map +0 -1
  170. package/lib/commonjs/ui/screens/internal/SignInUsernameStep.js +0 -142
  171. package/lib/commonjs/ui/screens/internal/SignInUsernameStep.js.map +0 -1
  172. package/lib/commonjs/ui/screens/internal/SignUpIdentityStep.js +0 -113
  173. package/lib/commonjs/ui/screens/internal/SignUpIdentityStep.js.map +0 -1
  174. package/lib/commonjs/ui/screens/internal/SignUpSecurityStep.js +0 -132
  175. package/lib/commonjs/ui/screens/internal/SignUpSecurityStep.js.map +0 -1
  176. package/lib/commonjs/ui/screens/internal/SignUpSummaryStep.js +0 -83
  177. package/lib/commonjs/ui/screens/internal/SignUpSummaryStep.js.map +0 -1
  178. package/lib/commonjs/ui/screens/internal/SignUpWelcomeStep.js +0 -58
  179. package/lib/commonjs/ui/screens/internal/SignUpWelcomeStep.js.map +0 -1
  180. package/lib/module/ui/screens/internal/SignInPasswordStep.js +0 -186
  181. package/lib/module/ui/screens/internal/SignInPasswordStep.js.map +0 -1
  182. package/lib/module/ui/screens/internal/SignInUsernameStep.js +0 -136
  183. package/lib/module/ui/screens/internal/SignInUsernameStep.js.map +0 -1
  184. package/lib/module/ui/screens/internal/SignUpIdentityStep.js +0 -108
  185. package/lib/module/ui/screens/internal/SignUpIdentityStep.js.map +0 -1
  186. package/lib/module/ui/screens/internal/SignUpSecurityStep.js +0 -127
  187. package/lib/module/ui/screens/internal/SignUpSecurityStep.js.map +0 -1
  188. package/lib/module/ui/screens/internal/SignUpSummaryStep.js +0 -78
  189. package/lib/module/ui/screens/internal/SignUpSummaryStep.js.map +0 -1
  190. package/lib/module/ui/screens/internal/SignUpWelcomeStep.js +0 -53
  191. package/lib/module/ui/screens/internal/SignUpWelcomeStep.js.map +0 -1
  192. package/lib/typescript/ui/screens/internal/SignInPasswordStep.d.ts +0 -28
  193. package/lib/typescript/ui/screens/internal/SignInPasswordStep.d.ts.map +0 -1
  194. package/lib/typescript/ui/screens/internal/SignInUsernameStep.d.ts +0 -25
  195. package/lib/typescript/ui/screens/internal/SignInUsernameStep.d.ts.map +0 -1
  196. package/lib/typescript/ui/screens/internal/SignUpIdentityStep.d.ts +0 -20
  197. package/lib/typescript/ui/screens/internal/SignUpIdentityStep.d.ts.map +0 -1
  198. package/lib/typescript/ui/screens/internal/SignUpSecurityStep.d.ts +0 -24
  199. package/lib/typescript/ui/screens/internal/SignUpSecurityStep.d.ts.map +0 -1
  200. package/lib/typescript/ui/screens/internal/SignUpSummaryStep.d.ts +0 -15
  201. package/lib/typescript/ui/screens/internal/SignUpSummaryStep.d.ts.map +0 -1
  202. package/lib/typescript/ui/screens/internal/SignUpWelcomeStep.d.ts +0 -13
  203. package/lib/typescript/ui/screens/internal/SignUpWelcomeStep.d.ts.map +0 -1
  204. package/src/ui/screens/internal/SignInPasswordStep.tsx +0 -184
  205. package/src/ui/screens/internal/SignInUsernameStep.tsx +0 -145
  206. package/src/ui/screens/internal/SignUpIdentityStep.tsx +0 -112
  207. package/src/ui/screens/internal/SignUpSecurityStep.tsx +0 -132
  208. package/src/ui/screens/internal/SignUpSummaryStep.tsx +0 -66
  209. package/src/ui/screens/internal/SignUpWelcomeStep.tsx +0 -52
@@ -0,0 +1,389 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.OxyServicesUserMixin = OxyServicesUserMixin;
7
+ var _apiUtils = require("../../utils/apiUtils");
8
+ /**
9
+ * User Management Methods Mixin
10
+ */
11
+
12
+ function OxyServicesUserMixin(Base) {
13
+ return class extends Base {
14
+ constructor(...args) {
15
+ super(...args);
16
+ }
17
+ /**
18
+ * Get profile by username
19
+ */
20
+ async getProfileByUsername(username) {
21
+ try {
22
+ return await this.makeRequest('GET', `/api/profiles/username/${username}`, undefined, {
23
+ cache: true,
24
+ cacheTTL: 5 * 60 * 1000 // 5 minutes cache for profiles
25
+ });
26
+ } catch (error) {
27
+ throw this.handleError(error);
28
+ }
29
+ }
30
+
31
+ /**
32
+ * Search user profiles
33
+ */
34
+ async searchProfiles(query, pagination) {
35
+ try {
36
+ const params = {
37
+ query,
38
+ ...pagination
39
+ };
40
+ const searchParams = (0, _apiUtils.buildSearchParams)(params);
41
+ const paramsObj = {};
42
+ searchParams.forEach((value, key) => {
43
+ paramsObj[key] = value;
44
+ });
45
+ const response = await this.makeRequest('GET', '/api/profiles/search', paramsObj, {
46
+ cache: true,
47
+ cacheTTL: 2 * 60 * 1000 // 2 minutes cache
48
+ });
49
+
50
+ // New API shape: { data: User[], pagination: {...} }
51
+ if (response?.data && Array.isArray(response.data)) {
52
+ const typedResponse = response;
53
+ const paginationInfo = typedResponse.pagination ?? {
54
+ total: typedResponse.data.length,
55
+ limit: pagination?.limit ?? typedResponse.data.length,
56
+ offset: pagination?.offset ?? 0,
57
+ hasMore: false
58
+ };
59
+ return {
60
+ data: typedResponse.data,
61
+ pagination: paginationInfo
62
+ };
63
+ }
64
+
65
+ // Legacy API shape: returns raw User[]
66
+ if (Array.isArray(response)) {
67
+ const fallbackPagination = {
68
+ total: response.length,
69
+ limit: pagination?.limit ?? response.length,
70
+ offset: pagination?.offset ?? 0,
71
+ hasMore: false
72
+ };
73
+ return {
74
+ data: response,
75
+ pagination: fallbackPagination
76
+ };
77
+ }
78
+
79
+ // If response is unexpected, throw an error
80
+ throw new Error('Unexpected search response format');
81
+ } catch (error) {
82
+ throw this.handleError(error);
83
+ }
84
+ }
85
+
86
+ /**
87
+ * Get profile recommendations
88
+ */
89
+ async getProfileRecommendations() {
90
+ return this.withAuthRetry(async () => {
91
+ return await this.makeRequest('GET', '/api/profiles/recommendations', undefined, {
92
+ cache: true
93
+ });
94
+ }, 'getProfileRecommendations');
95
+ }
96
+
97
+ /**
98
+ * Get user by ID
99
+ */
100
+ async getUserById(userId) {
101
+ try {
102
+ return await this.makeRequest('GET', `/api/users/${userId}`, undefined, {
103
+ cache: true,
104
+ cacheTTL: 5 * 60 * 1000 // 5 minutes cache
105
+ });
106
+ } catch (error) {
107
+ throw this.handleError(error);
108
+ }
109
+ }
110
+
111
+ /**
112
+ * Get current user
113
+ */
114
+ async getCurrentUser() {
115
+ return this.withAuthRetry(async () => {
116
+ return await this.makeRequest('GET', '/api/users/me', undefined, {
117
+ cache: true,
118
+ cacheTTL: 1 * 60 * 1000 // 1 minute cache for current user
119
+ });
120
+ }, 'getCurrentUser');
121
+ }
122
+
123
+ /**
124
+ * Update user profile
125
+ */
126
+ async updateProfile(updates) {
127
+ try {
128
+ return await this.makeRequest('PUT', '/api/users/me', updates, {
129
+ cache: false
130
+ });
131
+ } catch (error) {
132
+ throw this.handleError(error);
133
+ }
134
+ }
135
+
136
+ /**
137
+ * Get privacy settings for a user
138
+ * @param userId - The user ID (defaults to current user)
139
+ */
140
+ async getPrivacySettings(userId) {
141
+ try {
142
+ const id = userId || (await this.getCurrentUser()).id;
143
+ return await this.makeRequest('GET', `/api/privacy/${id}/privacy`, undefined, {
144
+ cache: true,
145
+ cacheTTL: 2 * 60 * 1000 // 2 minutes cache
146
+ });
147
+ } catch (error) {
148
+ throw this.handleError(error);
149
+ }
150
+ }
151
+
152
+ /**
153
+ * Update privacy settings
154
+ * @param settings - Partial privacy settings object
155
+ * @param userId - The user ID (defaults to current user)
156
+ */
157
+ async updatePrivacySettings(settings, userId) {
158
+ try {
159
+ const id = userId || (await this.getCurrentUser()).id;
160
+ return await this.makeRequest('PATCH', `/api/privacy/${id}/privacy`, settings, {
161
+ cache: false
162
+ });
163
+ } catch (error) {
164
+ throw this.handleError(error);
165
+ }
166
+ }
167
+
168
+ /**
169
+ * Request account verification
170
+ */
171
+ async requestAccountVerification(reason, evidence) {
172
+ try {
173
+ return await this.makeRequest('POST', '/api/users/verify/request', {
174
+ reason,
175
+ evidence
176
+ }, {
177
+ cache: false
178
+ });
179
+ } catch (error) {
180
+ throw this.handleError(error);
181
+ }
182
+ }
183
+
184
+ /**
185
+ * Download account data export
186
+ */
187
+ async downloadAccountData(format = 'json') {
188
+ try {
189
+ // Use axios instance directly for blob responses since RequestManager doesn't handle blobs
190
+ const axiosInstance = this.getClient().getAxiosInstance();
191
+ const response = await axiosInstance.get(`/api/users/me/data?format=${format}`, {
192
+ responseType: 'blob'
193
+ });
194
+ return response.data;
195
+ } catch (error) {
196
+ throw this.handleError(error);
197
+ }
198
+ }
199
+
200
+ /**
201
+ * Delete account permanently
202
+ * @param password - User password for confirmation
203
+ * @param confirmText - Confirmation text (usually username)
204
+ */
205
+ async deleteAccount(password, confirmText) {
206
+ try {
207
+ return await this.makeRequest('DELETE', '/api/users/me', {
208
+ password,
209
+ confirmText
210
+ }, {
211
+ cache: false
212
+ });
213
+ } catch (error) {
214
+ throw this.handleError(error);
215
+ }
216
+ }
217
+
218
+ /**
219
+ * Update user by ID (admin function)
220
+ */
221
+ async updateUser(userId, updates) {
222
+ try {
223
+ return await this.makeRequest('PUT', `/api/users/${userId}`, updates, {
224
+ cache: false
225
+ });
226
+ } catch (error) {
227
+ throw this.handleError(error);
228
+ }
229
+ }
230
+
231
+ /**
232
+ * Follow a user
233
+ */
234
+ async followUser(userId) {
235
+ try {
236
+ return await this.makeRequest('POST', `/api/users/${userId}/follow`, undefined, {
237
+ cache: false
238
+ });
239
+ } catch (error) {
240
+ throw this.handleError(error);
241
+ }
242
+ }
243
+
244
+ /**
245
+ * Unfollow a user
246
+ */
247
+ async unfollowUser(userId) {
248
+ try {
249
+ return await this.makeRequest('DELETE', `/api/users/${userId}/follow`, undefined, {
250
+ cache: false
251
+ });
252
+ } catch (error) {
253
+ throw this.handleError(error);
254
+ }
255
+ }
256
+
257
+ /**
258
+ * Get follow status
259
+ */
260
+ async getFollowStatus(userId) {
261
+ try {
262
+ return await this.makeRequest('GET', `/api/users/${userId}/follow-status`, undefined, {
263
+ cache: true,
264
+ cacheTTL: 1 * 60 * 1000 // 1 minute cache
265
+ });
266
+ } catch (error) {
267
+ throw this.handleError(error);
268
+ }
269
+ }
270
+
271
+ /**
272
+ * Get user followers
273
+ */
274
+ async getUserFollowers(userId, pagination) {
275
+ try {
276
+ const params = (0, _apiUtils.buildPaginationParams)(pagination || {});
277
+ const response = await this.makeRequest('GET', `/api/users/${userId}/followers`, params, {
278
+ cache: true,
279
+ cacheTTL: 2 * 60 * 1000 // 2 minutes cache
280
+ });
281
+ return {
282
+ followers: response.data || [],
283
+ total: response.pagination.total,
284
+ hasMore: response.pagination.hasMore
285
+ };
286
+ } catch (error) {
287
+ throw this.handleError(error);
288
+ }
289
+ }
290
+
291
+ /**
292
+ * Get user following
293
+ */
294
+ async getUserFollowing(userId, pagination) {
295
+ try {
296
+ const params = (0, _apiUtils.buildPaginationParams)(pagination || {});
297
+ const response = await this.makeRequest('GET', `/api/users/${userId}/following`, params, {
298
+ cache: true,
299
+ cacheTTL: 2 * 60 * 1000 // 2 minutes cache
300
+ });
301
+ return {
302
+ following: response.data || [],
303
+ total: response.pagination.total,
304
+ hasMore: response.pagination.hasMore
305
+ };
306
+ } catch (error) {
307
+ throw this.handleError(error);
308
+ }
309
+ }
310
+
311
+ /**
312
+ * Get notifications
313
+ */
314
+ async getNotifications() {
315
+ return this.withAuthRetry(async () => {
316
+ return await this.makeRequest('GET', '/api/notifications', undefined, {
317
+ cache: false // Don't cache notifications - always get fresh data
318
+ });
319
+ }, 'getNotifications');
320
+ }
321
+
322
+ /**
323
+ * Get unread notification count
324
+ */
325
+ async getUnreadCount() {
326
+ try {
327
+ const res = await this.makeRequest('GET', '/api/notifications/unread-count', undefined, {
328
+ cache: false // Don't cache unread count - always get fresh data
329
+ });
330
+ return res.count;
331
+ } catch (error) {
332
+ throw this.handleError(error);
333
+ }
334
+ }
335
+
336
+ /**
337
+ * Create notification
338
+ */
339
+ async createNotification(data) {
340
+ try {
341
+ return await this.makeRequest('POST', '/api/notifications', data, {
342
+ cache: false
343
+ });
344
+ } catch (error) {
345
+ throw this.handleError(error);
346
+ }
347
+ }
348
+
349
+ /**
350
+ * Mark notification as read
351
+ */
352
+ async markNotificationAsRead(notificationId) {
353
+ try {
354
+ await this.makeRequest('PUT', `/api/notifications/${notificationId}/read`, undefined, {
355
+ cache: false
356
+ });
357
+ } catch (error) {
358
+ throw this.handleError(error);
359
+ }
360
+ }
361
+
362
+ /**
363
+ * Mark all notifications as read
364
+ */
365
+ async markAllNotificationsAsRead() {
366
+ try {
367
+ await this.makeRequest('PUT', '/api/notifications/read-all', undefined, {
368
+ cache: false
369
+ });
370
+ } catch (error) {
371
+ throw this.handleError(error);
372
+ }
373
+ }
374
+
375
+ /**
376
+ * Delete notification
377
+ */
378
+ async deleteNotification(notificationId) {
379
+ try {
380
+ await this.makeRequest('DELETE', `/api/notifications/${notificationId}`, undefined, {
381
+ cache: false
382
+ });
383
+ } catch (error) {
384
+ throw this.handleError(error);
385
+ }
386
+ }
387
+ };
388
+ }
389
+ //# sourceMappingURL=OxyServices.user.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_apiUtils","require","OxyServicesUserMixin","Base","constructor","args","getProfileByUsername","username","makeRequest","undefined","cache","cacheTTL","error","handleError","searchProfiles","query","pagination","params","searchParams","buildSearchParams","paramsObj","forEach","value","key","response","data","Array","isArray","typedResponse","paginationInfo","total","length","limit","offset","hasMore","fallbackPagination","Error","getProfileRecommendations","withAuthRetry","getUserById","userId","getCurrentUser","updateProfile","updates","getPrivacySettings","id","updatePrivacySettings","settings","requestAccountVerification","reason","evidence","downloadAccountData","format","axiosInstance","getClient","getAxiosInstance","get","responseType","deleteAccount","password","confirmText","updateUser","followUser","unfollowUser","getFollowStatus","getUserFollowers","buildPaginationParams","followers","getUserFollowing","following","getNotifications","getUnreadCount","res","count","createNotification","markNotificationAsRead","notificationId","markAllNotificationsAsRead","deleteNotification"],"sourceRoot":"../../../../src","sources":["core/mixins/OxyServices.user.ts"],"mappings":";;;;;;AAKA,IAAAA,SAAA,GAAAC,OAAA;AALA;AACA;AACA;;AAKO,SAASC,oBAAoBA,CAAmCC,IAAO,EAAE;EAC9E,OAAO,cAAcA,IAAI,CAAC;IACxBC,WAAWA,CAAC,GAAGC,IAAW,EAAE;MAC1B,KAAK,CAAC,GAAIA,IAAc,CAAC;IAC3B;IACA;AACJ;AACA;IACI,MAAMC,oBAAoBA,CAACC,QAAgB,EAAiB;MAC1D,IAAI;QACF,OAAO,MAAM,IAAI,CAACC,WAAW,CAAO,KAAK,EAAE,0BAA0BD,QAAQ,EAAE,EAAEE,SAAS,EAAE;UAC1FC,KAAK,EAAE,IAAI;UACXC,QAAQ,EAAE,CAAC,GAAG,EAAE,GAAG,IAAI,CAAE;QAC3B,CAAC,CAAC;MACJ,CAAC,CAAC,OAAOC,KAAK,EAAE;QACd,MAAM,IAAI,CAACC,WAAW,CAACD,KAAK,CAAC;MAC/B;IACF;;IAEA;AACJ;AACA;IACI,MAAME,cAAcA,CAACC,KAAa,EAAEC,UAA6B,EAAmC;MAClG,IAAI;QACF,MAAMC,MAAM,GAAG;UAAEF,KAAK;UAAE,GAAGC;QAAW,CAAC;QACvC,MAAME,YAAY,GAAG,IAAAC,2BAAiB,EAACF,MAAM,CAAC;QAC9C,MAAMG,SAAiC,GAAG,CAAC,CAAC;QAC5CF,YAAY,CAACG,OAAO,CAAC,CAACC,KAAK,EAAE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AAM,IAAI,CAACpE,WAAW,CAAC,QAAQ,EAAE,sBAAsBoE,cAAc,EAAE,EAAEnE,SAAS,EAAE;UAAEC,KAAK,EAAE;QAAM,CAAC,CAAC;MACvG,CAAC,CAAC,OAAOE,KAAK,EAAE;QACd,MAAM,IAAI,CAACC,WAAW,CAACD,KAAK,CAAC;MAC/B;IACF;EACF,CAAC;AACH","ignoreList":[]}
@@ -0,0 +1,161 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.OxyServicesUtilityMixin = OxyServicesUtilityMixin;
7
+ var _jwtDecode = require("jwt-decode");
8
+ var _mixinHelpers = require("./mixinHelpers");
9
+ /**
10
+ * Utility Methods Mixin
11
+ *
12
+ * Provides utility methods including link metadata fetching
13
+ * and Express.js authentication middleware
14
+ */
15
+
16
+ function OxyServicesUtilityMixin(Base) {
17
+ return class extends Base {
18
+ constructor(...args) {
19
+ super(...args);
20
+ }
21
+ /**
22
+ * Fetch link metadata
23
+ */
24
+ async fetchLinkMetadata(url) {
25
+ try {
26
+ return await this.makeRequest('GET', '/api/link-metadata', {
27
+ url
28
+ }, {
29
+ cache: true,
30
+ cacheTTL: _mixinHelpers.CACHE_TIMES.EXTRA_LONG
31
+ });
32
+ } catch (error) {
33
+ throw this.handleError(error);
34
+ }
35
+ }
36
+
37
+ /**
38
+ * Simple Express.js authentication middleware
39
+ *
40
+ * Built-in authentication middleware that validates JWT tokens and adds user data to requests.
41
+ *
42
+ * @example
43
+ * ```typescript
44
+ * // Basic usage - just add it to your routes
45
+ * app.use('/api/protected', oxyServices.auth());
46
+ *
47
+ * // With debug logging
48
+ * app.use('/api/protected', oxyServices.auth({ debug: true }));
49
+ *
50
+ * // With custom error handling
51
+ * app.use('/api/protected', oxyServices.auth({
52
+ * onError: (error) => console.error('Auth failed:', error)
53
+ * }));
54
+ *
55
+ * // Load full user data
56
+ * app.use('/api/protected', oxyServices.auth({ loadUser: true }));
57
+ * ```
58
+ *
59
+ * @param options Optional configuration
60
+ * @param options.debug Enable debug logging (default: false)
61
+ * @param options.onError Custom error handler
62
+ * @param options.loadUser Load full user data (default: false for performance)
63
+ * @param options.session Use session-based validation (default: false)
64
+ * @returns Express middleware function
65
+ */
66
+ auth(options = {}) {
67
+ const {
68
+ debug = false,
69
+ onError,
70
+ loadUser = false,
71
+ session = false
72
+ } = options;
73
+
74
+ // Return a synchronous middleware function
75
+ return (req, res, next) => {
76
+ try {
77
+ // Extract token from Authorization header
78
+ const authHeader = req.headers['authorization'];
79
+ const token = authHeader?.startsWith('Bearer ') ? authHeader.substring(7) : null;
80
+ if (debug) {
81
+ console.log(`🔐 Auth: Processing ${req.method} ${req.path}`);
82
+ console.log(`🔐 Auth: Token present: ${!!token}`);
83
+ }
84
+ if (!token) {
85
+ const error = {
86
+ message: 'Access token required',
87
+ code: 'MISSING_TOKEN',
88
+ status: 401
89
+ };
90
+ if (debug) console.log(`❌ Auth: Missing token`);
91
+ if (onError) return onError(error);
92
+ return res.status(401).json(error);
93
+ }
94
+
95
+ // Decode and validate token
96
+ let decoded;
97
+ try {
98
+ decoded = (0, _jwtDecode.jwtDecode)(token);
99
+ if (debug) {
100
+ console.log(`🔐 Auth: Token decoded, User ID: ${decoded.userId || decoded.id}`);
101
+ }
102
+ } catch (decodeError) {
103
+ const error = {
104
+ message: 'Invalid token format',
105
+ code: 'INVALID_TOKEN_FORMAT',
106
+ status: 403
107
+ };
108
+ if (debug) console.log(`❌ Auth: Token decode failed`);
109
+ if (onError) return onError(error);
110
+ return res.status(403).json(error);
111
+ }
112
+ const userId = decoded.userId || decoded.id;
113
+ if (!userId) {
114
+ const error = {
115
+ message: 'Token missing user ID',
116
+ code: 'INVALID_TOKEN_PAYLOAD',
117
+ status: 403
118
+ };
119
+ if (debug) console.log(`❌ Auth: Token missing user ID`);
120
+ if (onError) return onError(error);
121
+ return res.status(403).json(error);
122
+ }
123
+
124
+ // Check token expiration
125
+ if (decoded.exp && decoded.exp < Math.floor(Date.now() / 1000)) {
126
+ const error = {
127
+ message: 'Token expired',
128
+ code: 'TOKEN_EXPIRED',
129
+ status: 403
130
+ };
131
+ if (debug) console.log(`❌ Auth: Token expired`);
132
+ if (onError) return onError(error);
133
+ return res.status(403).json(error);
134
+ }
135
+
136
+ // For now, skip session validation to keep it simple
137
+ // Session validation can be added later if needed
138
+
139
+ // Set request properties immediately
140
+ req.userId = userId;
141
+ req.accessToken = token;
142
+ req.user = {
143
+ id: userId
144
+ };
145
+ if (debug) {
146
+ console.log(`✅ Auth: Authentication successful for user ${userId}`);
147
+ }
148
+ next();
149
+ } catch (error) {
150
+ const apiError = this.handleError(error);
151
+ if (debug) {
152
+ console.log(`❌ Auth: Unexpected error:`, apiError);
153
+ }
154
+ if (onError) return onError(apiError);
155
+ return res.status(apiError && apiError.status || 500).json(apiError);
156
+ }
157
+ };
158
+ }
159
+ };
160
+ }
161
+ //# sourceMappingURL=OxyServices.utility.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_jwtDecode","require","_mixinHelpers","OxyServicesUtilityMixin","Base","constructor","args","fetchLinkMetadata","url","makeRequest","cache","cacheTTL","CACHE_TIMES","EXTRA_LONG","error","handleError","auth","options","debug","onError","loadUser","session","req","res","next","authHeader","headers","token","startsWith","substring","console","log","method","path","message","code","status","json","decoded","jwtDecode","userId","id","decodeError","exp","Math","floor","Date","now","accessToken","user","apiError"],"sourceRoot":"../../../../src","sources":["core/mixins/OxyServices.utility.ts"],"mappings":";;;;;;AAMA,IAAAA,UAAA,GAAAC,OAAA;AAGA,IAAAC,aAAA,GAAAD,OAAA;AATA;AACA;AACA;AACA;AACA;AACA;;AAcO,SAASE,uBAAuBA,CAAmCC,IAAO,EAAE;EACjF,OAAO,cAAcA,IAAI,CAAC;IACxBC,WAAWA,CAAC,GAAGC,IAAW,EAAE;MAC1B,KAAK,CAAC,GAAIA,IAAc,CAAC;IAC3B;IACA;AACJ;AACA;IACI,MAAMC,iBAAiBA,CAACC,GAAW,EAKh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AACK,GAAG,GAAGC,IAAI,CAACC,KAAK,CAACC,IAAI,CAACC,GAAG,CAAC,CAAC,GAAG,IAAI,CAAC,EAAE;YAC9D,MAAMjC,KAAK,GAAG;cACZoB,OAAO,EAAE,eAAe;cACxBC,IAAI,EAAE,eAAe;cACrBC,MAAM,EAAE;YACV,CAAC;YAED,IAAIlB,KAAK,EAAEY,OAAO,CAACC,GAAG,CAAC,uBAAuB,CAAC;YAE/C,IAAIZ,OAAO,EAAE,OAAOA,OAAO,CAACL,KAAK,CAAC;YAClC,OAAOS,GAAG,CAACa,MAAM,CAAC,GAAG,CAAC,CAACC,IAAI,CAACvB,KAAK,CAAC;UACpC;;UAEA;UACA;;UAEA;UACAQ,GAAG,CAACkB,MAAM,GAAGA,MAAM;UACnBlB,GAAG,CAAC0B,WAAW,GAAGrB,KAAK;UACvBL,GAAG,CAAC2B,IAAI,GAAG;YAAER,EAAE,EAAED;UAAO,CAAS;UAEjC,IAAItB,KAAK,EAAE;YACTY,OAAO,CAACC,GAAG,CAAC,8CAA8CS,MAAM,EAAE,CAAC;UACrE;UAEAhB,IAAI,CAAC,CAAC;QACR,CAAC,CAAC,OAAOV,KAAK,EAAE;UACd,MAAMoC,QAAQ,GAAG,IAAI,CAACnC,WAAW,CAACD,KAAK,CAAQ;UAE/C,IAAII,KAAK,EAAE;YACTY,OAAO,CAACC,GAAG,CAAC,2BAA2B,EAAEmB,QAAQ,CAAC;UACpD;UAEA,IAAI/B,OAAO,EAAE,OAAOA,OAAO,CAAC+B,QAAQ,CAAC;UACrC,OAAO3B,GAAG,CAACa,MAAM,CAAEc,QAAQ,IAAIA,QAAQ,CAACd,MAAM,IAAK,GAAG,CAAC,CAACC,IAAI,CAACa,QAAQ,CAAC;QACxE;MACF,CAAC;IACH;EACF,CAAC;AACH","ignoreList":[]}
@@ -0,0 +1,39 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.composeOxyServices = composeOxyServices;
7
+ var _OxyServices = require("../OxyServices.base");
8
+ var _OxyServices2 = require("./OxyServices.auth");
9
+ var _OxyServices3 = require("./OxyServices.user");
10
+ var _OxyServices4 = require("./OxyServices.totp");
11
+ var _OxyServices5 = require("./OxyServices.privacy");
12
+ var _OxyServices6 = require("./OxyServices.language");
13
+ var _OxyServices7 = require("./OxyServices.payment");
14
+ var _OxyServices8 = require("./OxyServices.karma");
15
+ var _OxyServices9 = require("./OxyServices.assets");
16
+ var _OxyServices0 = require("./OxyServices.developer");
17
+ var _OxyServices1 = require("./OxyServices.location");
18
+ var _OxyServices10 = require("./OxyServices.analytics");
19
+ var _OxyServices11 = require("./OxyServices.devices");
20
+ var _OxyServices12 = require("./OxyServices.utility");
21
+ /**
22
+ * Centralized mixin exports and composition helper
23
+ *
24
+ * This module provides a clean way to compose all mixins
25
+ * and ensures consistent ordering for better maintainability
26
+ */
27
+
28
+ /**
29
+ * Composes all OxyServices mixins in the correct order
30
+ *
31
+ * Order matters for mixins - dependencies should be applied first.
32
+ * This function ensures consistent composition across the codebase.
33
+ *
34
+ * @returns The fully composed OxyServices class with all mixins applied
35
+ */
36
+ function composeOxyServices() {
37
+ return (0, _OxyServices12.OxyServicesUtilityMixin)((0, _OxyServices11.OxyServicesDevicesMixin)((0, _OxyServices10.OxyServicesAnalyticsMixin)((0, _OxyServices1.OxyServicesLocationMixin)((0, _OxyServices0.OxyServicesDeveloperMixin)((0, _OxyServices9.OxyServicesAssetsMixin)((0, _OxyServices8.OxyServicesKarmaMixin)((0, _OxyServices7.OxyServicesPaymentMixin)((0, _OxyServices6.OxyServicesLanguageMixin)((0, _OxyServices5.OxyServicesPrivacyMixin)((0, _OxyServices4.OxyServicesTotpMixin)((0, _OxyServices3.OxyServicesUserMixin)((0, _OxyServices2.OxyServicesAuthMixin)(_OxyServices.OxyServicesBase)))))))))))));
38
+ }
39
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_OxyServices","require","_OxyServices2","_OxyServices3","_OxyServices4","_OxyServices5","_OxyServices6","_OxyServices7","_OxyServices8","_OxyServices9","_OxyServices0","_OxyServices1","_OxyServices10","_OxyServices11","_OxyServices12","composeOxyServices","OxyServicesUtilityMixin","OxyServicesDevicesMixin","OxyServicesAnalyticsMixin","OxyServicesLocationMixin","OxyServicesDeveloperMixin","OxyServicesAssetsMixin","OxyServicesKarmaMixin","OxyServicesPaymentMixin","OxyServicesLanguageMixin","OxyServicesPrivacyMixin","OxyServicesTotpMixin","OxyServicesUserMixin","OxyServicesAuthMixin","OxyServicesBase"],"sourceRoot":"../../../../src","sources":["core/mixins/index.ts"],"mappings":";;;;;;AAOA,IAAAA,YAAA,GAAAC,OAAA;AACA,IAAAC,aAAA,GAAAD,OAAA;AACA,IAAAE,aAAA,GAAAF,OAAA;AACA,IAAAG,aAAA,GAAAH,OAAA;AACA,IAAAI,aAAA,GAAAJ,OAAA;AACA,IAAAK,aAAA,GAAAL,OAAA;AACA,IAAAM,aAAA,GAAAN,OAAA;AACA,IAAAO,aAAA,GAAAP,OAAA;AACA,IAAAQ,aAAA,GAAAR,OAAA;AACA,IAAAS,aAAA,GAAAT,OAAA;AACA,IAAAU,aAAA,GAAAV,OAAA;AACA,IAAAW,cAAA,GAAAX,OAAA;AACA,IAAAY,cAAA,GAAAZ,OAAA;AACA,IAAAa,cAAA,GAAAb,OAAA;AApBA;AACA;AACA;AACA;AACA;AACA;;AAiBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASc,kBAAkBA,CAAA,EAAG;EACnC,OAAO,IAAAC,sCAAuB,EAC5B,IAAAC,sCAAuB,EACrB,IAAAC,wCAAyB,EACvB,IAAAC,sCAAwB,EACtB,IAAAC,uCAAyB,EACvB,IAAAC,oCAAsB,EACpB,IAAAC,mCAAqB,EACnB,IAAAC,qCAAuB,EACrB,IAAAC,sCAAwB,EACtB,IAAAC,qCAAuB,EACrB,IAAAC,kCAAoB,EAClB,IAAAC,kCAAoB,EAClB,IAAAC,kCAAoB,EAACC,4BAAe,CACtC,CACF,CACF,CACF,CACF,CACF,CACF,CACF,CACF,CACF,CACF,CACF,CAAC;AACH","ignoreList":[]}
@@ -0,0 +1,62 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.CACHE_TIMES = void 0;
7
+ exports.createApiMethod = createApiMethod;
8
+ exports.withErrorHandling = withErrorHandling;
9
+ /**
10
+ * Helper utilities for mixin classes
11
+ * Provides common patterns to reduce code duplication
12
+ */
13
+
14
+ /**
15
+ * Wraps an async method with standard error handling
16
+ * Reduces boilerplate in mixin methods
17
+ */
18
+ async function withErrorHandling(operation, handleError) {
19
+ try {
20
+ return await operation();
21
+ } catch (error) {
22
+ throw handleError(error);
23
+ }
24
+ }
25
+
26
+ /**
27
+ * Creates a standard API request method with error handling
28
+ * Reduces duplication across mixin methods
29
+ */
30
+ function createApiMethod(makeRequest, handleError, method, url, options = {}) {
31
+ return async (...args) => {
32
+ const urlString = typeof url === 'function' ? url(...args) : url;
33
+ const requestData = options.transformData ? options.transformData(args) : args[0];
34
+ const requestOptions = {
35
+ cache: options.cache ?? true,
36
+ cacheTTL: options.cacheTTL,
37
+ retry: options.retry ?? true
38
+ };
39
+ try {
40
+ const response = await makeRequest(method, urlString, requestData, requestOptions);
41
+ return options.transformResponse ? options.transformResponse(response) : response;
42
+ } catch (error) {
43
+ throw handleError(error);
44
+ }
45
+ };
46
+ }
47
+
48
+ /**
49
+ * Cache time constants (in milliseconds)
50
+ */
51
+ const CACHE_TIMES = exports.CACHE_TIMES = {
52
+ SHORT: 1 * 60 * 1000,
53
+ // 1 minute
54
+ MEDIUM: 2 * 60 * 1000,
55
+ // 2 minutes
56
+ LONG: 5 * 60 * 1000,
57
+ // 5 minutes
58
+ VERY_LONG: 10 * 60 * 1000,
59
+ // 10 minutes
60
+ EXTRA_LONG: 30 * 60 * 1000 // 30 minutes
61
+ };
62
+ //# sourceMappingURL=mixinHelpers.js.map