@oxyhq/core 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +50 -0
- package/dist/cjs/AuthManager.js +361 -0
- package/dist/cjs/CrossDomainAuth.js +258 -0
- package/dist/cjs/HttpService.js +618 -0
- package/dist/cjs/OxyServices.base.js +263 -0
- package/dist/cjs/OxyServices.errors.js +22 -0
- package/dist/cjs/OxyServices.js +63 -0
- package/dist/cjs/constants/version.js +16 -0
- package/dist/cjs/crypto/index.js +20 -0
- package/dist/cjs/crypto/keyManager.js +887 -0
- package/dist/cjs/crypto/polyfill.js +64 -0
- package/dist/cjs/crypto/recoveryPhrase.js +169 -0
- package/dist/cjs/crypto/signatureService.js +296 -0
- package/dist/cjs/i18n/index.js +73 -0
- package/dist/cjs/i18n/locales/ar-SA.json +120 -0
- package/dist/cjs/i18n/locales/ca-ES.json +120 -0
- package/dist/cjs/i18n/locales/de-DE.json +120 -0
- package/dist/cjs/i18n/locales/en-US.json +956 -0
- package/dist/cjs/i18n/locales/es-ES.json +944 -0
- package/dist/cjs/i18n/locales/fr-FR.json +120 -0
- package/dist/cjs/i18n/locales/it-IT.json +120 -0
- package/dist/cjs/i18n/locales/ja-JP.json +119 -0
- package/dist/cjs/i18n/locales/ko-KR.json +120 -0
- package/dist/cjs/i18n/locales/locales/ar-SA.json +120 -0
- package/dist/cjs/i18n/locales/locales/ca-ES.json +120 -0
- package/dist/cjs/i18n/locales/locales/de-DE.json +120 -0
- package/dist/cjs/i18n/locales/locales/en-US.json +956 -0
- package/dist/cjs/i18n/locales/locales/es-ES.json +944 -0
- package/dist/cjs/i18n/locales/locales/fr-FR.json +120 -0
- package/dist/cjs/i18n/locales/locales/it-IT.json +120 -0
- package/dist/cjs/i18n/locales/locales/ja-JP.json +119 -0
- package/dist/cjs/i18n/locales/locales/ko-KR.json +120 -0
- package/dist/cjs/i18n/locales/locales/pt-PT.json +120 -0
- package/dist/cjs/i18n/locales/locales/zh-CN.json +120 -0
- package/dist/cjs/i18n/locales/pt-PT.json +120 -0
- package/dist/cjs/i18n/locales/zh-CN.json +120 -0
- package/dist/cjs/index.js +153 -0
- package/dist/cjs/mixins/OxyServices.analytics.js +49 -0
- package/dist/cjs/mixins/OxyServices.assets.js +380 -0
- package/dist/cjs/mixins/OxyServices.auth.js +259 -0
- package/dist/cjs/mixins/OxyServices.developer.js +97 -0
- package/dist/cjs/mixins/OxyServices.devices.js +116 -0
- package/dist/cjs/mixins/OxyServices.features.js +309 -0
- package/dist/cjs/mixins/OxyServices.fedcm.js +435 -0
- package/dist/cjs/mixins/OxyServices.karma.js +108 -0
- package/dist/cjs/mixins/OxyServices.language.js +154 -0
- package/dist/cjs/mixins/OxyServices.location.js +43 -0
- package/dist/cjs/mixins/OxyServices.payment.js +158 -0
- package/dist/cjs/mixins/OxyServices.popup.js +371 -0
- package/dist/cjs/mixins/OxyServices.privacy.js +162 -0
- package/dist/cjs/mixins/OxyServices.redirect.js +345 -0
- package/dist/cjs/mixins/OxyServices.security.js +81 -0
- package/dist/cjs/mixins/OxyServices.user.js +355 -0
- package/dist/cjs/mixins/OxyServices.utility.js +156 -0
- package/dist/cjs/mixins/index.js +79 -0
- package/dist/cjs/mixins/mixinHelpers.js +53 -0
- package/dist/cjs/models/interfaces.js +20 -0
- package/dist/cjs/models/session.js +2 -0
- package/dist/cjs/shared/index.js +70 -0
- package/dist/cjs/shared/utils/colorUtils.js +153 -0
- package/dist/cjs/shared/utils/debugUtils.js +73 -0
- package/dist/cjs/shared/utils/errorUtils.js +183 -0
- package/dist/cjs/shared/utils/index.js +49 -0
- package/dist/cjs/shared/utils/networkUtils.js +183 -0
- package/dist/cjs/shared/utils/themeUtils.js +106 -0
- package/dist/cjs/utils/apiUtils.js +61 -0
- package/dist/cjs/utils/asyncUtils.js +194 -0
- package/dist/cjs/utils/cache.js +226 -0
- package/dist/cjs/utils/deviceManager.js +205 -0
- package/dist/cjs/utils/errorUtils.js +154 -0
- package/dist/cjs/utils/index.js +26 -0
- package/dist/cjs/utils/languageUtils.js +165 -0
- package/dist/cjs/utils/loggerUtils.js +126 -0
- package/dist/cjs/utils/platform.js +144 -0
- package/dist/cjs/utils/requestUtils.js +209 -0
- package/dist/cjs/utils/sessionUtils.js +181 -0
- package/dist/cjs/utils/validationUtils.js +173 -0
- package/dist/esm/AuthManager.js +356 -0
- package/dist/esm/CrossDomainAuth.js +253 -0
- package/dist/esm/HttpService.js +614 -0
- package/dist/esm/OxyServices.base.js +259 -0
- package/dist/esm/OxyServices.errors.js +17 -0
- package/dist/esm/OxyServices.js +59 -0
- package/dist/esm/constants/version.js +13 -0
- package/dist/esm/crypto/index.js +13 -0
- package/dist/esm/crypto/keyManager.js +850 -0
- package/dist/esm/crypto/polyfill.js +61 -0
- package/dist/esm/crypto/recoveryPhrase.js +132 -0
- package/dist/esm/crypto/signatureService.js +259 -0
- package/dist/esm/i18n/index.js +69 -0
- package/dist/esm/i18n/locales/ar-SA.json +120 -0
- package/dist/esm/i18n/locales/ca-ES.json +120 -0
- package/dist/esm/i18n/locales/de-DE.json +120 -0
- package/dist/esm/i18n/locales/en-US.json +956 -0
- package/dist/esm/i18n/locales/es-ES.json +944 -0
- package/dist/esm/i18n/locales/fr-FR.json +120 -0
- package/dist/esm/i18n/locales/it-IT.json +120 -0
- package/dist/esm/i18n/locales/ja-JP.json +119 -0
- package/dist/esm/i18n/locales/ko-KR.json +120 -0
- package/dist/esm/i18n/locales/locales/ar-SA.json +120 -0
- package/dist/esm/i18n/locales/locales/ca-ES.json +120 -0
- package/dist/esm/i18n/locales/locales/de-DE.json +120 -0
- package/dist/esm/i18n/locales/locales/en-US.json +956 -0
- package/dist/esm/i18n/locales/locales/es-ES.json +944 -0
- package/dist/esm/i18n/locales/locales/fr-FR.json +120 -0
- package/dist/esm/i18n/locales/locales/it-IT.json +120 -0
- package/dist/esm/i18n/locales/locales/ja-JP.json +119 -0
- package/dist/esm/i18n/locales/locales/ko-KR.json +120 -0
- package/dist/esm/i18n/locales/locales/pt-PT.json +120 -0
- package/dist/esm/i18n/locales/locales/zh-CN.json +120 -0
- package/dist/esm/i18n/locales/pt-PT.json +120 -0
- package/dist/esm/i18n/locales/zh-CN.json +120 -0
- package/dist/esm/index.js +55 -0
- package/dist/esm/mixins/OxyServices.analytics.js +46 -0
- package/dist/esm/mixins/OxyServices.assets.js +377 -0
- package/dist/esm/mixins/OxyServices.auth.js +256 -0
- package/dist/esm/mixins/OxyServices.developer.js +94 -0
- package/dist/esm/mixins/OxyServices.devices.js +113 -0
- package/dist/esm/mixins/OxyServices.features.js +306 -0
- package/dist/esm/mixins/OxyServices.fedcm.js +433 -0
- package/dist/esm/mixins/OxyServices.karma.js +105 -0
- package/dist/esm/mixins/OxyServices.language.js +118 -0
- package/dist/esm/mixins/OxyServices.location.js +40 -0
- package/dist/esm/mixins/OxyServices.payment.js +155 -0
- package/dist/esm/mixins/OxyServices.popup.js +369 -0
- package/dist/esm/mixins/OxyServices.privacy.js +159 -0
- package/dist/esm/mixins/OxyServices.redirect.js +343 -0
- package/dist/esm/mixins/OxyServices.security.js +78 -0
- package/dist/esm/mixins/OxyServices.user.js +352 -0
- package/dist/esm/mixins/OxyServices.utility.js +153 -0
- package/dist/esm/mixins/index.js +76 -0
- package/dist/esm/mixins/mixinHelpers.js +48 -0
- package/dist/esm/models/interfaces.js +17 -0
- package/dist/esm/models/session.js +1 -0
- package/dist/esm/shared/index.js +31 -0
- package/dist/esm/shared/utils/colorUtils.js +143 -0
- package/dist/esm/shared/utils/debugUtils.js +65 -0
- package/dist/esm/shared/utils/errorUtils.js +170 -0
- package/dist/esm/shared/utils/index.js +15 -0
- package/dist/esm/shared/utils/networkUtils.js +173 -0
- package/dist/esm/shared/utils/themeUtils.js +98 -0
- package/dist/esm/utils/apiUtils.js +55 -0
- package/dist/esm/utils/asyncUtils.js +179 -0
- package/dist/esm/utils/cache.js +218 -0
- package/dist/esm/utils/deviceManager.js +168 -0
- package/dist/esm/utils/errorUtils.js +146 -0
- package/dist/esm/utils/index.js +7 -0
- package/dist/esm/utils/languageUtils.js +158 -0
- package/dist/esm/utils/loggerUtils.js +115 -0
- package/dist/esm/utils/platform.js +102 -0
- package/dist/esm/utils/requestUtils.js +203 -0
- package/dist/esm/utils/sessionUtils.js +171 -0
- package/dist/esm/utils/validationUtils.js +153 -0
- package/dist/types/AuthManager.d.ts +143 -0
- package/dist/types/CrossDomainAuth.d.ts +160 -0
- package/dist/types/HttpService.d.ts +163 -0
- package/dist/types/OxyServices.base.d.ts +126 -0
- package/dist/types/OxyServices.d.ts +81 -0
- package/dist/types/OxyServices.errors.d.ts +11 -0
- package/dist/types/constants/version.d.ts +13 -0
- package/dist/types/crypto/index.d.ts +11 -0
- package/dist/types/crypto/keyManager.d.ts +189 -0
- package/dist/types/crypto/polyfill.d.ts +11 -0
- package/dist/types/crypto/recoveryPhrase.d.ts +58 -0
- package/dist/types/crypto/signatureService.d.ts +86 -0
- package/dist/types/i18n/index.d.ts +3 -0
- package/dist/types/index.d.ts +50 -0
- package/dist/types/mixins/OxyServices.analytics.d.ts +66 -0
- package/dist/types/mixins/OxyServices.assets.d.ts +135 -0
- package/dist/types/mixins/OxyServices.auth.d.ts +186 -0
- package/dist/types/mixins/OxyServices.developer.d.ts +99 -0
- package/dist/types/mixins/OxyServices.devices.d.ts +96 -0
- package/dist/types/mixins/OxyServices.features.d.ts +228 -0
- package/dist/types/mixins/OxyServices.fedcm.d.ts +200 -0
- package/dist/types/mixins/OxyServices.karma.d.ts +85 -0
- package/dist/types/mixins/OxyServices.language.d.ts +81 -0
- package/dist/types/mixins/OxyServices.location.d.ts +64 -0
- package/dist/types/mixins/OxyServices.payment.d.ts +111 -0
- package/dist/types/mixins/OxyServices.popup.d.ts +205 -0
- package/dist/types/mixins/OxyServices.privacy.d.ts +122 -0
- package/dist/types/mixins/OxyServices.redirect.d.ts +245 -0
- package/dist/types/mixins/OxyServices.security.d.ts +78 -0
- package/dist/types/mixins/OxyServices.user.d.ts +182 -0
- package/dist/types/mixins/OxyServices.utility.d.ts +93 -0
- package/dist/types/mixins/index.d.ts +30 -0
- package/dist/types/mixins/mixinHelpers.d.ts +31 -0
- package/dist/types/models/interfaces.d.ts +415 -0
- package/dist/types/models/session.d.ts +27 -0
- package/dist/types/shared/index.d.ts +28 -0
- package/dist/types/shared/utils/colorUtils.d.ts +104 -0
- package/dist/types/shared/utils/debugUtils.d.ts +48 -0
- package/dist/types/shared/utils/errorUtils.d.ts +97 -0
- package/dist/types/shared/utils/index.d.ts +13 -0
- package/dist/types/shared/utils/networkUtils.d.ts +139 -0
- package/dist/types/shared/utils/themeUtils.d.ts +90 -0
- package/dist/types/utils/apiUtils.d.ts +53 -0
- package/dist/types/utils/asyncUtils.d.ts +58 -0
- package/dist/types/utils/cache.d.ts +127 -0
- package/dist/types/utils/deviceManager.d.ts +65 -0
- package/dist/types/utils/errorUtils.d.ts +46 -0
- package/dist/types/utils/index.d.ts +6 -0
- package/dist/types/utils/languageUtils.d.ts +37 -0
- package/dist/types/utils/loggerUtils.d.ts +48 -0
- package/dist/types/utils/platform.d.ts +40 -0
- package/dist/types/utils/requestUtils.d.ts +123 -0
- package/dist/types/utils/sessionUtils.d.ts +54 -0
- package/dist/types/utils/validationUtils.d.ts +85 -0
- package/package.json +84 -0
- package/src/AuthManager.ts +436 -0
- package/src/CrossDomainAuth.ts +307 -0
- package/src/HttpService.ts +752 -0
- package/src/OxyServices.base.ts +334 -0
- package/src/OxyServices.errors.ts +26 -0
- package/src/OxyServices.ts +129 -0
- package/src/constants/version.ts +15 -0
- package/src/crypto/index.ts +25 -0
- package/src/crypto/keyManager.ts +962 -0
- package/src/crypto/polyfill.ts +70 -0
- package/src/crypto/recoveryPhrase.ts +166 -0
- package/src/crypto/signatureService.ts +323 -0
- package/src/i18n/index.ts +75 -0
- package/src/i18n/locales/ar-SA.json +120 -0
- package/src/i18n/locales/ca-ES.json +120 -0
- package/src/i18n/locales/de-DE.json +120 -0
- package/src/i18n/locales/en-US.json +956 -0
- package/src/i18n/locales/es-ES.json +944 -0
- package/src/i18n/locales/fr-FR.json +120 -0
- package/src/i18n/locales/it-IT.json +120 -0
- package/src/i18n/locales/ja-JP.json +119 -0
- package/src/i18n/locales/ko-KR.json +120 -0
- package/src/i18n/locales/pt-PT.json +120 -0
- package/src/i18n/locales/zh-CN.json +120 -0
- package/src/index.ts +153 -0
- package/src/mixins/OxyServices.analytics.ts +53 -0
- package/src/mixins/OxyServices.assets.ts +412 -0
- package/src/mixins/OxyServices.auth.ts +358 -0
- package/src/mixins/OxyServices.developer.ts +114 -0
- package/src/mixins/OxyServices.devices.ts +119 -0
- package/src/mixins/OxyServices.features.ts +428 -0
- package/src/mixins/OxyServices.fedcm.ts +494 -0
- package/src/mixins/OxyServices.karma.ts +111 -0
- package/src/mixins/OxyServices.language.ts +127 -0
- package/src/mixins/OxyServices.location.ts +46 -0
- package/src/mixins/OxyServices.payment.ts +163 -0
- package/src/mixins/OxyServices.popup.ts +443 -0
- package/src/mixins/OxyServices.privacy.ts +182 -0
- package/src/mixins/OxyServices.redirect.ts +397 -0
- package/src/mixins/OxyServices.security.ts +103 -0
- package/src/mixins/OxyServices.user.ts +392 -0
- package/src/mixins/OxyServices.utility.ts +191 -0
- package/src/mixins/index.ts +91 -0
- package/src/mixins/mixinHelpers.ts +69 -0
- package/src/models/interfaces.ts +511 -0
- package/src/models/session.ts +30 -0
- package/src/shared/index.ts +82 -0
- package/src/shared/utils/colorUtils.ts +155 -0
- package/src/shared/utils/debugUtils.ts +73 -0
- package/src/shared/utils/errorUtils.ts +181 -0
- package/src/shared/utils/index.ts +59 -0
- package/src/shared/utils/networkUtils.ts +248 -0
- package/src/shared/utils/themeUtils.ts +115 -0
- package/src/types/bip39.d.ts +32 -0
- package/src/types/buffer.d.ts +97 -0
- package/src/types/color.d.ts +20 -0
- package/src/types/elliptic.d.ts +62 -0
- package/src/utils/apiUtils.ts +88 -0
- package/src/utils/asyncUtils.ts +252 -0
- package/src/utils/cache.ts +264 -0
- package/src/utils/deviceManager.ts +198 -0
- package/src/utils/errorUtils.ts +216 -0
- package/src/utils/index.ts +21 -0
- package/src/utils/languageUtils.ts +174 -0
- package/src/utils/loggerUtils.ts +153 -0
- package/src/utils/platform.ts +117 -0
- package/src/utils/requestUtils.ts +237 -0
- package/src/utils/sessionUtils.ts +206 -0
- package/src/utils/validationUtils.ts +174 -0
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* OxyServices Shared Module
|
|
4
|
+
*
|
|
5
|
+
* Platform-agnostic utilities and helpers that work everywhere:
|
|
6
|
+
* - Browser (Web, Expo Web)
|
|
7
|
+
* - React Native (iOS, Android)
|
|
8
|
+
* - Node.js (Backend)
|
|
9
|
+
*
|
|
10
|
+
* This module contains NO React Native or browser-specific dependencies.
|
|
11
|
+
*
|
|
12
|
+
* @module shared
|
|
13
|
+
*
|
|
14
|
+
* @example
|
|
15
|
+
* ```ts
|
|
16
|
+
* import { darkenColor, normalizeTheme, withRetry } from '@oxyhq/services/shared';
|
|
17
|
+
*
|
|
18
|
+
* const darkBlue = darkenColor('#0066FF', 0.3);
|
|
19
|
+
* const theme = normalizeTheme(userPreference);
|
|
20
|
+
* const data = await withRetry(() => fetchData(), { maxRetries: 3 });
|
|
21
|
+
* ```
|
|
22
|
+
*/
|
|
23
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
24
|
+
exports.createDebugLogger = exports.debugError = exports.debugWarn = exports.debugLog = exports.isDev = exports.withRetry = exports.delay = exports.shouldAllowRequest = exports.recordSuccess = exports.recordFailure = exports.calculateBackoffInterval = exports.createCircuitBreakerState = exports.DEFAULT_CIRCUIT_BREAKER_CONFIG = exports.isRetryableError = exports.isNetworkError = exports.isServerError = exports.isRateLimitError = exports.isNotFoundError = exports.isForbiddenError = exports.isUnauthorizedError = exports.isAlreadyRegisteredError = exports.getErrorMessage = exports.getErrorStatus = exports.HttpStatus = exports.getSystemColorScheme = exports.systemPrefersDarkMode = exports.getOppositeTheme = exports.normalizeColorScheme = exports.normalizeTheme = exports.getContrastTextColor = exports.isLightColor = exports.withOpacity = exports.rgbToHex = exports.hexToRgb = exports.lightenColor = exports.darkenColor = void 0;
|
|
25
|
+
// Color utilities
|
|
26
|
+
var colorUtils_1 = require("./utils/colorUtils");
|
|
27
|
+
Object.defineProperty(exports, "darkenColor", { enumerable: true, get: function () { return colorUtils_1.darkenColor; } });
|
|
28
|
+
Object.defineProperty(exports, "lightenColor", { enumerable: true, get: function () { return colorUtils_1.lightenColor; } });
|
|
29
|
+
Object.defineProperty(exports, "hexToRgb", { enumerable: true, get: function () { return colorUtils_1.hexToRgb; } });
|
|
30
|
+
Object.defineProperty(exports, "rgbToHex", { enumerable: true, get: function () { return colorUtils_1.rgbToHex; } });
|
|
31
|
+
Object.defineProperty(exports, "withOpacity", { enumerable: true, get: function () { return colorUtils_1.withOpacity; } });
|
|
32
|
+
Object.defineProperty(exports, "isLightColor", { enumerable: true, get: function () { return colorUtils_1.isLightColor; } });
|
|
33
|
+
Object.defineProperty(exports, "getContrastTextColor", { enumerable: true, get: function () { return colorUtils_1.getContrastTextColor; } });
|
|
34
|
+
// Theme utilities
|
|
35
|
+
var themeUtils_1 = require("./utils/themeUtils");
|
|
36
|
+
Object.defineProperty(exports, "normalizeTheme", { enumerable: true, get: function () { return themeUtils_1.normalizeTheme; } });
|
|
37
|
+
Object.defineProperty(exports, "normalizeColorScheme", { enumerable: true, get: function () { return themeUtils_1.normalizeColorScheme; } });
|
|
38
|
+
Object.defineProperty(exports, "getOppositeTheme", { enumerable: true, get: function () { return themeUtils_1.getOppositeTheme; } });
|
|
39
|
+
Object.defineProperty(exports, "systemPrefersDarkMode", { enumerable: true, get: function () { return themeUtils_1.systemPrefersDarkMode; } });
|
|
40
|
+
Object.defineProperty(exports, "getSystemColorScheme", { enumerable: true, get: function () { return themeUtils_1.getSystemColorScheme; } });
|
|
41
|
+
// Error utilities
|
|
42
|
+
var errorUtils_1 = require("./utils/errorUtils");
|
|
43
|
+
Object.defineProperty(exports, "HttpStatus", { enumerable: true, get: function () { return errorUtils_1.HttpStatus; } });
|
|
44
|
+
Object.defineProperty(exports, "getErrorStatus", { enumerable: true, get: function () { return errorUtils_1.getErrorStatus; } });
|
|
45
|
+
Object.defineProperty(exports, "getErrorMessage", { enumerable: true, get: function () { return errorUtils_1.getErrorMessage; } });
|
|
46
|
+
Object.defineProperty(exports, "isAlreadyRegisteredError", { enumerable: true, get: function () { return errorUtils_1.isAlreadyRegisteredError; } });
|
|
47
|
+
Object.defineProperty(exports, "isUnauthorizedError", { enumerable: true, get: function () { return errorUtils_1.isUnauthorizedError; } });
|
|
48
|
+
Object.defineProperty(exports, "isForbiddenError", { enumerable: true, get: function () { return errorUtils_1.isForbiddenError; } });
|
|
49
|
+
Object.defineProperty(exports, "isNotFoundError", { enumerable: true, get: function () { return errorUtils_1.isNotFoundError; } });
|
|
50
|
+
Object.defineProperty(exports, "isRateLimitError", { enumerable: true, get: function () { return errorUtils_1.isRateLimitError; } });
|
|
51
|
+
Object.defineProperty(exports, "isServerError", { enumerable: true, get: function () { return errorUtils_1.isServerError; } });
|
|
52
|
+
Object.defineProperty(exports, "isNetworkError", { enumerable: true, get: function () { return errorUtils_1.isNetworkError; } });
|
|
53
|
+
Object.defineProperty(exports, "isRetryableError", { enumerable: true, get: function () { return errorUtils_1.isRetryableError; } });
|
|
54
|
+
// Network utilities
|
|
55
|
+
var networkUtils_1 = require("./utils/networkUtils");
|
|
56
|
+
Object.defineProperty(exports, "DEFAULT_CIRCUIT_BREAKER_CONFIG", { enumerable: true, get: function () { return networkUtils_1.DEFAULT_CIRCUIT_BREAKER_CONFIG; } });
|
|
57
|
+
Object.defineProperty(exports, "createCircuitBreakerState", { enumerable: true, get: function () { return networkUtils_1.createCircuitBreakerState; } });
|
|
58
|
+
Object.defineProperty(exports, "calculateBackoffInterval", { enumerable: true, get: function () { return networkUtils_1.calculateBackoffInterval; } });
|
|
59
|
+
Object.defineProperty(exports, "recordFailure", { enumerable: true, get: function () { return networkUtils_1.recordFailure; } });
|
|
60
|
+
Object.defineProperty(exports, "recordSuccess", { enumerable: true, get: function () { return networkUtils_1.recordSuccess; } });
|
|
61
|
+
Object.defineProperty(exports, "shouldAllowRequest", { enumerable: true, get: function () { return networkUtils_1.shouldAllowRequest; } });
|
|
62
|
+
Object.defineProperty(exports, "delay", { enumerable: true, get: function () { return networkUtils_1.delay; } });
|
|
63
|
+
Object.defineProperty(exports, "withRetry", { enumerable: true, get: function () { return networkUtils_1.withRetry; } });
|
|
64
|
+
// Debug utilities
|
|
65
|
+
var debugUtils_1 = require("./utils/debugUtils");
|
|
66
|
+
Object.defineProperty(exports, "isDev", { enumerable: true, get: function () { return debugUtils_1.isDev; } });
|
|
67
|
+
Object.defineProperty(exports, "debugLog", { enumerable: true, get: function () { return debugUtils_1.debugLog; } });
|
|
68
|
+
Object.defineProperty(exports, "debugWarn", { enumerable: true, get: function () { return debugUtils_1.debugWarn; } });
|
|
69
|
+
Object.defineProperty(exports, "debugError", { enumerable: true, get: function () { return debugUtils_1.debugError; } });
|
|
70
|
+
Object.defineProperty(exports, "createDebugLogger", { enumerable: true, get: function () { return debugUtils_1.createDebugLogger; } });
|
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Color Utility Functions
|
|
4
|
+
*
|
|
5
|
+
* Consolidated color manipulation utilities used across the OxyServices ecosystem.
|
|
6
|
+
* These functions work in any JavaScript environment (browser, Node.js, React Native).
|
|
7
|
+
*
|
|
8
|
+
* @module shared/utils/colorUtils
|
|
9
|
+
*/
|
|
10
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
11
|
+
exports.getContrastTextColor = exports.isLightColor = exports.withOpacity = exports.rgbToHex = exports.hexToRgb = exports.lightenColor = exports.darkenColor = void 0;
|
|
12
|
+
/**
|
|
13
|
+
* Darkens a hex color by a specified factor.
|
|
14
|
+
*
|
|
15
|
+
* @param color - Hex color string (with or without #)
|
|
16
|
+
* @param factor - Amount to darken (0-1). Default: 0.6
|
|
17
|
+
* @returns Darkened hex color string with # prefix
|
|
18
|
+
*
|
|
19
|
+
* @example
|
|
20
|
+
* ```ts
|
|
21
|
+
* darkenColor('#FF0000', 0.5); // Returns a darker red
|
|
22
|
+
* darkenColor('FF0000', 0.3); // Also works without #
|
|
23
|
+
* ```
|
|
24
|
+
*/
|
|
25
|
+
const darkenColor = (color, factor = 0.6) => {
|
|
26
|
+
const hex = color.replace('#', '');
|
|
27
|
+
const r = parseInt(hex.substring(0, 2), 16);
|
|
28
|
+
const g = parseInt(hex.substring(2, 4), 16);
|
|
29
|
+
const b = parseInt(hex.substring(4, 6), 16);
|
|
30
|
+
const newR = Math.max(0, Math.round(r * (1 - factor)));
|
|
31
|
+
const newG = Math.max(0, Math.round(g * (1 - factor)));
|
|
32
|
+
const newB = Math.max(0, Math.round(b * (1 - factor)));
|
|
33
|
+
return `#${newR.toString(16).padStart(2, '0')}${newG.toString(16).padStart(2, '0')}${newB.toString(16).padStart(2, '0')}`;
|
|
34
|
+
};
|
|
35
|
+
exports.darkenColor = darkenColor;
|
|
36
|
+
/**
|
|
37
|
+
* Lightens a hex color by a specified factor.
|
|
38
|
+
*
|
|
39
|
+
* @param color - Hex color string (with or without #)
|
|
40
|
+
* @param factor - Amount to lighten (0-1). Default: 0.3
|
|
41
|
+
* @returns Lightened hex color string with # prefix
|
|
42
|
+
*
|
|
43
|
+
* @example
|
|
44
|
+
* ```ts
|
|
45
|
+
* lightenColor('#0000FF', 0.5); // Returns a lighter blue
|
|
46
|
+
* ```
|
|
47
|
+
*/
|
|
48
|
+
const lightenColor = (color, factor = 0.3) => {
|
|
49
|
+
const hex = color.replace('#', '');
|
|
50
|
+
const r = parseInt(hex.substring(0, 2), 16);
|
|
51
|
+
const g = parseInt(hex.substring(2, 4), 16);
|
|
52
|
+
const b = parseInt(hex.substring(4, 6), 16);
|
|
53
|
+
const newR = Math.min(255, Math.round(r + (255 - r) * factor));
|
|
54
|
+
const newG = Math.min(255, Math.round(g + (255 - g) * factor));
|
|
55
|
+
const newB = Math.min(255, Math.round(b + (255 - b) * factor));
|
|
56
|
+
return `#${newR.toString(16).padStart(2, '0')}${newG.toString(16).padStart(2, '0')}${newB.toString(16).padStart(2, '0')}`;
|
|
57
|
+
};
|
|
58
|
+
exports.lightenColor = lightenColor;
|
|
59
|
+
/**
|
|
60
|
+
* Converts a hex color to RGB values.
|
|
61
|
+
*
|
|
62
|
+
* @param hex - Hex color string (with or without #)
|
|
63
|
+
* @returns Object with r, g, b values (0-255)
|
|
64
|
+
*
|
|
65
|
+
* @example
|
|
66
|
+
* ```ts
|
|
67
|
+
* hexToRgb('#FF5733'); // { r: 255, g: 87, b: 51 }
|
|
68
|
+
* ```
|
|
69
|
+
*/
|
|
70
|
+
const hexToRgb = (hex) => {
|
|
71
|
+
const result = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hex);
|
|
72
|
+
return result
|
|
73
|
+
? {
|
|
74
|
+
r: parseInt(result[1], 16),
|
|
75
|
+
g: parseInt(result[2], 16),
|
|
76
|
+
b: parseInt(result[3], 16),
|
|
77
|
+
}
|
|
78
|
+
: null;
|
|
79
|
+
};
|
|
80
|
+
exports.hexToRgb = hexToRgb;
|
|
81
|
+
/**
|
|
82
|
+
* Converts RGB values to a hex color string.
|
|
83
|
+
*
|
|
84
|
+
* @param r - Red value (0-255)
|
|
85
|
+
* @param g - Green value (0-255)
|
|
86
|
+
* @param b - Blue value (0-255)
|
|
87
|
+
* @returns Hex color string with # prefix
|
|
88
|
+
*
|
|
89
|
+
* @example
|
|
90
|
+
* ```ts
|
|
91
|
+
* rgbToHex(255, 87, 51); // '#ff5733'
|
|
92
|
+
* ```
|
|
93
|
+
*/
|
|
94
|
+
const rgbToHex = (r, g, b) => {
|
|
95
|
+
return `#${((1 << 24) + (r << 16) + (g << 8) + b).toString(16).slice(1)}`;
|
|
96
|
+
};
|
|
97
|
+
exports.rgbToHex = rgbToHex;
|
|
98
|
+
/**
|
|
99
|
+
* Adjusts the opacity of a hex color, returning an rgba string.
|
|
100
|
+
*
|
|
101
|
+
* @param hex - Hex color string
|
|
102
|
+
* @param opacity - Opacity value (0-1)
|
|
103
|
+
* @returns RGBA color string
|
|
104
|
+
*
|
|
105
|
+
* @example
|
|
106
|
+
* ```ts
|
|
107
|
+
* withOpacity('#FF0000', 0.5); // 'rgba(255, 0, 0, 0.5)'
|
|
108
|
+
* ```
|
|
109
|
+
*/
|
|
110
|
+
const withOpacity = (hex, opacity) => {
|
|
111
|
+
const rgb = (0, exports.hexToRgb)(hex);
|
|
112
|
+
if (!rgb)
|
|
113
|
+
return hex;
|
|
114
|
+
return `rgba(${rgb.r}, ${rgb.g}, ${rgb.b}, ${opacity})`;
|
|
115
|
+
};
|
|
116
|
+
exports.withOpacity = withOpacity;
|
|
117
|
+
/**
|
|
118
|
+
* Checks if a color is considered "light" (for determining text contrast).
|
|
119
|
+
*
|
|
120
|
+
* @param hex - Hex color string
|
|
121
|
+
* @returns true if the color is light, false if dark
|
|
122
|
+
*
|
|
123
|
+
* @example
|
|
124
|
+
* ```ts
|
|
125
|
+
* isLightColor('#FFFFFF'); // true
|
|
126
|
+
* isLightColor('#000000'); // false
|
|
127
|
+
* ```
|
|
128
|
+
*/
|
|
129
|
+
const isLightColor = (hex) => {
|
|
130
|
+
const rgb = (0, exports.hexToRgb)(hex);
|
|
131
|
+
if (!rgb)
|
|
132
|
+
return true;
|
|
133
|
+
// Using relative luminance formula
|
|
134
|
+
const luminance = (0.299 * rgb.r + 0.587 * rgb.g + 0.114 * rgb.b) / 255;
|
|
135
|
+
return luminance > 0.5;
|
|
136
|
+
};
|
|
137
|
+
exports.isLightColor = isLightColor;
|
|
138
|
+
/**
|
|
139
|
+
* Gets a contrasting text color (black or white) for a given background color.
|
|
140
|
+
*
|
|
141
|
+
* @param backgroundColor - Hex color string of the background
|
|
142
|
+
* @returns '#000000' for light backgrounds, '#ffffff' for dark backgrounds
|
|
143
|
+
*
|
|
144
|
+
* @example
|
|
145
|
+
* ```ts
|
|
146
|
+
* getContrastTextColor('#FFFF00'); // '#000000' (black text on yellow)
|
|
147
|
+
* getContrastTextColor('#000080'); // '#ffffff' (white text on navy)
|
|
148
|
+
* ```
|
|
149
|
+
*/
|
|
150
|
+
const getContrastTextColor = (backgroundColor) => {
|
|
151
|
+
return (0, exports.isLightColor)(backgroundColor) ? '#000000' : '#ffffff';
|
|
152
|
+
};
|
|
153
|
+
exports.getContrastTextColor = getContrastTextColor;
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Debug Utilities
|
|
4
|
+
*
|
|
5
|
+
* Provides safe logging functions that only output in development mode.
|
|
6
|
+
* All logs are stripped in production builds.
|
|
7
|
+
*
|
|
8
|
+
* @module shared/utils/debugUtils
|
|
9
|
+
*/
|
|
10
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
11
|
+
exports.createDebugLogger = exports.debugError = exports.debugWarn = exports.debugLog = exports.isDev = void 0;
|
|
12
|
+
/**
|
|
13
|
+
* Check if running in development mode
|
|
14
|
+
*/
|
|
15
|
+
const isDev = () => {
|
|
16
|
+
return typeof __DEV__ !== 'undefined' && __DEV__;
|
|
17
|
+
};
|
|
18
|
+
exports.isDev = isDev;
|
|
19
|
+
/**
|
|
20
|
+
* Log a debug message (only in development)
|
|
21
|
+
* @param prefix - Log prefix (e.g., '[FedCM]')
|
|
22
|
+
* @param args - Arguments to log
|
|
23
|
+
*/
|
|
24
|
+
const debugLog = (prefix, ...args) => {
|
|
25
|
+
if ((0, exports.isDev)()) {
|
|
26
|
+
console.log(prefix, ...args);
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
exports.debugLog = debugLog;
|
|
30
|
+
/**
|
|
31
|
+
* Log a debug warning (only in development)
|
|
32
|
+
* @param prefix - Log prefix
|
|
33
|
+
* @param args - Arguments to log
|
|
34
|
+
*/
|
|
35
|
+
const debugWarn = (prefix, ...args) => {
|
|
36
|
+
if ((0, exports.isDev)()) {
|
|
37
|
+
console.warn(prefix, ...args);
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
exports.debugWarn = debugWarn;
|
|
41
|
+
/**
|
|
42
|
+
* Log a debug error (only in development)
|
|
43
|
+
* @param prefix - Log prefix
|
|
44
|
+
* @param args - Arguments to log
|
|
45
|
+
*/
|
|
46
|
+
const debugError = (prefix, ...args) => {
|
|
47
|
+
if ((0, exports.isDev)()) {
|
|
48
|
+
console.error(prefix, ...args);
|
|
49
|
+
}
|
|
50
|
+
};
|
|
51
|
+
exports.debugError = debugError;
|
|
52
|
+
/**
|
|
53
|
+
* Create a namespaced debug logger
|
|
54
|
+
* @param namespace - Logger namespace (e.g., 'FedCM', 'PopupAuth')
|
|
55
|
+
* @returns Object with log, warn, error methods
|
|
56
|
+
*
|
|
57
|
+
* @example
|
|
58
|
+
* ```ts
|
|
59
|
+
* const debug = createDebugLogger('FedCM');
|
|
60
|
+
* debug.log('Starting authentication');
|
|
61
|
+
* debug.warn('Token expires soon');
|
|
62
|
+
* debug.error('Authentication failed', error);
|
|
63
|
+
* ```
|
|
64
|
+
*/
|
|
65
|
+
const createDebugLogger = (namespace) => {
|
|
66
|
+
const prefix = `[${namespace}]`;
|
|
67
|
+
return {
|
|
68
|
+
log: (...args) => (0, exports.debugLog)(prefix, ...args),
|
|
69
|
+
warn: (...args) => (0, exports.debugWarn)(prefix, ...args),
|
|
70
|
+
error: (...args) => (0, exports.debugError)(prefix, ...args),
|
|
71
|
+
};
|
|
72
|
+
};
|
|
73
|
+
exports.createDebugLogger = createDebugLogger;
|
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Error Utility Functions
|
|
4
|
+
*
|
|
5
|
+
* Consolidated error handling utilities for the OxyServices ecosystem.
|
|
6
|
+
* These functions help with common error patterns like checking HTTP status codes.
|
|
7
|
+
*
|
|
8
|
+
* @module shared/utils/errorUtils
|
|
9
|
+
*/
|
|
10
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
11
|
+
exports.isRetryableError = exports.isNetworkError = exports.isServerError = exports.isRateLimitError = exports.isNotFoundError = exports.isForbiddenError = exports.isUnauthorizedError = exports.isAlreadyRegisteredError = exports.getErrorMessage = exports.getErrorStatus = exports.HttpStatus = void 0;
|
|
12
|
+
/**
|
|
13
|
+
* Common HTTP status codes used in error checking.
|
|
14
|
+
*/
|
|
15
|
+
exports.HttpStatus = {
|
|
16
|
+
BAD_REQUEST: 400,
|
|
17
|
+
UNAUTHORIZED: 401,
|
|
18
|
+
FORBIDDEN: 403,
|
|
19
|
+
NOT_FOUND: 404,
|
|
20
|
+
CONFLICT: 409,
|
|
21
|
+
UNPROCESSABLE_ENTITY: 422,
|
|
22
|
+
TOO_MANY_REQUESTS: 429,
|
|
23
|
+
INTERNAL_SERVER_ERROR: 500,
|
|
24
|
+
BAD_GATEWAY: 502,
|
|
25
|
+
SERVICE_UNAVAILABLE: 503,
|
|
26
|
+
GATEWAY_TIMEOUT: 504,
|
|
27
|
+
};
|
|
28
|
+
/**
|
|
29
|
+
* Extracts the HTTP status code from an error object.
|
|
30
|
+
*
|
|
31
|
+
* @param error - Any error object
|
|
32
|
+
* @returns The status code if found, undefined otherwise
|
|
33
|
+
*/
|
|
34
|
+
const getErrorStatus = (error) => {
|
|
35
|
+
if (!error || typeof error !== 'object')
|
|
36
|
+
return undefined;
|
|
37
|
+
const err = error;
|
|
38
|
+
// Direct status property
|
|
39
|
+
if (typeof err.status === 'number')
|
|
40
|
+
return err.status;
|
|
41
|
+
// Axios-style response.status
|
|
42
|
+
if (err.response && typeof err.response === 'object') {
|
|
43
|
+
const response = err.response;
|
|
44
|
+
if (typeof response.status === 'number')
|
|
45
|
+
return response.status;
|
|
46
|
+
}
|
|
47
|
+
// statusCode property (some libraries use this)
|
|
48
|
+
if (typeof err.statusCode === 'number')
|
|
49
|
+
return err.statusCode;
|
|
50
|
+
return undefined;
|
|
51
|
+
};
|
|
52
|
+
exports.getErrorStatus = getErrorStatus;
|
|
53
|
+
/**
|
|
54
|
+
* Extracts the error message from an error object.
|
|
55
|
+
*
|
|
56
|
+
* @param error - Any error object
|
|
57
|
+
* @param fallback - Fallback message if none found
|
|
58
|
+
* @returns The error message
|
|
59
|
+
*/
|
|
60
|
+
const getErrorMessage = (error, fallback = 'An unknown error occurred') => {
|
|
61
|
+
if (!error)
|
|
62
|
+
return fallback;
|
|
63
|
+
if (typeof error === 'string')
|
|
64
|
+
return error;
|
|
65
|
+
if (error instanceof Error)
|
|
66
|
+
return error.message;
|
|
67
|
+
if (typeof error === 'object') {
|
|
68
|
+
const err = error;
|
|
69
|
+
if (typeof err.message === 'string')
|
|
70
|
+
return err.message;
|
|
71
|
+
if (typeof err.error === 'string')
|
|
72
|
+
return err.error;
|
|
73
|
+
// Axios-style response.data.message
|
|
74
|
+
if (err.response && typeof err.response === 'object') {
|
|
75
|
+
const response = err.response;
|
|
76
|
+
if (response.data && typeof response.data === 'object') {
|
|
77
|
+
const data = response.data;
|
|
78
|
+
if (typeof data.message === 'string')
|
|
79
|
+
return data.message;
|
|
80
|
+
if (typeof data.error === 'string')
|
|
81
|
+
return data.error;
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
return fallback;
|
|
86
|
+
};
|
|
87
|
+
exports.getErrorMessage = getErrorMessage;
|
|
88
|
+
/**
|
|
89
|
+
* Check if an error indicates the user is already registered (HTTP 409 Conflict).
|
|
90
|
+
*
|
|
91
|
+
* The backend should always return HTTP 409 for duplicate registrations.
|
|
92
|
+
*
|
|
93
|
+
* @param error - Any error object
|
|
94
|
+
* @returns true if the error is a 409 Conflict
|
|
95
|
+
*/
|
|
96
|
+
const isAlreadyRegisteredError = (error) => {
|
|
97
|
+
return (0, exports.getErrorStatus)(error) === exports.HttpStatus.CONFLICT;
|
|
98
|
+
};
|
|
99
|
+
exports.isAlreadyRegisteredError = isAlreadyRegisteredError;
|
|
100
|
+
/**
|
|
101
|
+
* Check if an error is an authentication error (HTTP 401).
|
|
102
|
+
*
|
|
103
|
+
* @param error - Any error object
|
|
104
|
+
* @returns true if the error is a 401 Unauthorized
|
|
105
|
+
*/
|
|
106
|
+
const isUnauthorizedError = (error) => {
|
|
107
|
+
return (0, exports.getErrorStatus)(error) === exports.HttpStatus.UNAUTHORIZED;
|
|
108
|
+
};
|
|
109
|
+
exports.isUnauthorizedError = isUnauthorizedError;
|
|
110
|
+
/**
|
|
111
|
+
* Check if an error is a forbidden error (HTTP 403).
|
|
112
|
+
*
|
|
113
|
+
* @param error - Any error object
|
|
114
|
+
* @returns true if the error is a 403 Forbidden
|
|
115
|
+
*/
|
|
116
|
+
const isForbiddenError = (error) => {
|
|
117
|
+
return (0, exports.getErrorStatus)(error) === exports.HttpStatus.FORBIDDEN;
|
|
118
|
+
};
|
|
119
|
+
exports.isForbiddenError = isForbiddenError;
|
|
120
|
+
/**
|
|
121
|
+
* Check if an error is a not found error (HTTP 404).
|
|
122
|
+
*
|
|
123
|
+
* @param error - Any error object
|
|
124
|
+
* @returns true if the error is a 404 Not Found
|
|
125
|
+
*/
|
|
126
|
+
const isNotFoundError = (error) => {
|
|
127
|
+
return (0, exports.getErrorStatus)(error) === exports.HttpStatus.NOT_FOUND;
|
|
128
|
+
};
|
|
129
|
+
exports.isNotFoundError = isNotFoundError;
|
|
130
|
+
/**
|
|
131
|
+
* Check if an error is a rate limit error (HTTP 429).
|
|
132
|
+
*
|
|
133
|
+
* @param error - Any error object
|
|
134
|
+
* @returns true if the error is a 429 Too Many Requests
|
|
135
|
+
*/
|
|
136
|
+
const isRateLimitError = (error) => {
|
|
137
|
+
return (0, exports.getErrorStatus)(error) === exports.HttpStatus.TOO_MANY_REQUESTS;
|
|
138
|
+
};
|
|
139
|
+
exports.isRateLimitError = isRateLimitError;
|
|
140
|
+
/**
|
|
141
|
+
* Check if an error is a server error (HTTP 5xx).
|
|
142
|
+
*
|
|
143
|
+
* @param error - Any error object
|
|
144
|
+
* @returns true if the error is a 5xx server error
|
|
145
|
+
*/
|
|
146
|
+
const isServerError = (error) => {
|
|
147
|
+
const status = (0, exports.getErrorStatus)(error);
|
|
148
|
+
return status !== undefined && status >= 500 && status < 600;
|
|
149
|
+
};
|
|
150
|
+
exports.isServerError = isServerError;
|
|
151
|
+
/**
|
|
152
|
+
* Check if an error is a network error (no response received).
|
|
153
|
+
*
|
|
154
|
+
* @param error - Any error object
|
|
155
|
+
* @returns true if the error appears to be a network error
|
|
156
|
+
*/
|
|
157
|
+
const isNetworkError = (error) => {
|
|
158
|
+
if (!error || typeof error !== 'object')
|
|
159
|
+
return false;
|
|
160
|
+
const err = error;
|
|
161
|
+
// Check for common network error indicators
|
|
162
|
+
if (err.name === 'NetworkError')
|
|
163
|
+
return true;
|
|
164
|
+
if (err.code === 'ENOTFOUND' || err.code === 'ECONNREFUSED' || err.code === 'ETIMEDOUT')
|
|
165
|
+
return true;
|
|
166
|
+
// Axios-style: has request but no response
|
|
167
|
+
if (err.request && !err.response)
|
|
168
|
+
return true;
|
|
169
|
+
// Message-based detection
|
|
170
|
+
const message = (0, exports.getErrorMessage)(error, '').toLowerCase();
|
|
171
|
+
return message.includes('network') || message.includes('connection') || message.includes('timeout');
|
|
172
|
+
};
|
|
173
|
+
exports.isNetworkError = isNetworkError;
|
|
174
|
+
/**
|
|
175
|
+
* Check if an error is retryable (network errors or 5xx server errors).
|
|
176
|
+
*
|
|
177
|
+
* @param error - Any error object
|
|
178
|
+
* @returns true if the request should be retried
|
|
179
|
+
*/
|
|
180
|
+
const isRetryableError = (error) => {
|
|
181
|
+
return (0, exports.isNetworkError)(error) || (0, exports.isServerError)(error) || (0, exports.isRateLimitError)(error);
|
|
182
|
+
};
|
|
183
|
+
exports.isRetryableError = isRetryableError;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Shared Utility Functions
|
|
4
|
+
*
|
|
5
|
+
* Re-exports all shared utilities for convenient importing.
|
|
6
|
+
*
|
|
7
|
+
* @module shared/utils
|
|
8
|
+
*/
|
|
9
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
+
exports.withRetry = exports.delay = exports.shouldAllowRequest = exports.recordSuccess = exports.recordFailure = exports.calculateBackoffInterval = exports.createCircuitBreakerState = exports.DEFAULT_CIRCUIT_BREAKER_CONFIG = exports.isRetryableError = exports.isNetworkError = exports.isServerError = exports.isRateLimitError = exports.isNotFoundError = exports.isForbiddenError = exports.isUnauthorizedError = exports.isAlreadyRegisteredError = exports.getErrorMessage = exports.getErrorStatus = exports.HttpStatus = exports.getSystemColorScheme = exports.systemPrefersDarkMode = exports.getOppositeTheme = exports.normalizeColorScheme = exports.normalizeTheme = exports.getContrastTextColor = exports.isLightColor = exports.withOpacity = exports.rgbToHex = exports.hexToRgb = exports.lightenColor = exports.darkenColor = void 0;
|
|
11
|
+
// Color utilities
|
|
12
|
+
var colorUtils_1 = require("./colorUtils");
|
|
13
|
+
Object.defineProperty(exports, "darkenColor", { enumerable: true, get: function () { return colorUtils_1.darkenColor; } });
|
|
14
|
+
Object.defineProperty(exports, "lightenColor", { enumerable: true, get: function () { return colorUtils_1.lightenColor; } });
|
|
15
|
+
Object.defineProperty(exports, "hexToRgb", { enumerable: true, get: function () { return colorUtils_1.hexToRgb; } });
|
|
16
|
+
Object.defineProperty(exports, "rgbToHex", { enumerable: true, get: function () { return colorUtils_1.rgbToHex; } });
|
|
17
|
+
Object.defineProperty(exports, "withOpacity", { enumerable: true, get: function () { return colorUtils_1.withOpacity; } });
|
|
18
|
+
Object.defineProperty(exports, "isLightColor", { enumerable: true, get: function () { return colorUtils_1.isLightColor; } });
|
|
19
|
+
Object.defineProperty(exports, "getContrastTextColor", { enumerable: true, get: function () { return colorUtils_1.getContrastTextColor; } });
|
|
20
|
+
// Theme utilities
|
|
21
|
+
var themeUtils_1 = require("./themeUtils");
|
|
22
|
+
Object.defineProperty(exports, "normalizeTheme", { enumerable: true, get: function () { return themeUtils_1.normalizeTheme; } });
|
|
23
|
+
Object.defineProperty(exports, "normalizeColorScheme", { enumerable: true, get: function () { return themeUtils_1.normalizeColorScheme; } });
|
|
24
|
+
Object.defineProperty(exports, "getOppositeTheme", { enumerable: true, get: function () { return themeUtils_1.getOppositeTheme; } });
|
|
25
|
+
Object.defineProperty(exports, "systemPrefersDarkMode", { enumerable: true, get: function () { return themeUtils_1.systemPrefersDarkMode; } });
|
|
26
|
+
Object.defineProperty(exports, "getSystemColorScheme", { enumerable: true, get: function () { return themeUtils_1.getSystemColorScheme; } });
|
|
27
|
+
// Error utilities
|
|
28
|
+
var errorUtils_1 = require("./errorUtils");
|
|
29
|
+
Object.defineProperty(exports, "HttpStatus", { enumerable: true, get: function () { return errorUtils_1.HttpStatus; } });
|
|
30
|
+
Object.defineProperty(exports, "getErrorStatus", { enumerable: true, get: function () { return errorUtils_1.getErrorStatus; } });
|
|
31
|
+
Object.defineProperty(exports, "getErrorMessage", { enumerable: true, get: function () { return errorUtils_1.getErrorMessage; } });
|
|
32
|
+
Object.defineProperty(exports, "isAlreadyRegisteredError", { enumerable: true, get: function () { return errorUtils_1.isAlreadyRegisteredError; } });
|
|
33
|
+
Object.defineProperty(exports, "isUnauthorizedError", { enumerable: true, get: function () { return errorUtils_1.isUnauthorizedError; } });
|
|
34
|
+
Object.defineProperty(exports, "isForbiddenError", { enumerable: true, get: function () { return errorUtils_1.isForbiddenError; } });
|
|
35
|
+
Object.defineProperty(exports, "isNotFoundError", { enumerable: true, get: function () { return errorUtils_1.isNotFoundError; } });
|
|
36
|
+
Object.defineProperty(exports, "isRateLimitError", { enumerable: true, get: function () { return errorUtils_1.isRateLimitError; } });
|
|
37
|
+
Object.defineProperty(exports, "isServerError", { enumerable: true, get: function () { return errorUtils_1.isServerError; } });
|
|
38
|
+
Object.defineProperty(exports, "isNetworkError", { enumerable: true, get: function () { return errorUtils_1.isNetworkError; } });
|
|
39
|
+
Object.defineProperty(exports, "isRetryableError", { enumerable: true, get: function () { return errorUtils_1.isRetryableError; } });
|
|
40
|
+
// Network utilities
|
|
41
|
+
var networkUtils_1 = require("./networkUtils");
|
|
42
|
+
Object.defineProperty(exports, "DEFAULT_CIRCUIT_BREAKER_CONFIG", { enumerable: true, get: function () { return networkUtils_1.DEFAULT_CIRCUIT_BREAKER_CONFIG; } });
|
|
43
|
+
Object.defineProperty(exports, "createCircuitBreakerState", { enumerable: true, get: function () { return networkUtils_1.createCircuitBreakerState; } });
|
|
44
|
+
Object.defineProperty(exports, "calculateBackoffInterval", { enumerable: true, get: function () { return networkUtils_1.calculateBackoffInterval; } });
|
|
45
|
+
Object.defineProperty(exports, "recordFailure", { enumerable: true, get: function () { return networkUtils_1.recordFailure; } });
|
|
46
|
+
Object.defineProperty(exports, "recordSuccess", { enumerable: true, get: function () { return networkUtils_1.recordSuccess; } });
|
|
47
|
+
Object.defineProperty(exports, "shouldAllowRequest", { enumerable: true, get: function () { return networkUtils_1.shouldAllowRequest; } });
|
|
48
|
+
Object.defineProperty(exports, "delay", { enumerable: true, get: function () { return networkUtils_1.delay; } });
|
|
49
|
+
Object.defineProperty(exports, "withRetry", { enumerable: true, get: function () { return networkUtils_1.withRetry; } });
|