@onairos/react-native 3.7.1 → 3.7.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.
- package/lib/commonjs/api/index.js +219 -9
- package/lib/commonjs/assets/icons/spotify.png +0 -0
- package/lib/commonjs/assets/images/spotify.png +0 -0
- package/lib/commonjs/components/BodyText.js +27 -9
- package/lib/commonjs/components/BrandMark.js +111 -10
- package/lib/commonjs/components/CodeInput.js +116 -9
- package/lib/commonjs/components/EmailInput.js +30 -8
- package/lib/commonjs/components/GoogleButton.js +56 -9
- package/lib/commonjs/components/HeadingGroup.js +43 -9
- package/lib/commonjs/components/LLMDataInputModal.js +664 -14
- package/lib/commonjs/components/ModalHeader.js +99 -9
- package/lib/commonjs/components/ModalSheet.js +47 -9
- package/lib/commonjs/components/Onairos.js +380 -14
- package/lib/commonjs/components/OnairosButton.js +313 -13
- package/lib/commonjs/components/OnairosSignInButton.js +130 -12
- package/lib/commonjs/components/Overlay.js +465 -13
- package/lib/commonjs/components/PersonaImage.js +137 -10
- package/lib/commonjs/components/PersonaLoadingScreen.js +318 -12
- package/lib/commonjs/components/PersonalizationConsentScreen.js +467 -13
- package/lib/commonjs/components/PinCreationScreen.js +403 -12
- package/lib/commonjs/components/PinInput.js +464 -9
- package/lib/commonjs/components/PlatformConnectorsStep.js +1311 -23
- package/lib/commonjs/components/PlatformList.js +137 -10
- package/lib/commonjs/components/PlatformToggle.js +180 -9
- package/lib/commonjs/components/PrimaryButton.js +180 -10
- package/lib/commonjs/components/SignInMatchAnimation.js +197 -9
- package/lib/commonjs/components/SignInStep.js +345 -12
- package/lib/commonjs/components/UniversalOnboarding.js +2780 -30
- package/lib/commonjs/components/VerificationStep.js +176 -11
- package/lib/commonjs/components/WelcomeScreen.js +461 -22
- package/lib/commonjs/components/icons/Basicproficon.js +37 -8
- package/lib/commonjs/components/icons/Basicprofile.js +21 -8
- package/lib/commonjs/components/icons/Checkbox.js +21 -8
- package/lib/commonjs/components/icons/Checkmark.js +27 -8
- package/lib/commonjs/components/icons/Contentanalysis.js +21 -8
- package/lib/commonjs/components/icons/Contenticon.js +39 -8
- package/lib/commonjs/components/icons/EnochE.js +41 -8
- package/lib/commonjs/components/icons/Personalityicon.js +30 -8
- package/lib/commonjs/components/icons/Personalityprofile.js +21 -8
- package/lib/commonjs/components/icons/Personalitytraits.js +21 -8
- package/lib/commonjs/components/icons/Userpreferences.js +21 -8
- package/lib/commonjs/components/icons/index.js +84 -17
- package/lib/commonjs/components/onboarding/OAuthWebView.js +1754 -18
- package/lib/commonjs/components/onboarding/OnboardingHeader.js +74 -10
- package/lib/commonjs/components/onboarding/PinInput.js +283 -10
- package/lib/commonjs/components/onboarding/PlatformConnector.js +249 -11
- package/lib/commonjs/config/PLATFORM_APIS.md +849 -0
- package/lib/commonjs/config/api.js +56 -7
- package/lib/commonjs/constants/index.js +120 -7
- package/lib/commonjs/context/AuthContext.js +345 -10
- package/lib/commonjs/hooks/useConnectedAccounts.js +111 -9
- package/lib/commonjs/hooks/useConnections.js +102 -8
- package/lib/commonjs/hooks/useCredentials.js +178 -10
- package/lib/commonjs/hooks/useUserConnections.js +148 -10
- package/lib/commonjs/index.js +439 -34
- package/lib/commonjs/services/apiClient.js +298 -8
- package/lib/commonjs/services/biometricPinService.js +180 -8
- package/lib/commonjs/services/chatGPTConversationExtractor.js +155 -8
- package/lib/commonjs/services/chatGPTConversationService.js +275 -9
- package/lib/commonjs/services/claudeConversationExtractor.js +103 -8
- package/lib/commonjs/services/claudeConversationService.js +158 -9
- package/lib/commonjs/services/connectedAccountsService.js +310 -10
- package/lib/commonjs/services/googleAuthService.js +252 -11
- package/lib/commonjs/services/hingeDataExtractor.js +105 -8
- package/lib/commonjs/services/hingeDataService.js +150 -9
- package/lib/commonjs/services/imageCompressionService.js +260 -7
- package/lib/commonjs/services/instagramDataExtractor.js +126 -8
- package/lib/commonjs/services/instagramDataService.js +163 -9
- package/lib/commonjs/services/jwtStorageService.js +276 -7
- package/lib/commonjs/services/linkedinDOMExtractor.js +245 -7
- package/lib/commonjs/services/linkedinProfileService.js +222 -9
- package/lib/commonjs/services/linkedinScrapingService.js +230 -8
- package/lib/commonjs/services/llmDataStorage.js +294 -8
- package/lib/commonjs/services/mobileTrainingService.js +186 -8
- package/lib/commonjs/services/netflixDataExtractor.js +120 -8
- package/lib/commonjs/services/netflixDataService.js +198 -9
- package/lib/commonjs/services/pinEncryptionService.js +84 -8
- package/lib/commonjs/services/pinStorageUtils.js +105 -7
- package/lib/commonjs/services/platformAuthService.js +1484 -12
- package/lib/commonjs/services/sephoraDataExtractor.js +140 -8
- package/lib/commonjs/services/sephoraDataService.js +200 -9
- package/lib/commonjs/services/spotifyDataExtractor.js +148 -8
- package/lib/commonjs/services/spotifyDataService.js +241 -9
- package/lib/commonjs/services/storageService.js +404 -8
- package/lib/commonjs/services/telegramDataExtractor.js +115 -8
- package/lib/commonjs/services/telegramDataService.js +499 -9
- package/lib/commonjs/services/trainingApiHelpers.js +73 -7
- package/lib/commonjs/services/userConnectionsService.js +340 -10
- package/lib/commonjs/services/youtubeMigrationService.js +416 -10
- package/lib/commonjs/theme/index.js +250 -7
- package/lib/commonjs/types/ambient.d.js +2 -1
- package/lib/commonjs/types/declarations.d.js +2 -1
- package/lib/commonjs/types/index.js +6 -1
- package/lib/commonjs/types/node-fix.d.js +2 -1
- package/lib/commonjs/types/node-override.d.js +2 -1
- package/lib/commonjs/types/opacity.d.js +2 -1
- package/lib/commonjs/types.js +14 -1
- package/lib/commonjs/utils/Portal.js +98 -8
- package/lib/commonjs/utils/api.js +130 -9
- package/lib/commonjs/utils/assetRegistry.js +210 -35
- package/lib/commonjs/utils/auth.js +112 -9
- package/lib/commonjs/utils/connectorTests.js +613 -29
- package/lib/commonjs/utils/crypto.js +62 -8
- package/lib/commonjs/utils/debugHelper.js +64 -1
- package/lib/commonjs/utils/encryption.js +76 -7
- package/lib/commonjs/utils/eventUtils.js +288 -1
- package/lib/commonjs/utils/haptics.js +66 -9
- package/lib/commonjs/utils/imagePreloader.js +6 -1
- package/lib/commonjs/utils/networkDiagnostics.js +226 -8
- package/lib/commonjs/utils/onairosApi.js +350 -9
- package/lib/commonjs/utils/programmaticFlow.js +117 -9
- package/lib/commonjs/utils/retryHelper.js +220 -1
- package/lib/commonjs/utils/secureStorage.js +349 -10
- package/lib/commonjs/utils/webviewScripts/chatgpt.js +551 -1
- package/lib/commonjs/utils/webviewScripts/claude.js +376 -1
- package/lib/commonjs/utils/webviewScripts/hinge.js +411 -1
- package/lib/commonjs/utils/webviewScripts/index.js +698 -15
- package/lib/commonjs/utils/webviewScripts/instagram.js +454 -1
- package/lib/commonjs/utils/webviewScripts/linkedin.js +880 -1
- package/lib/commonjs/utils/webviewScripts/netflix.js +382 -1
- package/lib/commonjs/utils/webviewScripts/sephora.js +516 -1
- package/lib/commonjs/utils/webviewScripts/spotify.js +419 -1
- package/lib/commonjs/utils/webviewScripts/telegram.js +678 -1
- package/lib/module/api/index.js +211 -1
- package/lib/module/assets/icons/spotify.png +0 -0
- package/lib/module/assets/images/spotify.png +0 -0
- package/lib/module/components/BodyText.js +20 -1
- package/lib/module/components/BrandMark.js +104 -1
- package/lib/module/components/CodeInput.js +109 -1
- package/lib/module/components/EmailInput.js +23 -1
- package/lib/module/components/GoogleButton.js +49 -1
- package/lib/module/components/HeadingGroup.js +36 -1
- package/lib/module/components/LLMDataInputModal.js +656 -7
- package/lib/module/components/ModalHeader.js +92 -1
- package/lib/module/components/ModalSheet.js +39 -1
- package/lib/module/components/Onairos.js +373 -1
- package/lib/module/components/OnairosButton.js +305 -1
- package/lib/module/components/OnairosSignInButton.js +121 -1
- package/lib/module/components/Overlay.js +456 -1
- package/lib/module/components/PersonaImage.js +129 -1
- package/lib/module/components/PersonaLoadingScreen.js +310 -1
- package/lib/module/components/PersonalizationConsentScreen.js +460 -1
- package/lib/module/components/PinCreationScreen.js +396 -1
- package/lib/module/components/PinInput.js +456 -1
- package/lib/module/components/PlatformConnectorsStep.js +1302 -6
- package/lib/module/components/PlatformList.js +129 -1
- package/lib/module/components/PlatformToggle.js +173 -1
- package/lib/module/components/PrimaryButton.js +172 -1
- package/lib/module/components/SignInMatchAnimation.js +189 -1
- package/lib/module/components/SignInStep.js +338 -1
- package/lib/module/components/UniversalOnboarding.js +2770 -1
- package/lib/module/components/VerificationStep.js +168 -1
- package/lib/module/components/WelcomeScreen.js +453 -1
- package/lib/module/components/icons/Basicproficon.js +30 -1
- package/lib/module/components/icons/Basicprofile.js +14 -1
- package/lib/module/components/icons/Checkbox.js +14 -1
- package/lib/module/components/icons/Checkmark.js +20 -1
- package/lib/module/components/icons/Contentanalysis.js +14 -1
- package/lib/module/components/icons/Contenticon.js +32 -1
- package/lib/module/components/icons/EnochE.js +34 -1
- package/lib/module/components/icons/Personalityicon.js +23 -1
- package/lib/module/components/icons/Personalityprofile.js +14 -1
- package/lib/module/components/icons/Personalitytraits.js +14 -1
- package/lib/module/components/icons/Userpreferences.js +14 -1
- package/lib/module/components/icons/index.js +13 -1
- package/lib/module/components/onboarding/OAuthWebView.js +1746 -1
- package/lib/module/components/onboarding/OnboardingHeader.js +66 -1
- package/lib/module/components/onboarding/PinInput.js +274 -1
- package/lib/module/components/onboarding/PlatformConnector.js +240 -1
- package/lib/module/config/PLATFORM_APIS.md +849 -0
- package/lib/module/config/api.js +47 -1
- package/lib/module/constants/index.js +114 -1
- package/lib/module/context/AuthContext.js +335 -1
- package/lib/module/hooks/useConnectedAccounts.js +106 -1
- package/lib/module/hooks/useConnections.js +95 -1
- package/lib/module/hooks/useCredentials.js +171 -6
- package/lib/module/hooks/useUserConnections.js +140 -1
- package/lib/module/index.js +172 -1
- package/lib/module/services/apiClient.js +295 -1
- package/lib/module/services/biometricPinService.js +169 -1
- package/lib/module/services/chatGPTConversationExtractor.js +149 -1
- package/lib/module/services/chatGPTConversationService.js +268 -1
- package/lib/module/services/claudeConversationExtractor.js +97 -1
- package/lib/module/services/claudeConversationService.js +151 -1
- package/lib/module/services/connectedAccountsService.js +293 -1
- package/lib/module/services/googleAuthService.js +241 -1
- package/lib/module/services/hingeDataExtractor.js +99 -1
- package/lib/module/services/hingeDataService.js +143 -1
- package/lib/module/services/imageCompressionService.js +250 -1
- package/lib/module/services/instagramDataExtractor.js +120 -1
- package/lib/module/services/instagramDataService.js +156 -1
- package/lib/module/services/jwtStorageService.js +257 -1
- package/lib/module/services/linkedinDOMExtractor.js +234 -1
- package/lib/module/services/linkedinProfileService.js +210 -1
- package/lib/module/services/linkedinScrapingService.js +219 -1
- package/lib/module/services/llmDataStorage.js +277 -1
- package/lib/module/services/mobileTrainingService.js +173 -1
- package/lib/module/services/netflixDataExtractor.js +114 -1
- package/lib/module/services/netflixDataService.js +191 -1
- package/lib/module/services/pinEncryptionService.js +74 -6
- package/lib/module/services/pinStorageUtils.js +93 -1
- package/lib/module/services/platformAuthService.js +1461 -1
- package/lib/module/services/sephoraDataExtractor.js +134 -1
- package/lib/module/services/sephoraDataService.js +193 -1
- package/lib/module/services/spotifyDataExtractor.js +142 -1
- package/lib/module/services/spotifyDataService.js +234 -1
- package/lib/module/services/storageService.js +383 -1
- package/lib/module/services/telegramDataExtractor.js +109 -1
- package/lib/module/services/telegramDataService.js +493 -1
- package/lib/module/services/trainingApiHelpers.js +67 -1
- package/lib/module/services/userConnectionsService.js +329 -1
- package/lib/module/services/youtubeMigrationService.js +405 -1
- package/lib/module/theme/index.js +245 -1
- package/lib/module/types.js +10 -1
- package/lib/module/utils/Portal.js +90 -1
- package/lib/module/utils/api.js +118 -1
- package/lib/module/utils/assetRegistry.js +200 -34
- package/lib/module/utils/auth.js +100 -1
- package/lib/module/utils/connectorTests.js +600 -27
- package/lib/module/utils/crypto.js +54 -1
- package/lib/module/utils/debugHelper.js +54 -1
- package/lib/module/utils/encryption.js +67 -1
- package/lib/module/utils/eventUtils.js +270 -1
- package/lib/module/utils/haptics.js +59 -8
- package/lib/module/utils/imagePreloader.js +3 -1
- package/lib/module/utils/networkDiagnostics.js +217 -1
- package/lib/module/utils/onairosApi.js +333 -1
- package/lib/module/utils/programmaticFlow.js +111 -1
- package/lib/module/utils/retryHelper.js +211 -1
- package/lib/module/utils/secureStorage.js +330 -6
- package/lib/module/utils/webviewScripts/chatgpt.js +545 -1
- package/lib/module/utils/webviewScripts/claude.js +370 -1
- package/lib/module/utils/webviewScripts/hinge.js +405 -1
- package/lib/module/utils/webviewScripts/index.js +434 -1
- package/lib/module/utils/webviewScripts/instagram.js +448 -1
- package/lib/module/utils/webviewScripts/linkedin.js +874 -1
- package/lib/module/utils/webviewScripts/netflix.js +376 -1
- package/lib/module/utils/webviewScripts/sephora.js +510 -1
- package/lib/module/utils/webviewScripts/spotify.js +413 -1
- package/lib/module/utils/webviewScripts/telegram.js +672 -1
- package/package.json +2 -2
|
@@ -1 +1,54 @@
|
|
|
1
|
-
|
|
1
|
+
import { RSA } from 'react-native-rsa-native';
|
|
2
|
+
import { sha256 as cryptoSha256 } from 'react-native-crypto-js';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Encrypt data using RSA
|
|
6
|
+
* @param {string} publicKey - The RSA public key
|
|
7
|
+
* @param {string} data - The data to encrypt
|
|
8
|
+
* @returns {Promise<string>} - The encrypted data
|
|
9
|
+
*/
|
|
10
|
+
export const rsaEncrypt = async (publicKey, data) => {
|
|
11
|
+
try {
|
|
12
|
+
// Clean the public key format
|
|
13
|
+
const cleanedKey = publicKey.replace(/\\n/g, '').replace(/^\s+|\s+$/g, '').replace('-----BEGIN PUBLIC KEY-----', '').replace('-----END PUBLIC KEY-----', '').trim();
|
|
14
|
+
|
|
15
|
+
// Format the key properly for the library
|
|
16
|
+
const formattedKey = `-----BEGIN PUBLIC KEY-----\n${cleanedKey}\n-----END PUBLIC KEY-----`;
|
|
17
|
+
|
|
18
|
+
// Encrypt the data
|
|
19
|
+
const encrypted = await RSA.encrypt(data, formattedKey);
|
|
20
|
+
return encrypted;
|
|
21
|
+
} catch (error) {
|
|
22
|
+
console.error('RSA encryption failed:', error);
|
|
23
|
+
throw error;
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Hash data using SHA-256
|
|
29
|
+
* @param {string} data - The data to hash
|
|
30
|
+
* @returns {string} - The hashed data
|
|
31
|
+
*/
|
|
32
|
+
export const sha256 = data => {
|
|
33
|
+
return cryptoSha256(data).toString();
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Convert a base64 string to a buffer
|
|
38
|
+
* @param {string} base64String - The base64 string to convert
|
|
39
|
+
* @returns {ArrayBuffer} - The converted buffer
|
|
40
|
+
*/
|
|
41
|
+
export const base64ToBuffer = base64String => {
|
|
42
|
+
try {
|
|
43
|
+
const binaryString = Buffer.from(base64String, 'base64').toString('binary');
|
|
44
|
+
const bytes = new Uint8Array(binaryString.length);
|
|
45
|
+
for (let i = 0; i < binaryString.length; i++) {
|
|
46
|
+
bytes[i] = binaryString.charCodeAt(i);
|
|
47
|
+
}
|
|
48
|
+
return bytes.buffer;
|
|
49
|
+
} catch (error) {
|
|
50
|
+
console.error('Error converting base64 to buffer:', error);
|
|
51
|
+
throw error;
|
|
52
|
+
}
|
|
53
|
+
};
|
|
54
|
+
//# sourceMappingURL=crypto.js.map
|
|
@@ -1 +1,54 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Debug utility functions for Onairos React Native SDK
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
// Determine if we're in dev mode
|
|
6
|
+
const __DEV__ = process.env.NODE_ENV !== 'production';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Log debug message to console when in development mode
|
|
10
|
+
* @param label Label for the debug message
|
|
11
|
+
* @param data Data to log
|
|
12
|
+
*/
|
|
13
|
+
export const logDebug = (label, data) => {
|
|
14
|
+
if (__DEV__) {
|
|
15
|
+
console.log(`[Onairos Debug] ${label}:`, data || '');
|
|
16
|
+
}
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Log error message to console
|
|
21
|
+
* @param label Label for the error message
|
|
22
|
+
* @param error Error object or message
|
|
23
|
+
*/
|
|
24
|
+
export const logError = (label, error) => {
|
|
25
|
+
if (__DEV__) {
|
|
26
|
+
console.error(`[Onairos Error] ${label}:`, error);
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Check if debug mode is enabled
|
|
32
|
+
* @param debug Debug flag passed to component
|
|
33
|
+
* @returns Whether debug mode is enabled
|
|
34
|
+
*/
|
|
35
|
+
export const isDebugMode = debug => {
|
|
36
|
+
return debug === true || __DEV__;
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Format and log API request details
|
|
41
|
+
* @param method HTTP method
|
|
42
|
+
* @param url API URL
|
|
43
|
+
* @param data Request data
|
|
44
|
+
*/
|
|
45
|
+
export const logApiRequest = (method, url, data) => {
|
|
46
|
+
if (__DEV__) {
|
|
47
|
+
logDebug('API Request', {
|
|
48
|
+
method,
|
|
49
|
+
url,
|
|
50
|
+
data: data || {}
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
};
|
|
54
|
+
//# sourceMappingURL=debugHelper.js.map
|
|
@@ -1 +1,67 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { onairosApi } from '../api';
|
|
2
|
+
/**
|
|
3
|
+
* Encrypt a model key using RSA with a public key
|
|
4
|
+
* @param publicKey The public key to encrypt with
|
|
5
|
+
* @param modelKey The model key to encrypt
|
|
6
|
+
* @returns The encrypted model key
|
|
7
|
+
*/
|
|
8
|
+
export const encryptModelKey = (publicKey, modelKey) => {
|
|
9
|
+
try {
|
|
10
|
+
console.log('Encrypting model key');
|
|
11
|
+
if (!publicKey || !modelKey) {
|
|
12
|
+
throw new Error('Public key or model key is missing');
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
// In a production environment, this would use RSA encryption
|
|
16
|
+
// For now, we'll use a mock implementation
|
|
17
|
+
// return RSA.encrypt(modelKey, publicKey);
|
|
18
|
+
|
|
19
|
+
// Return a fake encrypted value
|
|
20
|
+
return `encrypted_${modelKey}_${Date.now()}`;
|
|
21
|
+
} catch (error) {
|
|
22
|
+
console.error('Error encrypting model key:', error);
|
|
23
|
+
throw error;
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Get the server's public key
|
|
29
|
+
* @returns The server's public key
|
|
30
|
+
*/
|
|
31
|
+
export const getServerPublicKey = async () => {
|
|
32
|
+
try {
|
|
33
|
+
var _response$data, _response$data2;
|
|
34
|
+
// Use the API without generics to prevent TypeScript errors
|
|
35
|
+
const response = await onairosApi.get('public/getPublicKey');
|
|
36
|
+
|
|
37
|
+
// Check for the public key in the response data
|
|
38
|
+
if (response !== null && response !== void 0 && (_response$data = response.data) !== null && _response$data !== void 0 && (_response$data = _response$data.data) !== null && _response$data !== void 0 && _response$data.publicKey) {
|
|
39
|
+
return response.data.data.publicKey;
|
|
40
|
+
} else if (response !== null && response !== void 0 && (_response$data2 = response.data) !== null && _response$data2 !== void 0 && _response$data2.publicKey) {
|
|
41
|
+
return response.data.publicKey;
|
|
42
|
+
} else {
|
|
43
|
+
throw new Error('No public key found in response');
|
|
44
|
+
}
|
|
45
|
+
} catch (error) {
|
|
46
|
+
console.error('Error getting server public key:', error);
|
|
47
|
+
// For testing, return a mock public key
|
|
48
|
+
return 'mock_public_key_for_testing';
|
|
49
|
+
}
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* Hash a string using SHA-256
|
|
54
|
+
* @param input The string to hash
|
|
55
|
+
* @returns The hashed string
|
|
56
|
+
*/
|
|
57
|
+
export const hashString = async input => {
|
|
58
|
+
try {
|
|
59
|
+
// In a production environment, this would use a proper hashing function
|
|
60
|
+
// For now, we'll return a mock hash
|
|
61
|
+
return `hash_${input.replace(/\s+/g, '_')}_${Date.now()}`;
|
|
62
|
+
} catch (error) {
|
|
63
|
+
console.error('Error hashing string:', error);
|
|
64
|
+
return `fallback_hash_${Date.now()}`;
|
|
65
|
+
}
|
|
66
|
+
};
|
|
67
|
+
//# sourceMappingURL=encryption.js.map
|
|
@@ -1 +1,270 @@
|
|
|
1
|
-
export const generateEventCode=(_0x56ca63=0x6)=>{const _0x26285d={'kHpoe':function(_0x334e62,_0x31b065){return _0x334e62<_0x31b065;},'gpvIM':function(_0x30e9e3,_0x46a6bf){return _0x30e9e3!==_0x46a6bf;},'LWLXV':'VbfeC','bMPha':function(_0x24857a,_0x27d476){return _0x24857a*_0x27d476;}},_0x90ce13=_0x398e(0x0);let _0x238c79='';for(let _0xa2074e=0x0;_0x26285d['kHpoe'](_0xa2074e,_0x56ca63);_0xa2074e++){_0x26285d['gpvIM'](_0x26285d[_0x398e(0x1)],_0x26285d[_0x398e(0x1)])?_0x3c392e=_0x2cbddc[_0x398e(0x2)](0x0,0x8):_0x238c79+=_0x90ce13[_0x398e(0x3)](Math['floor'](_0x26285d[_0x398e(0x4)](Math[_0x398e(0x5)](),_0x90ce13[_0x398e(0x6)])));}return _0x238c79;};export const generateSmartEventCode=_0x797357=>{const _0x19c24f={'JCqZP':function(_0x2367c3,_0x262ddd){return _0x2367c3<_0x262ddd;},'bqEpl':_0x398e(0x7),'eujCN':function(_0x4908b9,_0x4cb179){return _0x4908b9-_0x4cb179;},'DCHYj':function(_0x1be5bb,_0x356565){return _0x1be5bb/_0x356565;},'Zsrzq':function(_0x1ce94c,_0x5f2113){return _0x1ce94c*_0x5f2113;},'yzlAt':function(_0x34308f,_0x21aeca){return _0x34308f===_0x21aeca;},'vdUYz':_0x398e(0x8),'xnaEb':function(_0x34950a){return _0x34950a();},'GTfMD':'ZXRGh','tUVmZ':_0x398e(0x9),'gmrJy':function(_0x5bd097,_0x25b07e){return _0x5bd097===_0x25b07e;},'yddkO':_0x398e(0xa),'dvTSF':_0x398e(0xb),'bwYey':_0x398e(0xc),'rbdWE':function(_0xc17c8,_0x1f9ca9){return _0xc17c8(_0x1f9ca9);},'dNeVj':function(_0x579bb9,_0x468ca0){return _0x579bb9-_0x468ca0;},'dJlGL':function(_0xd9c578,_0x3891f7){return _0xd9c578>_0x3891f7;},'ZHHzO':'gPdjz'};if(!_0x797357[_0x398e(0xd)]())return generateEventCode();const _0x3fb9d8=_0x797357[_0x398e(0xd)]()['toUpperCase']()[_0x398e(0xe)](/[^A-Z0-9\s]/g,'')[_0x398e(0xf)](/\s+/)[_0x398e(0x10)](_0x29742c=>_0x29742c[_0x398e(0x6)]>0x0);if(_0x3fb9d8[_0x398e(0x6)]===0x0)return _0x19c24f[_0x398e(0x11)](_0x19c24f[_0x398e(0x12)],_0x398e(0x13))?0x0:_0x19c24f[_0x398e(0x14)](generateEventCode);let _0x2db2f5='';if(_0x3fb9d8[_0x398e(0x6)]>=0x2){if(_0x19c24f[_0x398e(0x15)]===_0x19c24f['tUVmZ'])try{const _0x103a12=new _0x21ea63(),_0x71e7ce=new _0x157ecb(_0x52ace6);return _0x103a12['setHours'](0x0,0x0,0x0,0x0),_0x71e7ce[_0x398e(0x16)](0x0,0x0,0x0,0x0),_0x19c24f[_0x398e(0x17)](_0x71e7ce,_0x103a12);}catch(_0x56a456){return![];}else{const _0x3d610c=_0x3fb9d8[_0x398e(0x18)](0x0,0x3);_0x2db2f5=_0x3d610c[_0x398e(0x19)](_0x428a2f=>_0x428a2f[_0x398e(0x2)](0x0,0x2))[_0x398e(0x1a)]('');}}else{if(_0x19c24f[_0x398e(0x1b)](_0x19c24f[_0x398e(0x1c)],_0x19c24f[_0x398e(0x1d)]))return _0x19c24f['bqEpl'];else _0x2db2f5=_0x3fb9d8[0x0][_0x398e(0x2)](0x0,0x4);}const _0x2dcdfe=new Date()[_0x398e(0x1e)]()[_0x398e(0x1f)]()[_0x398e(0x18)](-0x2);_0x2db2f5+=_0x2dcdfe;if(_0x2db2f5[_0x398e(0x6)]<0x4){if(_0x19c24f[_0x398e(0x1b)](_0x398e(0x20),_0x19c24f[_0x398e(0x21)]))try{const _0x56cb79=new _0x3f7731(),_0x4b4df2=new _0x2f031e(_0x155b23);_0x56cb79['setHours'](0x0,0x0,0x0,0x0),_0x4b4df2[_0x398e(0x16)](0x0,0x0,0x0,0x0);const _0x4a524b=_0x19c24f[_0x398e(0x22)](_0x4b4df2[_0x398e(0x23)](),_0x56cb79[_0x398e(0x23)]()),_0x54aaea=_0x293ebd[_0x398e(0x24)](_0x19c24f[_0x398e(0x25)](_0x4a524b,_0x19c24f['Zsrzq'](_0x19c24f[_0x398e(0x26)](0x3e8,0x3c)*0x3c,0x18)));return _0x54aaea;}catch(_0x21c09a){return 0x0;}else _0x2db2f5+=_0x19c24f['rbdWE'](generateEventCode,_0x19c24f['dNeVj'](0x4,_0x2db2f5[_0x398e(0x6)]));}else{if(_0x19c24f[_0x398e(0x27)](_0x2db2f5[_0x398e(0x6)],0x8)){if(_0x19c24f['ZHHzO']!==_0x19c24f[_0x398e(0x28)])return _0x311b2a;else _0x2db2f5=_0x2db2f5['substring'](0x0,0x8);}}return _0x2db2f5;};export const validateEventCode=_0x466890=>{const _0x4b7391={'OMNwG':_0x398e(0x29),'tDweb':_0x398e(0x2a),'eZqdU':'long','Nvtyy':_0x398e(0x2b),'ROZpm':_0x398e(0x2c),'AyYac':function(_0x346630,_0x25c439){return _0x346630!==_0x25c439;},'hGUjQ':'yplju','tNlBl':function(_0x1ebc74,_0x25c496){return _0x1ebc74>_0x25c496;},'RQZIf':function(_0x5122a0,_0xa0e1ac){return _0x5122a0!==_0xa0e1ac;},'GcWOV':_0x398e(0x2d),'wGbXY':'oNvNB','hmWep':function(_0x4cc7b4,_0x36ed27){return _0x4cc7b4!==_0x36ed27;},'LkSlh':_0x398e(0x2e),'Rmick':_0x398e(0x2f)};if(!_0x466890||!_0x466890['trim']())return{'isValid':![],'error':_0x4b7391['ROZpm']};const _0x5aca5c=_0x466890[_0x398e(0xd)]()['toUpperCase']();if(_0x5aca5c[_0x398e(0x6)]<0x3){if(_0x4b7391[_0x398e(0x30)](_0x398e(0x31),_0x4b7391['hGUjQ']))return{'isValid':![],'error':_0x4b7391[_0x398e(0x32)]};else _0x2a6494=_0x348aca[0x0][_0x398e(0x2)](0x0,0x4);}if(_0x4b7391[_0x398e(0x33)](_0x5aca5c[_0x398e(0x6)],0xa))return _0x4b7391[_0x398e(0x34)](_0x4b7391[_0x398e(0x35)],_0x4b7391[_0x398e(0x36)])?{'isValid':![],'error':_0x398e(0x37)}:{'isValid':![],'error':_0x4b7391[_0x398e(0x32)]};if(!/^[A-Z0-9]+$/[_0x398e(0x38)](_0x5aca5c)){if(_0x4b7391[_0x398e(0x39)](_0x4b7391[_0x398e(0x3a)],_0x4b7391[_0x398e(0x3a)])){const _0x38004f=new _0x1d13b8(_0x37fb21);return _0x38004f[_0x398e(0x3b)](_0x4b7391[_0x398e(0x3c)],{'weekday':_0x4b7391[_0x398e(0x3d)],'year':_0x4b7391[_0x398e(0x3e)],'month':_0x4b7391['eZqdU'],'day':_0x4b7391[_0x398e(0x3e)]});}else return{'isValid':![],'error':_0x4b7391[_0x398e(0x3f)]};}return{'isValid':!![]};};export const formatEventDate=_0x126918=>{const _0x2105c1={'kHWaj':function(_0x57da8d){return _0x57da8d();},'RIIgM':function(_0x13f043,_0x3edfad){return _0x13f043<_0x3edfad;},'iicDU':function(_0x33385e,_0x20e68e){return _0x33385e!==_0x20e68e;},'Sqapv':_0x398e(0x40),'JZHVy':_0x398e(0x2a),'TEqyh':_0x398e(0x41),'KKjFw':_0x398e(0x2b),'dcnBq':_0x398e(0x42),'zPzYG':_0x398e(0x43)};try{if(_0x2105c1[_0x398e(0x44)](_0x2105c1[_0x398e(0x45)],_0x2105c1[_0x398e(0x45)]))return _0x2105c1[_0x398e(0x46)](_0x48db26);else{const _0x59de96=new Date(_0x126918);return _0x59de96['toLocaleDateString'](_0x2105c1[_0x398e(0x47)],{'weekday':_0x2105c1[_0x398e(0x48)],'year':_0x2105c1['KKjFw'],'month':_0x2105c1['TEqyh'],'day':_0x2105c1[_0x398e(0x49)]});}}catch(_0x47d997){if(_0x2105c1[_0x398e(0x4a)]!==_0x2105c1[_0x398e(0x4b)])return _0x126918;else{const _0x5c40aa=new _0x268e79(),_0x5b10ad=new _0x511ecd(_0x2a92f7);return _0x5c40aa[_0x398e(0x16)](0x0,0x0,0x0,0x0),_0x5b10ad[_0x398e(0x16)](0x0,0x0,0x0,0x0),_0x2105c1[_0x398e(0x4c)](_0x5b10ad,_0x5c40aa);}}};export const isEventToday=_0x4e9773=>{const _0x237cda={'aYmpZ':function(_0x4b3ba6,_0x423d31){return _0x4b3ba6-_0x423d31;},'NvOLf':function(_0x137aa2,_0xf01095){return _0x137aa2===_0xf01095;},'DENrJ':_0x398e(0x4d),'IROnR':function(_0x215cf7,_0x532b8b){return _0x215cf7===_0x532b8b;}};try{if(_0x237cda[_0x398e(0x4e)](_0x237cda[_0x398e(0x4f)],_0x398e(0x4d))){const _0x51559a=new Date(),_0x5088c6=new Date(_0x4e9773);return _0x237cda[_0x398e(0x4e)](_0x51559a[_0x398e(0x1e)](),_0x5088c6[_0x398e(0x1e)]())&&_0x51559a['getMonth']()===_0x5088c6[_0x398e(0x50)]()&&_0x237cda['IROnR'](_0x51559a[_0x398e(0x51)](),_0x5088c6['getDate']());}else return _0x237cda[_0x398e(0x52)](_0x280de3['getTime'](),_0x150d2c['getTime']());}catch(_0x4fbc07){return![];}};export const isEventPast=_0x5d58d4=>{const _0x46417e={'nSITF':function(_0x51faf5,_0x2f5738){return _0x51faf5-_0x2f5738;},'JFHBB':function(_0x3a7159,_0x4747b3){return _0x3a7159*_0x4747b3;},'gUOpe':function(_0x2a6edb,_0x1d4000){return _0x2a6edb<_0x1d4000;},'JKFUK':function(_0xc9101f,_0x4c2a96){return _0xc9101f<_0x4c2a96;},'IcbOz':function(_0x32bf74,_0x2dc5d5){return _0x32bf74&&_0x2dc5d5;},'eeLPT':function(_0x2b9fb7,_0x40eadf){return _0x2b9fb7-_0x40eadf;},'UoOLY':function(_0x2749ad,_0x3b514d){return _0x2749ad===_0x3b514d;},'vFPlV':'IqelF','ltIUu':function(_0x2aa9d0,_0x52e0a4){return _0x2aa9d0<_0x52e0a4;},'VLOKA':_0x398e(0x53),'RaSco':'KYJKR'};try{if(_0x46417e[_0x398e(0x54)](_0x46417e[_0x398e(0x55)],_0x398e(0x56))){const _0x4aa977=_0x51910b['length'],_0x831d14=_0x42c0e9['filter'](_0xeda988=>_0xeda988[_0x398e(0x57)])['length'],_0x2adac5=_0x46417e[_0x398e(0x58)](_0x4aa977,_0x831d14),_0x1f054b=_0x2f2474[_0x398e(0x59)]((_0x1c27cd,_0x5f5816)=>_0x1c27cd+_0x5f5816[_0x398e(0x5a)],0x0),_0x17c8f5=_0xaabb54[_0x398e(0x59)]((_0x386b01,_0x5f2fc0)=>_0x386b01+_0x5f2fc0[_0x398e(0x5b)],0x0),_0xc27fff=_0x6a9d65[_0x398e(0x10)](_0x1cfd85=>_0x1cfd85['isActive']&&!_0x3809a9(_0x1cfd85[_0x398e(0x5c)]))[_0x398e(0x6)],_0x45f32e=_0x322733['filter'](_0x586806=>_0x2b9768(_0x586806[_0x398e(0x5c)]))['length'],_0x14ffe4=_0x1b5d07[_0x398e(0x10)](_0x558571=>_0x558571[_0x398e(0x57)]&&_0x7184a1(_0x558571[_0x398e(0x5c)]))[_0x398e(0x6)];return{'total':_0x4aa977,'active':_0x831d14,'inactive':_0x2adac5,'upcoming':_0xc27fff,'past':_0x45f32e,'today':_0x14ffe4,'totalAttendees':_0x1f054b,'totalCapacity':_0x17c8f5,'averageAttendance':_0x17c8f5>0x0?_0x35cc61[_0x398e(0x5d)](_0x46417e['JFHBB'](_0x1f054b/_0x17c8f5,0x64)):0x0};}else{const _0x5f1e58=new Date(),_0x547728=new Date(_0x5d58d4);return _0x5f1e58[_0x398e(0x16)](0x0,0x0,0x0,0x0),_0x547728['setHours'](0x0,0x0,0x0,0x0),_0x46417e[_0x398e(0x5e)](_0x547728,_0x5f1e58);}}catch(_0x223ccc){return _0x46417e[_0x398e(0x5f)]===_0x46417e['RaSco']?_0x4978b7['sort']((_0x5e4b46,_0x15c3af)=>{if(_0x5e4b46[_0x398e(0x57)]&&!_0x15c3af['isActive'])return-0x1;if(!_0x5e4b46['isActive']&&_0x15c3af[_0x398e(0x57)])return 0x1;const _0x1cd185=new _0x2a8735(_0x5e4b46[_0x398e(0x5c)]),_0x255b7a=new _0x5b8e7b(_0x15c3af[_0x398e(0x5c)]),_0x11d181=new _0x5851d0(),_0x5852fe=_0x46417e['gUOpe'](_0x1cd185,_0x11d181),_0x3555f7=_0x46417e[_0x398e(0x60)](_0x255b7a,_0x11d181);if(_0x46417e[_0x398e(0x61)](_0x5852fe,!_0x3555f7))return 0x1;if(!_0x5852fe&&_0x3555f7)return-0x1;return _0x46417e[_0x398e(0x61)](_0x5852fe,_0x3555f7)?_0x46417e['nSITF'](_0x255b7a['getTime'](),_0x1cd185[_0x398e(0x23)]()):_0x46417e[_0x398e(0x62)](_0x1cd185[_0x398e(0x23)](),_0x255b7a[_0x398e(0x23)]());}):![];}};function _0x398e(_0x3f5115,_0x398e6d){_0x3f5115=_0x3f5115-0x0;const _0x56209f=_0x3f51();let _0x2b8cef=_0x56209f[_0x3f5115];return _0x2b8cef;}function _0x3f51(){const _0x63e2db=['ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789','LWLXV','substring','charAt','bMPha','random','length','Past','dAGXv','RgPKT','UNurN','XzgtW','qoUkG','trim','replace','split','filter','yzlAt','vdUYz','tRBla','xnaEb','GTfMD','setHours','JCqZP','slice','map','join','gmrJy','yddkO','dvTSF','getFullYear','toString','bwStK','bwYey','eujCN','getTime','ceil','DCHYj','Zsrzq','dJlGL','ZHHzO','Event\x20code\x20must\x20be\x20at\x20least\x203\x20characters','en-US','numeric','Event\x20code\x20is\x20required','FWZrX','Blejy','Event\x20code\x20must\x20contain\x20only\x20letters\x20and\x20numbers','AyYac','wiamA','OMNwG','tNlBl','RQZIf','GcWOV','wGbXY','Event\x20code\x20must\x20be\x2010\x20characters\x20or\x20less','test','hmWep','LkSlh','toLocaleDateString','tDweb','eZqdU','Nvtyy','Rmick','rGyHM','long','lgNCj','obKXa','iicDU','Sqapv','kHWaj','JZHVy','TEqyh','KKjFw','dcnBq','zPzYG','RIIgM','oeirv','NvOLf','DENrJ','getMonth','getDate','aYmpZ','gAqlf','UoOLY','vFPlV','hfgyo','isActive','nSITF','reduce','attendeeCount','maxAttendees','eventDate','round','ltIUu','VLOKA','JKFUK','IcbOz','eeLPT','Inactive','Today','pWpuh','OfwDH','SJZIw','aNEPi','lfNle','yGtsj','KUUrg','wKFVL','QUxvi','LDbxp','fyWYZ','sort','xFmcP','IWTHd','HQgIl','yTtyG','iTfJk','dZjjc','NxjXH','FYFrP','ihZzb','ROyLr','toLowerCase','title','includes','description','Nwuml','location','organizer','tags','wzVaz','some','from','dDjQd','UIbOr','lbhkp'];_0x3f51=function(){return _0x63e2db;};return _0x3f51();}export const getEventStatus=(_0x302613,_0x23b455)=>{const _0x3d2173={'aNEPi':_0x398e(0x63),'pWpuh':function(_0x584dd8,_0x1219df){return _0x584dd8===_0x1219df;},'yduCb':function(_0x284292,_0x5bb07d){return _0x284292(_0x5bb07d);},'lfNle':_0x398e(0x7),'CtgLs':function(_0x242165,_0x263715){return _0x242165(_0x263715);},'yGtsj':_0x398e(0x64)};if(!_0x23b455)return _0x3d2173[_0x398e(0x65)](_0x398e(0x66),_0x398e(0x67))?_0x3d2173[_0x398e(0x68)]:_0x3d2173[_0x398e(0x68)];if(_0x3d2173['yduCb'](isEventPast,_0x302613))return _0x3d2173[_0x398e(0x69)];if(_0x3d2173['CtgLs'](isEventToday,_0x302613))return _0x3d2173[_0x398e(0x6a)];return'Upcoming';};export const getDaysUntilEvent=_0x20c7e6=>{const _0x1a2e24={'KUUrg':function(_0x2a0847,_0x186d3a){return _0x2a0847/_0x186d3a;},'wKFVL':function(_0x3a3bdd,_0x3daf76){return _0x3a3bdd*_0x3daf76;},'wgwlz':function(_0x5de23a,_0x117e09){return _0x5de23a*_0x117e09;},'QUxvi':function(_0x1ce7cd,_0x451387){return _0x1ce7cd*_0x451387;}};try{const _0x373361=new Date(),_0x300e07=new Date(_0x20c7e6);_0x373361[_0x398e(0x16)](0x0,0x0,0x0,0x0),_0x300e07[_0x398e(0x16)](0x0,0x0,0x0,0x0);const _0x3ae53f=_0x300e07['getTime']()-_0x373361[_0x398e(0x23)](),_0x5e9c88=Math[_0x398e(0x24)](_0x1a2e24[_0x398e(0x6b)](_0x3ae53f,_0x1a2e24[_0x398e(0x6c)](_0x1a2e24['wgwlz'](_0x1a2e24[_0x398e(0x6d)](0x3e8,0x3c),0x3c),0x18)));return _0x5e9c88;}catch(_0x5a1793){return 0x0;}};export const sortEventsByDate=_0x551fa2=>{const _0x125339={'HQgIl':function(_0x2a56a4,_0x12ab8c){return _0x2a56a4===_0x12ab8c;},'yTtyG':function(_0x360758,_0x546410){return _0x360758===_0x546410;},'xFmcP':_0x398e(0x6e),'iTfJk':function(_0x58272c,_0x287b36){return _0x58272c<_0x287b36;},'dZjjc':function(_0x1382f6,_0x35e4e0){return _0x1382f6&&_0x35e4e0;},'NxjXH':function(_0x4499c7,_0x46b196){return _0x4499c7===_0x46b196;},'FYFrP':_0x398e(0x6f),'ihZzb':function(_0x2d5f6d,_0x13a769){return _0x2d5f6d-_0x13a769;},'ROyLr':function(_0x31e55d,_0x187978){return _0x31e55d-_0x187978;}};return _0x551fa2[_0x398e(0x70)]((_0x516841,_0x2d616f)=>{if(_0x125339[_0x398e(0x71)]===_0x398e(0x72))try{const _0xeff174=new _0x8bcc01(),_0x55b325=new _0x14625b(_0x351666);return _0x125339[_0x398e(0x73)](_0xeff174[_0x398e(0x1e)](),_0x55b325[_0x398e(0x1e)]())&&_0xeff174[_0x398e(0x50)]()===_0x55b325[_0x398e(0x50)]()&&_0x125339[_0x398e(0x74)](_0xeff174['getDate'](),_0x55b325['getDate']());}catch(_0x5d6d2f){return![];}else{if(_0x516841['isActive']&&!_0x2d616f[_0x398e(0x57)])return-0x1;if(!_0x516841[_0x398e(0x57)]&&_0x2d616f[_0x398e(0x57)])return 0x1;const _0x58f54e=new Date(_0x516841[_0x398e(0x5c)]),_0x396b4b=new Date(_0x2d616f[_0x398e(0x5c)]),_0x5541e2=new Date(),_0x1b300b=_0x125339[_0x398e(0x75)](_0x58f54e,_0x5541e2),_0x1846ff=_0x396b4b<_0x5541e2;if(_0x125339[_0x398e(0x76)](_0x1b300b,!_0x1846ff))return 0x1;if(_0x125339['dZjjc'](!_0x1b300b,_0x1846ff))return-0x1;return _0x1b300b&&_0x1846ff?_0x125339[_0x398e(0x77)](_0x125339[_0x398e(0x78)],_0x125339[_0x398e(0x78)])?_0x125339[_0x398e(0x79)](_0x396b4b[_0x398e(0x23)](),_0x58f54e['getTime']()):![]:_0x125339[_0x398e(0x7a)](_0x58f54e[_0x398e(0x23)](),_0x396b4b[_0x398e(0x23)]());}});};export const filterEventsBySearch=(_0x50332c,_0x10536a)=>{const _0x23367c={'Nwuml':function(_0x5bfed4,_0x4a5a07){return _0x5bfed4===_0x4a5a07;},'wzVaz':function(_0x335d6f,_0x1b1373){return _0x335d6f===_0x1b1373;}};if(!_0x10536a['trim']())return _0x50332c;const _0x43e710=_0x10536a[_0x398e(0x7b)]()[_0x398e(0xd)]();return _0x50332c[_0x398e(0x10)](_0x1c2de6=>{var _0x41a7fe,_0x3a3a7c,_0x4f14ca;return _0x1c2de6[_0x398e(0x7c)]['toLowerCase']()[_0x398e(0x7d)](_0x43e710)||_0x1c2de6[_0x398e(0x7e)][_0x398e(0x7b)]()[_0x398e(0x7d)](_0x43e710)||_0x1c2de6['code'][_0x398e(0x7b)]()['includes'](_0x43e710)||(_0x23367c[_0x398e(0x7f)](_0x41a7fe=_0x1c2de6[_0x398e(0x80)],null)||_0x23367c[_0x398e(0x7f)](_0x41a7fe,void 0x0)?void 0x0:_0x41a7fe[_0x398e(0x7b)]()[_0x398e(0x7d)](_0x43e710))||((_0x3a3a7c=_0x1c2de6[_0x398e(0x81)])===null||_0x3a3a7c===void 0x0?void 0x0:_0x3a3a7c['toLowerCase']()[_0x398e(0x7d)](_0x43e710))||(_0x23367c[_0x398e(0x7f)](_0x4f14ca=_0x1c2de6[_0x398e(0x82)],null)||_0x23367c[_0x398e(0x83)](_0x4f14ca,void 0x0)?void 0x0:_0x4f14ca[_0x398e(0x84)](_0x107081=>_0x107081[_0x398e(0x7b)]()[_0x398e(0x7d)](_0x43e710)));});};export const getUniqueEventTags=_0x14eded=>{const _0x5ab780=_0x14eded['flatMap'](_0x102821=>_0x102821[_0x398e(0x82)]||[]);return Array[_0x398e(0x85)](new Set(_0x5ab780))[_0x398e(0x70)]();};export const calculateEventStats=_0x223fe4=>{const _0x17bc93={'dDjQd':function(_0x77a662,_0xb8eee3){return _0x77a662-_0xb8eee3;},'ApSge':function(_0x490fb8,_0x2994df){return _0x490fb8>_0x2994df;},'UIbOr':function(_0x4ab9fa,_0x31902d){return _0x4ab9fa*_0x31902d;},'lbhkp':function(_0x3b85ed,_0x4948b5){return _0x3b85ed/_0x4948b5;}},_0x245d04=_0x223fe4[_0x398e(0x6)],_0x2c1834=_0x223fe4[_0x398e(0x10)](_0x58297=>_0x58297[_0x398e(0x57)])[_0x398e(0x6)],_0x2d3c21=_0x17bc93[_0x398e(0x86)](_0x245d04,_0x2c1834),_0x4ce79b=_0x223fe4[_0x398e(0x59)]((_0x5a4d25,_0x9634f2)=>_0x5a4d25+_0x9634f2[_0x398e(0x5a)],0x0),_0x5e20e3=_0x223fe4[_0x398e(0x59)]((_0x39c728,_0x273273)=>_0x39c728+_0x273273['maxAttendees'],0x0),_0x39da14=_0x223fe4['filter'](_0x30557d=>_0x30557d[_0x398e(0x57)]&&!isEventPast(_0x30557d[_0x398e(0x5c)]))[_0x398e(0x6)],_0x554c7=_0x223fe4[_0x398e(0x10)](_0x43368d=>isEventPast(_0x43368d[_0x398e(0x5c)]))['length'],_0x6608c3=_0x223fe4[_0x398e(0x10)](_0x5e46ca=>_0x5e46ca[_0x398e(0x57)]&&isEventToday(_0x5e46ca[_0x398e(0x5c)]))[_0x398e(0x6)];return{'total':_0x245d04,'active':_0x2c1834,'inactive':_0x2d3c21,'upcoming':_0x39da14,'past':_0x554c7,'today':_0x6608c3,'totalAttendees':_0x4ce79b,'totalCapacity':_0x5e20e3,'averageAttendance':_0x17bc93['ApSge'](_0x5e20e3,0x0)?Math[_0x398e(0x5d)](_0x17bc93[_0x398e(0x87)](_0x17bc93[_0x398e(0x88)](_0x4ce79b,_0x5e20e3),0x64)):0x0};};
|
|
1
|
+
/**
|
|
2
|
+
* Event utility functions for event management
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Generate a random alphanumeric event code
|
|
7
|
+
* @param length - Length of the code (default: 6)
|
|
8
|
+
* @returns Random event code
|
|
9
|
+
*/
|
|
10
|
+
export const generateEventCode = (length = 6) => {
|
|
11
|
+
const chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789';
|
|
12
|
+
let result = '';
|
|
13
|
+
for (let i = 0; i < length; i++) {
|
|
14
|
+
result += chars.charAt(Math.floor(Math.random() * chars.length));
|
|
15
|
+
}
|
|
16
|
+
return result;
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Generate a smart event code based on the event title
|
|
21
|
+
* @param title - Event title
|
|
22
|
+
* @returns Smart event code
|
|
23
|
+
*/
|
|
24
|
+
export const generateSmartEventCode = title => {
|
|
25
|
+
if (!title.trim()) {
|
|
26
|
+
return generateEventCode();
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
// Clean the title and split into words
|
|
30
|
+
const words = title.trim().toUpperCase().replace(/[^A-Z0-9\s]/g, '') // Remove special characters
|
|
31
|
+
.split(/\s+/).filter(word => word.length > 0);
|
|
32
|
+
if (words.length === 0) {
|
|
33
|
+
return generateEventCode();
|
|
34
|
+
}
|
|
35
|
+
let code = '';
|
|
36
|
+
|
|
37
|
+
// Strategy 1: Take first 2 letters of each word (up to 3 words)
|
|
38
|
+
if (words.length >= 2) {
|
|
39
|
+
const significantWords = words.slice(0, 3);
|
|
40
|
+
code = significantWords.map(word => word.substring(0, 2)).join('');
|
|
41
|
+
} else {
|
|
42
|
+
// Strategy 2: Single word - take first 4 letters
|
|
43
|
+
code = words[0].substring(0, 4);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
// Add current year's last 2 digits
|
|
47
|
+
const currentYear = new Date().getFullYear().toString().slice(-2);
|
|
48
|
+
code += currentYear;
|
|
49
|
+
|
|
50
|
+
// Ensure minimum length of 4 and maximum of 8
|
|
51
|
+
if (code.length < 4) {
|
|
52
|
+
code += generateEventCode(4 - code.length);
|
|
53
|
+
} else if (code.length > 8) {
|
|
54
|
+
code = code.substring(0, 8);
|
|
55
|
+
}
|
|
56
|
+
return code;
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* Validate event code format
|
|
61
|
+
* @param code - Event code to validate
|
|
62
|
+
* @returns Object with validation result and error message
|
|
63
|
+
*/
|
|
64
|
+
export const validateEventCode = code => {
|
|
65
|
+
if (!code || !code.trim()) {
|
|
66
|
+
return {
|
|
67
|
+
isValid: false,
|
|
68
|
+
error: 'Event code is required'
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
const trimmedCode = code.trim().toUpperCase();
|
|
72
|
+
if (trimmedCode.length < 3) {
|
|
73
|
+
return {
|
|
74
|
+
isValid: false,
|
|
75
|
+
error: 'Event code must be at least 3 characters'
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
if (trimmedCode.length > 10) {
|
|
79
|
+
return {
|
|
80
|
+
isValid: false,
|
|
81
|
+
error: 'Event code must be 10 characters or less'
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
if (!/^[A-Z0-9]+$/.test(trimmedCode)) {
|
|
85
|
+
return {
|
|
86
|
+
isValid: false,
|
|
87
|
+
error: 'Event code must contain only letters and numbers'
|
|
88
|
+
};
|
|
89
|
+
}
|
|
90
|
+
return {
|
|
91
|
+
isValid: true
|
|
92
|
+
};
|
|
93
|
+
};
|
|
94
|
+
|
|
95
|
+
/**
|
|
96
|
+
* Format event date for display
|
|
97
|
+
* @param dateString - Date string in YYYY-MM-DD format
|
|
98
|
+
* @returns Formatted date string
|
|
99
|
+
*/
|
|
100
|
+
export const formatEventDate = dateString => {
|
|
101
|
+
try {
|
|
102
|
+
const date = new Date(dateString);
|
|
103
|
+
return date.toLocaleDateString('en-US', {
|
|
104
|
+
weekday: 'long',
|
|
105
|
+
year: 'numeric',
|
|
106
|
+
month: 'long',
|
|
107
|
+
day: 'numeric'
|
|
108
|
+
});
|
|
109
|
+
} catch (error) {
|
|
110
|
+
return dateString;
|
|
111
|
+
}
|
|
112
|
+
};
|
|
113
|
+
|
|
114
|
+
/**
|
|
115
|
+
* Check if an event is happening today
|
|
116
|
+
* @param eventDate - Event date string
|
|
117
|
+
* @returns True if event is today
|
|
118
|
+
*/
|
|
119
|
+
export const isEventToday = eventDate => {
|
|
120
|
+
try {
|
|
121
|
+
const today = new Date();
|
|
122
|
+
const event = new Date(eventDate);
|
|
123
|
+
return today.getFullYear() === event.getFullYear() && today.getMonth() === event.getMonth() && today.getDate() === event.getDate();
|
|
124
|
+
} catch (error) {
|
|
125
|
+
return false;
|
|
126
|
+
}
|
|
127
|
+
};
|
|
128
|
+
|
|
129
|
+
/**
|
|
130
|
+
* Check if an event is in the past
|
|
131
|
+
* @param eventDate - Event date string
|
|
132
|
+
* @returns True if event is in the past
|
|
133
|
+
*/
|
|
134
|
+
export const isEventPast = eventDate => {
|
|
135
|
+
try {
|
|
136
|
+
const today = new Date();
|
|
137
|
+
const event = new Date(eventDate);
|
|
138
|
+
|
|
139
|
+
// Set time to start of day for accurate comparison
|
|
140
|
+
today.setHours(0, 0, 0, 0);
|
|
141
|
+
event.setHours(0, 0, 0, 0);
|
|
142
|
+
return event < today;
|
|
143
|
+
} catch (error) {
|
|
144
|
+
return false;
|
|
145
|
+
}
|
|
146
|
+
};
|
|
147
|
+
|
|
148
|
+
/**
|
|
149
|
+
* Get event status based on date and active status
|
|
150
|
+
* @param eventDate - Event date string
|
|
151
|
+
* @param isActive - Whether event is active
|
|
152
|
+
* @returns Event status string
|
|
153
|
+
*/
|
|
154
|
+
export const getEventStatus = (eventDate, isActive) => {
|
|
155
|
+
if (!isActive) {
|
|
156
|
+
return 'Inactive';
|
|
157
|
+
}
|
|
158
|
+
if (isEventPast(eventDate)) {
|
|
159
|
+
return 'Past';
|
|
160
|
+
}
|
|
161
|
+
if (isEventToday(eventDate)) {
|
|
162
|
+
return 'Today';
|
|
163
|
+
}
|
|
164
|
+
return 'Upcoming';
|
|
165
|
+
};
|
|
166
|
+
|
|
167
|
+
/**
|
|
168
|
+
* Calculate days until event
|
|
169
|
+
* @param eventDate - Event date string
|
|
170
|
+
* @returns Number of days until event (negative if past)
|
|
171
|
+
*/
|
|
172
|
+
export const getDaysUntilEvent = eventDate => {
|
|
173
|
+
try {
|
|
174
|
+
const today = new Date();
|
|
175
|
+
const event = new Date(eventDate);
|
|
176
|
+
|
|
177
|
+
// Set time to start of day for accurate comparison
|
|
178
|
+
today.setHours(0, 0, 0, 0);
|
|
179
|
+
event.setHours(0, 0, 0, 0);
|
|
180
|
+
const diffTime = event.getTime() - today.getTime();
|
|
181
|
+
const diffDays = Math.ceil(diffTime / (1000 * 60 * 60 * 24));
|
|
182
|
+
return diffDays;
|
|
183
|
+
} catch (error) {
|
|
184
|
+
return 0;
|
|
185
|
+
}
|
|
186
|
+
};
|
|
187
|
+
|
|
188
|
+
/**
|
|
189
|
+
* Sort events by date (upcoming first, then past events)
|
|
190
|
+
* @param events - Array of events
|
|
191
|
+
* @returns Sorted array of events
|
|
192
|
+
*/
|
|
193
|
+
export const sortEventsByDate = events => {
|
|
194
|
+
return events.sort((a, b) => {
|
|
195
|
+
// Active events first
|
|
196
|
+
if (a.isActive && !b.isActive) return -1;
|
|
197
|
+
if (!a.isActive && b.isActive) return 1;
|
|
198
|
+
|
|
199
|
+
// Then sort by date
|
|
200
|
+
const dateA = new Date(a.eventDate);
|
|
201
|
+
const dateB = new Date(b.eventDate);
|
|
202
|
+
|
|
203
|
+
// Upcoming events first (ascending), then past events (descending)
|
|
204
|
+
const today = new Date();
|
|
205
|
+
const aIsPast = dateA < today;
|
|
206
|
+
const bIsPast = dateB < today;
|
|
207
|
+
if (aIsPast && !bIsPast) return 1;
|
|
208
|
+
if (!aIsPast && bIsPast) return -1;
|
|
209
|
+
if (aIsPast && bIsPast) {
|
|
210
|
+
return dateB.getTime() - dateA.getTime(); // Past events: most recent first
|
|
211
|
+
} else {
|
|
212
|
+
return dateA.getTime() - dateB.getTime(); // Upcoming events: soonest first
|
|
213
|
+
}
|
|
214
|
+
});
|
|
215
|
+
};
|
|
216
|
+
|
|
217
|
+
/**
|
|
218
|
+
* Filter events by search query
|
|
219
|
+
* @param events - Array of events
|
|
220
|
+
* @param query - Search query
|
|
221
|
+
* @returns Filtered array of events
|
|
222
|
+
*/
|
|
223
|
+
export const filterEventsBySearch = (events, query) => {
|
|
224
|
+
if (!query.trim()) {
|
|
225
|
+
return events;
|
|
226
|
+
}
|
|
227
|
+
const searchTerm = query.toLowerCase().trim();
|
|
228
|
+
return events.filter(event => {
|
|
229
|
+
var _event$location, _event$organizer, _event$tags;
|
|
230
|
+
return event.title.toLowerCase().includes(searchTerm) || event.description.toLowerCase().includes(searchTerm) || event.code.toLowerCase().includes(searchTerm) || ((_event$location = event.location) === null || _event$location === void 0 ? void 0 : _event$location.toLowerCase().includes(searchTerm)) || ((_event$organizer = event.organizer) === null || _event$organizer === void 0 ? void 0 : _event$organizer.toLowerCase().includes(searchTerm)) || ((_event$tags = event.tags) === null || _event$tags === void 0 ? void 0 : _event$tags.some(tag => tag.toLowerCase().includes(searchTerm)));
|
|
231
|
+
});
|
|
232
|
+
};
|
|
233
|
+
|
|
234
|
+
/**
|
|
235
|
+
* Get unique tags from events
|
|
236
|
+
* @param events - Array of events
|
|
237
|
+
* @returns Array of unique tags
|
|
238
|
+
*/
|
|
239
|
+
export const getUniqueEventTags = events => {
|
|
240
|
+
const allTags = events.flatMap(event => event.tags || []);
|
|
241
|
+
return Array.from(new Set(allTags)).sort();
|
|
242
|
+
};
|
|
243
|
+
|
|
244
|
+
/**
|
|
245
|
+
* Calculate event statistics
|
|
246
|
+
* @param events - Array of events
|
|
247
|
+
* @returns Event statistics object
|
|
248
|
+
*/
|
|
249
|
+
export const calculateEventStats = events => {
|
|
250
|
+
const total = events.length;
|
|
251
|
+
const active = events.filter(e => e.isActive).length;
|
|
252
|
+
const inactive = total - active;
|
|
253
|
+
const totalAttendees = events.reduce((sum, e) => sum + e.attendeeCount, 0);
|
|
254
|
+
const totalCapacity = events.reduce((sum, e) => sum + e.maxAttendees, 0);
|
|
255
|
+
const upcoming = events.filter(e => e.isActive && !isEventPast(e.eventDate)).length;
|
|
256
|
+
const past = events.filter(e => isEventPast(e.eventDate)).length;
|
|
257
|
+
const today = events.filter(e => e.isActive && isEventToday(e.eventDate)).length;
|
|
258
|
+
return {
|
|
259
|
+
total,
|
|
260
|
+
active,
|
|
261
|
+
inactive,
|
|
262
|
+
upcoming,
|
|
263
|
+
past,
|
|
264
|
+
today,
|
|
265
|
+
totalAttendees,
|
|
266
|
+
totalCapacity,
|
|
267
|
+
averageAttendance: totalCapacity > 0 ? Math.round(totalAttendees / totalCapacity * 100) : 0
|
|
268
|
+
};
|
|
269
|
+
};
|
|
270
|
+
//# sourceMappingURL=eventUtils.js.map
|
|
@@ -1,8 +1,59 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
];
|
|
7
|
-
|
|
8
|
-
|
|
1
|
+
import { Platform } from 'react-native';
|
|
2
|
+
export let HapticType = /*#__PURE__*/function (HapticType) {
|
|
3
|
+
HapticType["LIGHT"] = "light";
|
|
4
|
+
HapticType["MEDIUM"] = "medium";
|
|
5
|
+
HapticType["HEAVY"] = "heavy";
|
|
6
|
+
HapticType["SUCCESS"] = "success";
|
|
7
|
+
HapticType["WARNING"] = "warning";
|
|
8
|
+
HapticType["ERROR"] = "error";
|
|
9
|
+
HapticType["BUTTON_PRESS"] = "light"; // Alias for button presses
|
|
10
|
+
return HapticType;
|
|
11
|
+
}({});
|
|
12
|
+
export const triggerHaptic = (type = HapticType.LIGHT) => {
|
|
13
|
+
if (Platform.OS === 'ios') {
|
|
14
|
+
try {
|
|
15
|
+
// Try to use react-native-haptic-feedback if available
|
|
16
|
+
const ReactNativeHapticFeedback = require('react-native-haptic-feedback');
|
|
17
|
+
const options = {
|
|
18
|
+
enableVibrateFallback: true,
|
|
19
|
+
ignoreAndroidSystemSettings: false
|
|
20
|
+
};
|
|
21
|
+
switch (type) {
|
|
22
|
+
case HapticType.LIGHT:
|
|
23
|
+
ReactNativeHapticFeedback.trigger('impactLight', options);
|
|
24
|
+
break;
|
|
25
|
+
case HapticType.MEDIUM:
|
|
26
|
+
ReactNativeHapticFeedback.trigger('impactMedium', options);
|
|
27
|
+
break;
|
|
28
|
+
case HapticType.HEAVY:
|
|
29
|
+
ReactNativeHapticFeedback.trigger('impactHeavy', options);
|
|
30
|
+
break;
|
|
31
|
+
case HapticType.SUCCESS:
|
|
32
|
+
ReactNativeHapticFeedback.trigger('notificationSuccess', options);
|
|
33
|
+
break;
|
|
34
|
+
case HapticType.WARNING:
|
|
35
|
+
ReactNativeHapticFeedback.trigger('notificationWarning', options);
|
|
36
|
+
break;
|
|
37
|
+
case HapticType.ERROR:
|
|
38
|
+
ReactNativeHapticFeedback.trigger('notificationError', options);
|
|
39
|
+
break;
|
|
40
|
+
default:
|
|
41
|
+
ReactNativeHapticFeedback.trigger('impactLight', options);
|
|
42
|
+
}
|
|
43
|
+
} catch (error) {
|
|
44
|
+
// Fallback to basic vibration if haptic feedback is not available
|
|
45
|
+
console.warn('Haptic feedback not available:', error);
|
|
46
|
+
}
|
|
47
|
+
} else if (Platform.OS === 'android') {
|
|
48
|
+
// Android fallback - basic vibration
|
|
49
|
+
try {
|
|
50
|
+
const {
|
|
51
|
+
Vibration
|
|
52
|
+
} = require('react-native');
|
|
53
|
+
Vibration.vibrate(50);
|
|
54
|
+
} catch (error) {
|
|
55
|
+
console.warn('Vibration not available:', error);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
};
|
|
59
|
+
//# sourceMappingURL=haptics.js.map
|