@withwiz/toolkit 0.1.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 +162 -0
- package/dist/auth/adapters/prisma/index.d.ts +43 -0
- package/dist/auth/adapters/prisma/index.js +284 -0
- package/dist/auth/core/email/token-generator.d.ts +43 -0
- package/dist/auth/core/email/token-generator.js +7 -0
- package/dist/auth/core/jwt/client.d.ts +87 -0
- package/dist/auth/core/jwt/client.js +36 -0
- package/dist/auth/core/jwt/index.d.ts +110 -0
- package/dist/auth/core/jwt/index.js +10 -0
- package/dist/auth/core/jwt/types.d.ts +6 -0
- package/dist/auth/core/jwt/types.js +13 -0
- package/dist/auth/core/oauth/index.d.ts +51 -0
- package/dist/auth/core/oauth/index.js +12 -0
- package/dist/auth/core/password/client-helper.d.ts +44 -0
- package/dist/auth/core/password/client-helper.js +28 -0
- package/dist/auth/core/password/index.d.ts +71 -0
- package/dist/auth/core/password/index.js +14 -0
- package/dist/auth/errors/index.d.ts +49 -0
- package/dist/auth/errors/index.js +17 -0
- package/dist/auth/index.d.ts +21 -0
- package/dist/auth/index.js +97 -0
- package/dist/auth/types/index.d.ts +213 -0
- package/dist/auth/types/index.js +13 -0
- package/dist/cache/cache-config.d.ts +73 -0
- package/dist/cache/cache-config.js +12 -0
- package/dist/cache/cache-defaults.d.ts +141 -0
- package/dist/cache/cache-defaults.js +33 -0
- package/dist/cache/cache-env.d.ts +75 -0
- package/dist/cache/cache-env.js +25 -0
- package/dist/cache/cache-factory.d.ts +34 -0
- package/dist/cache/cache-factory.js +28 -0
- package/dist/cache/cache-invalidation.d.ts +90 -0
- package/dist/cache/cache-invalidation.js +24 -0
- package/dist/cache/cache-keys-legacy.d.ts +35 -0
- package/dist/cache/cache-keys-legacy.js +7 -0
- package/dist/cache/cache-redis.d.ts +74 -0
- package/dist/cache/cache-redis.js +24 -0
- package/dist/cache/cache-types.d.ts +151 -0
- package/dist/cache/cache-types.js +9 -0
- package/dist/cache/cache-wrapper.d.ts +27 -0
- package/dist/cache/cache-wrapper.js +22 -0
- package/dist/cache/cache.d.ts +14 -0
- package/dist/cache/cache.js +112 -0
- package/dist/cache/hybrid-cache-manager.d.ts +148 -0
- package/dist/cache/hybrid-cache-manager.js +13 -0
- package/dist/cache/index.d.ts +21 -0
- package/dist/cache/index.js +112 -0
- package/dist/cache/inmemory-cache-manager.d.ts +163 -0
- package/dist/cache/inmemory-cache-manager.js +9 -0
- package/dist/cache/noop-cache-manager.d.ts +36 -0
- package/dist/cache/noop-cache-manager.js +11 -0
- package/dist/cache/redis-cache-manager.d.ts +34 -0
- package/dist/cache/redis-cache-manager.js +11 -0
- package/dist/chunk-26Y7VEYG.js +93 -0
- package/dist/chunk-2DVWSDST.js +119 -0
- package/dist/chunk-2KAPUVIS.js +155 -0
- package/dist/chunk-2TO7WUKK.js +93 -0
- package/dist/chunk-34WAGUT5.js +117 -0
- package/dist/chunk-3DZA6AGS.js +120 -0
- package/dist/chunk-4DPSCTX4.js +212 -0
- package/dist/chunk-4KJXENRM.js +64 -0
- package/dist/chunk-4NWJ3WCZ.js +28 -0
- package/dist/chunk-4ODT3Q4A.js +86 -0
- package/dist/chunk-5ATB5D6S.js +40 -0
- package/dist/chunk-62FLBG6B.js +34 -0
- package/dist/chunk-62Q7DN5G.js +25 -0
- package/dist/chunk-65LHDFU3.js +242 -0
- package/dist/chunk-6C7HQIX4.js +13 -0
- package/dist/chunk-6D3HHYER.js +32 -0
- package/dist/chunk-6LTZCXNC.js +326 -0
- package/dist/chunk-7VJNLGAS.js +110 -0
- package/dist/chunk-7XFHGAJP.js +0 -0
- package/dist/chunk-A6EAAWMK.js +50 -0
- package/dist/chunk-AHDPGRXS.js +51 -0
- package/dist/chunk-AIH3F7JV.js +76 -0
- package/dist/chunk-AIHQBQ3E.js +109 -0
- package/dist/chunk-BKGVSC6S.js +152 -0
- package/dist/chunk-COK4ZXNG.js +0 -0
- package/dist/chunk-DEEJBDJE.js +47 -0
- package/dist/chunk-DH2ZHGW2.js +53 -0
- package/dist/chunk-EBUEBEJX.js +0 -0
- package/dist/chunk-EEUBKZV4.js +54 -0
- package/dist/chunk-EQYTE7WD.js +139 -0
- package/dist/chunk-EUQATJLI.js +180 -0
- package/dist/chunk-EZC6ETFW.js +80 -0
- package/dist/chunk-EZR55KV2.js +249 -0
- package/dist/chunk-F6LCSFSU.js +31 -0
- package/dist/chunk-FOKAATUQ.js +62 -0
- package/dist/chunk-FW3IEJ7H.js +71 -0
- package/dist/chunk-G26T2PRQ.js +53 -0
- package/dist/chunk-G4NI37NN.js +257 -0
- package/dist/chunk-GCZOXUDV.js +132 -0
- package/dist/chunk-GDWEDUHO.js +55 -0
- package/dist/chunk-GL2NANFH.js +434 -0
- package/dist/chunk-GPBOMJSZ.js +136 -0
- package/dist/chunk-H5I5GWAA.js +94 -0
- package/dist/chunk-HGC4CCKB.js +29 -0
- package/dist/chunk-HV3DGSSH.js +447 -0
- package/dist/chunk-I47QEDTX.js +193 -0
- package/dist/chunk-IAJNC34M.js +102 -0
- package/dist/chunk-IHXRF3BH.js +215 -0
- package/dist/chunk-IJEZ7G7S.js +26 -0
- package/dist/chunk-IQQKKUAV.js +151 -0
- package/dist/chunk-JBCDEAMW.js +35 -0
- package/dist/chunk-JLLMTTQ4.js +75 -0
- package/dist/chunk-JS5VI3OW.js +143 -0
- package/dist/chunk-KAWVMIRJ.js +44 -0
- package/dist/chunk-KMCJIL57.js +214 -0
- package/dist/chunk-KWTBD4CM.js +145 -0
- package/dist/chunk-KXAWBFJN.js +310 -0
- package/dist/chunk-L25BNU3E.js +56 -0
- package/dist/chunk-L76O3X3D.js +197 -0
- package/dist/chunk-LNV2E4I6.js +63 -0
- package/dist/chunk-MLGO3HLS.js +329 -0
- package/dist/chunk-MRJE6OX5.js +22 -0
- package/dist/chunk-MYLGYX4K.js +57 -0
- package/dist/chunk-N4YGR5WH.js +310 -0
- package/dist/chunk-OIVXOT2X.js +80 -0
- package/dist/chunk-ORMEWXMH.js +37 -0
- package/dist/chunk-POKGHK3L.js +57 -0
- package/dist/chunk-Q7IP4JMW.js +69 -0
- package/dist/chunk-RJUVBBZG.js +27 -0
- package/dist/chunk-S73334QY.js +89 -0
- package/dist/chunk-SLG26KHZ.js +101 -0
- package/dist/chunk-SR65BF6X.js +82 -0
- package/dist/chunk-SS56XFLI.js +19 -0
- package/dist/chunk-T3LJYAMO.js +277 -0
- package/dist/chunk-TDZJ6SAI.js +34 -0
- package/dist/chunk-TEIYA7U4.js +72 -0
- package/dist/chunk-TMVS4F7E.js +88 -0
- package/dist/chunk-TRBKJ7JT.js +137 -0
- package/dist/chunk-TXGNSECL.js +84 -0
- package/dist/chunk-TZAP5T4N.js +188 -0
- package/dist/chunk-UCYQNHST.js +24 -0
- package/dist/chunk-ULF5RDDX.js +0 -0
- package/dist/chunk-UXQRU3EM.js +167 -0
- package/dist/chunk-V5K5FYU7.js +200 -0
- package/dist/chunk-VDXB5DCY.js +68 -0
- package/dist/chunk-VSGKVZB4.js +47 -0
- package/dist/chunk-VWODEQ5C.js +204 -0
- package/dist/chunk-WDUFQFDP.js +193 -0
- package/dist/chunk-WHR7HPWF.js +126 -0
- package/dist/chunk-WSQMXMTL.js +122 -0
- package/dist/chunk-XHZ5L4FO.js +103 -0
- package/dist/chunk-XPASCCUA.js +404 -0
- package/dist/chunk-XRRPEBKB.js +231 -0
- package/dist/chunk-Y2TUZFCP.js +0 -0
- package/dist/chunk-Y3OTJH2S.js +473 -0
- package/dist/chunk-YBSHN67U.js +161 -0
- package/dist/chunk-YJ3TLEW3.js +100 -0
- package/dist/chunk-YJWLWUFK.js +105 -0
- package/dist/chunk-Z4D4CMDA.js +488 -0
- package/dist/chunk-ZHVUK5OY.js +314 -0
- package/dist/chunk-ZTN4X5FN.js +29 -0
- package/dist/chunk-ZZIKRBJU.js +96 -0
- package/dist/components/ui/Alert.d.ts +12 -0
- package/dist/components/ui/Alert.js +10 -0
- package/dist/components/ui/Badge.d.ts +7 -0
- package/dist/components/ui/Badge.js +8 -0
- package/dist/components/ui/Button.d.ts +7 -0
- package/dist/components/ui/Button.js +8 -0
- package/dist/components/ui/DataTable.d.ts +103 -0
- package/dist/components/ui/DataTable.js +606 -0
- package/dist/components/ui/DomainDisplay.d.ts +12 -0
- package/dist/components/ui/DomainDisplay.js +31 -0
- package/dist/components/ui/Input.d.ts +5 -0
- package/dist/components/ui/Input.js +8 -0
- package/dist/components/ui/Label.d.ts +5 -0
- package/dist/components/ui/Label.js +8 -0
- package/dist/components/ui/Pagination.d.ts +42 -0
- package/dist/components/ui/Pagination.js +20 -0
- package/dist/components/ui/Select.d.ts +15 -0
- package/dist/components/ui/Select.js +27 -0
- package/dist/components/ui/Skeleton.d.ts +6 -0
- package/dist/components/ui/Skeleton.js +8 -0
- package/dist/components/ui/TimezoneDisplay.d.ts +22 -0
- package/dist/components/ui/TimezoneDisplay.js +83 -0
- package/dist/components/ui/Tooltip.d.ts +21 -0
- package/dist/components/ui/Tooltip.js +94 -0
- package/dist/components/ui/WorldMapChart.d.ts +17 -0
- package/dist/components/ui/WorldMapChart.js +250 -0
- package/dist/components/ui/loading-bar.d.ts +20 -0
- package/dist/components/ui/loading-bar.js +15 -0
- package/dist/constants/error-codes.d.ts +389 -0
- package/dist/constants/error-codes.js +27 -0
- package/dist/constants/index.d.ts +11 -0
- package/dist/constants/index.js +85 -0
- package/dist/constants/messages.d.ts +83 -0
- package/dist/constants/messages.js +13 -0
- package/dist/constants/pagination.d.ts +43 -0
- package/dist/constants/pagination.js +15 -0
- package/dist/constants/security.d.ts +66 -0
- package/dist/constants/security.js +23 -0
- package/dist/constants/validation.d.ts +60 -0
- package/dist/constants/validation.js +19 -0
- package/dist/error/ErrorBoundary.d.ts +47 -0
- package/dist/error/app-error.d.ts +144 -0
- package/dist/error/app-error.js +10 -0
- package/dist/error/components/EmptyState.d.ts +50 -0
- package/dist/error/components/ErrorAlert.d.ts +50 -0
- package/dist/error/components/ErrorPage.d.ts +39 -0
- package/dist/error/components/LoadingState.d.ts +37 -0
- package/dist/error/components/index.d.ts +13 -0
- package/dist/error/components/index.js +18 -0
- package/dist/error/core/locale-detector.d.ts +44 -0
- package/dist/error/core/locale-detector.js +9 -0
- package/dist/error/error-display.d.ts +55 -0
- package/dist/error/error-display.js +24 -0
- package/dist/error/error-handler.d.ts +118 -0
- package/dist/error/error-handler.js +18 -0
- package/dist/error/friendly-messages-v2.d.ts +46 -0
- package/dist/error/friendly-messages-v2.js +15 -0
- package/dist/error/friendly-messages.d.ts +22 -0
- package/dist/error/friendly-messages.js +12 -0
- package/dist/error/hooks/index.d.ts +7 -0
- package/dist/error/hooks/index.js +14 -0
- package/dist/error/hooks/useErrorHandler.d.ts +67 -0
- package/dist/error/hooks/useErrorHandler.js +14 -0
- package/dist/error/index.d.ts +26 -0
- package/dist/error/index.js +289 -0
- package/dist/error/logging/error-logger.d.ts +77 -0
- package/dist/error/logging/error-logger.js +10 -0
- package/dist/error/logging/index.d.ts +9 -0
- package/dist/error/logging/index.js +35 -0
- package/dist/error/logging/transports/base.d.ts +30 -0
- package/dist/error/logging/transports/base.js +7 -0
- package/dist/error/logging/transports/console.d.ts +40 -0
- package/dist/error/logging/transports/console.js +9 -0
- package/dist/error/logging/transports/file.d.ts +49 -0
- package/dist/error/logging/transports/file.js +8 -0
- package/dist/error/logging/transports/index.d.ts +12 -0
- package/dist/error/logging/transports/index.js +25 -0
- package/dist/error/logging/transports/sentry.d.ts +44 -0
- package/dist/error/logging/transports/sentry.js +9 -0
- package/dist/error/logging/transports/slack.d.ts +51 -0
- package/dist/error/logging/transports/slack.js +9 -0
- package/dist/error/logging/types.d.ts +83 -0
- package/dist/error/logging/types.js +7 -0
- package/dist/error/messages/en.d.ts +5 -0
- package/dist/error/messages/en.js +7 -0
- package/dist/error/messages/index.d.ts +40 -0
- package/dist/error/messages/index.js +17 -0
- package/dist/error/messages/ko.d.ts +5 -0
- package/dist/error/messages/ko.js +7 -0
- package/dist/error/messages/types.d.ts +30 -0
- package/dist/error/messages/types.js +0 -0
- package/dist/error/recovery/circuit-breaker.d.ts +85 -0
- package/dist/error/recovery/circuit-breaker.js +9 -0
- package/dist/error/recovery/degradation.d.ts +56 -0
- package/dist/error/recovery/degradation.js +7 -0
- package/dist/error/recovery/fallback.d.ts +55 -0
- package/dist/error/recovery/fallback.js +11 -0
- package/dist/error/recovery/index.d.ts +12 -0
- package/dist/error/recovery/index.js +26 -0
- package/dist/error/recovery/retry.d.ts +44 -0
- package/dist/error/recovery/retry.js +7 -0
- package/dist/geolocation/batch-processor.d.ts +33 -0
- package/dist/geolocation/batch-processor.js +10 -0
- package/dist/geolocation/index.d.ts +14 -0
- package/dist/geolocation/index.js +36 -0
- package/dist/geolocation/providers/base-provider.d.ts +33 -0
- package/dist/geolocation/providers/base-provider.js +9 -0
- package/dist/geolocation/providers/index.d.ts +54 -0
- package/dist/geolocation/providers/index.js +29 -0
- package/dist/geolocation/providers/ip-api-provider.d.ts +17 -0
- package/dist/geolocation/providers/ip-api-provider.js +8 -0
- package/dist/geolocation/providers/ipapi-co-provider.d.ts +17 -0
- package/dist/geolocation/providers/ipapi-co-provider.js +8 -0
- package/dist/geolocation/providers/ipgeolocation-provider.d.ts +18 -0
- package/dist/geolocation/providers/ipgeolocation-provider.js +8 -0
- package/dist/geolocation/providers/maxmind-provider.d.ts +18 -0
- package/dist/geolocation/providers/maxmind-provider.js +8 -0
- package/dist/hooks/useDataTable.d.ts +51 -0
- package/dist/hooks/useDataTable.js +149 -0
- package/dist/hooks/useDebounce.d.ts +7 -0
- package/dist/hooks/useDebounce.js +7 -0
- package/dist/hooks/useExitIntent.d.ts +35 -0
- package/dist/hooks/useExitIntent.js +72 -0
- package/dist/hooks/useTimezone.d.ts +19 -0
- package/dist/hooks/useTimezone.js +11 -0
- package/dist/logger/logger.d.ts +11 -0
- package/dist/logger/logger.js +17 -0
- package/dist/middleware/auth.d.ts +87 -0
- package/dist/middleware/auth.js +20 -0
- package/dist/middleware/cors.d.ts +30 -0
- package/dist/middleware/cors.js +10 -0
- package/dist/middleware/error-handler.d.ts +23 -0
- package/dist/middleware/error-handler.js +13 -0
- package/dist/middleware/index.d.ts +16 -0
- package/dist/middleware/index.js +72 -0
- package/dist/middleware/init-request.d.ts +18 -0
- package/dist/middleware/init-request.js +8 -0
- package/dist/middleware/middleware-chain.d.ts +53 -0
- package/dist/middleware/middleware-chain.js +8 -0
- package/dist/middleware/rate-limit.d.ts +82 -0
- package/dist/middleware/rate-limit.js +14 -0
- package/dist/middleware/response-logger.d.ts +22 -0
- package/dist/middleware/response-logger.js +8 -0
- package/dist/middleware/security.d.ts +31 -0
- package/dist/middleware/security.js +9 -0
- package/dist/middleware/types.d.ts +45 -0
- package/dist/middleware/types.js +0 -0
- package/dist/middleware/wrappers.d.ts +91 -0
- package/dist/middleware/wrappers.js +32 -0
- package/dist/storage/r2-storage.d.ts +38 -0
- package/dist/storage/r2-storage.js +105 -0
- package/dist/system/cpu.d.ts +2 -0
- package/dist/system/cpu.js +9 -0
- package/dist/system/disk.d.ts +2 -0
- package/dist/system/disk.js +9 -0
- package/dist/system/environment.d.ts +8 -0
- package/dist/system/environment.js +9 -0
- package/dist/system/health-check.d.ts +26 -0
- package/dist/system/health-check.js +10 -0
- package/dist/system/index.d.ts +51 -0
- package/dist/system/index.js +194 -0
- package/dist/system/memory.d.ts +2 -0
- package/dist/system/memory.js +9 -0
- package/dist/system/network.d.ts +2 -0
- package/dist/system/network.js +9 -0
- package/dist/system/types.d.ts +93 -0
- package/dist/system/types.js +0 -0
- package/dist/system/utils.d.ts +12 -0
- package/dist/system/utils.js +26 -0
- package/dist/types/api.d.ts +80 -0
- package/dist/types/api.js +0 -0
- package/dist/types/database.d.ts +38 -0
- package/dist/types/database.js +0 -0
- package/dist/types/env.d.ts +105 -0
- package/dist/types/env.js +0 -0
- package/dist/types/geoip.d.ts +152 -0
- package/dist/types/geoip.js +0 -0
- package/dist/types/i18n.d.ts +11 -0
- package/dist/types/i18n.js +0 -0
- package/dist/types/qr-code.d.ts +139 -0
- package/dist/types/qr-code.js +75 -0
- package/dist/types/user.d.ts +54 -0
- package/dist/types/user.js +0 -0
- package/dist/utils/api-helpers.d.ts +147 -0
- package/dist/utils/api-helpers.js +30 -0
- package/dist/utils/client/client-utils.d.ts +3 -0
- package/dist/utils/client/client-utils.js +9 -0
- package/dist/utils/client/qr-code.d.ts +16 -0
- package/dist/utils/client/qr-code.js +215 -0
- package/dist/utils/cors.d.ts +40 -0
- package/dist/utils/cors.js +21 -0
- package/dist/utils/csv-export.d.ts +97 -0
- package/dist/utils/csv-export.js +20 -0
- package/dist/utils/error-message-formatter.d.ts +17 -0
- package/dist/utils/error-message-formatter.js +11 -0
- package/dist/utils/error-processor.d.ts +70 -0
- package/dist/utils/error-processor.js +34 -0
- package/dist/utils/format-number.d.ts +17 -0
- package/dist/utils/format-number.js +9 -0
- package/dist/utils/index.d.ts +13 -0
- package/dist/utils/index.js +160 -0
- package/dist/utils/input-validation.d.ts +88 -0
- package/dist/utils/input-validation.js +223 -0
- package/dist/utils/ip-utils.d.ts +15 -0
- package/dist/utils/ip-utils.js +91 -0
- package/dist/utils/optimistic-lock.d.ts +27 -0
- package/dist/utils/optimistic-lock.js +16 -0
- package/dist/utils/sanitizer.d.ts +72 -0
- package/dist/utils/sanitizer.js +19 -0
- package/dist/utils/shared-utils.d.ts +25 -0
- package/dist/utils/shared-utils.js +43 -0
- package/dist/utils/short-code-generator.d.ts +24 -0
- package/dist/utils/short-code-generator.js +9 -0
- package/dist/utils/timezone.d.ts +56 -0
- package/dist/utils/timezone.js +29 -0
- package/dist/utils/type-guards.d.ts +164 -0
- package/dist/utils/type-guards.js +59 -0
- package/dist/utils/url-normalizer.d.ts +53 -0
- package/dist/utils/url-normalizer.js +21 -0
- package/dist/validators/index.d.ts +7 -0
- package/dist/validators/index.js +13 -0
- package/dist/validators/password-validator.d.ts +86 -0
- package/dist/validators/password-validator.js +13 -0
- package/dist/world_countries-C2WUL2CQ.js +279 -0
- package/package.json +129 -0
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import {
|
|
2
|
+
GeoIPProviderFactory
|
|
3
|
+
} from "../chunk-S73334QY.js";
|
|
4
|
+
import {
|
|
5
|
+
IPApiProvider
|
|
6
|
+
} from "../chunk-DEEJBDJE.js";
|
|
7
|
+
import {
|
|
8
|
+
IPApiCoProvider
|
|
9
|
+
} from "../chunk-VSGKVZB4.js";
|
|
10
|
+
import {
|
|
11
|
+
IPGeolocationProvider
|
|
12
|
+
} from "../chunk-DH2ZHGW2.js";
|
|
13
|
+
import {
|
|
14
|
+
MaxMindProvider
|
|
15
|
+
} from "../chunk-4NWJ3WCZ.js";
|
|
16
|
+
import {
|
|
17
|
+
BaseGeoIPProvider,
|
|
18
|
+
truncateString
|
|
19
|
+
} from "../chunk-AHDPGRXS.js";
|
|
20
|
+
import {
|
|
21
|
+
BatchProcessor,
|
|
22
|
+
createBatchProcessor
|
|
23
|
+
} from "../chunk-TZAP5T4N.js";
|
|
24
|
+
import "../chunk-EZR55KV2.js";
|
|
25
|
+
import "../chunk-ORMEWXMH.js";
|
|
26
|
+
export {
|
|
27
|
+
BaseGeoIPProvider,
|
|
28
|
+
BatchProcessor,
|
|
29
|
+
GeoIPProviderFactory,
|
|
30
|
+
IPApiCoProvider,
|
|
31
|
+
IPApiProvider,
|
|
32
|
+
IPGeolocationProvider,
|
|
33
|
+
MaxMindProvider,
|
|
34
|
+
createBatchProcessor,
|
|
35
|
+
truncateString
|
|
36
|
+
};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* GeoIP Provider Base
|
|
3
|
+
*
|
|
4
|
+
* 프로젝트 독립적인 GeoIP 제공자 기본 클래스
|
|
5
|
+
* - 외부 의존성 없음 (Prisma, CacheKeys 등)
|
|
6
|
+
* - 순수 HTTP 클라이언트
|
|
7
|
+
*/
|
|
8
|
+
import type { IGeoIPProvider, IGeoIPApiResponse } from '@withwiz/types/geoip';
|
|
9
|
+
import type { IGeoLocationData } from '@withwiz/types/database';
|
|
10
|
+
/**
|
|
11
|
+
* 문자열 길이를 제한하는 유틸리티 함수
|
|
12
|
+
*/
|
|
13
|
+
export declare function truncateString(str: string | null | undefined, maxLength: number): string | null;
|
|
14
|
+
/**
|
|
15
|
+
* GeoIP Provider 기본 클래스
|
|
16
|
+
* 모든 제공자가 상속받아 구현
|
|
17
|
+
*/
|
|
18
|
+
export declare abstract class BaseGeoIPProvider implements IGeoIPProvider {
|
|
19
|
+
abstract name: string;
|
|
20
|
+
protected abstract rateLimit: number;
|
|
21
|
+
protected abstract timeout: number;
|
|
22
|
+
abstract url(ip: string): string;
|
|
23
|
+
abstract parseResponse(data: IGeoIPApiResponse): IGeoLocationData | null;
|
|
24
|
+
isAvailable(): boolean;
|
|
25
|
+
getRateLimit(): number;
|
|
26
|
+
getTimeout(): number;
|
|
27
|
+
/**
|
|
28
|
+
* IP 주소로 GeoIP 데이터 조회
|
|
29
|
+
* @param ip - IP 주소
|
|
30
|
+
* @returns GeoIP 데이터 또는 null
|
|
31
|
+
*/
|
|
32
|
+
fetchGeoData(ip: string): Promise<IGeoLocationData | null>;
|
|
33
|
+
}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* GeoIP Providers
|
|
3
|
+
*
|
|
4
|
+
* 프로젝트 독립적인 GeoIP 제공자 모듈
|
|
5
|
+
* - 순수 HTTP 클라이언트
|
|
6
|
+
* - 외부 의존성 없음
|
|
7
|
+
*/
|
|
8
|
+
import type { IGeoIPProvider } from '@withwiz/types/geoip';
|
|
9
|
+
export { BaseGeoIPProvider, truncateString } from './base-provider';
|
|
10
|
+
export { IPApiProvider } from './ip-api-provider';
|
|
11
|
+
export { IPApiCoProvider } from './ipapi-co-provider';
|
|
12
|
+
export { IPGeolocationProvider } from './ipgeolocation-provider';
|
|
13
|
+
export { MaxMindProvider } from './maxmind-provider';
|
|
14
|
+
/**
|
|
15
|
+
* GeoIP 제공자 팩토리
|
|
16
|
+
* 제공자들을 관리하고 적절한 제공자를 선택
|
|
17
|
+
* - 프로젝트 독립적
|
|
18
|
+
*/
|
|
19
|
+
export declare class GeoIPProviderFactory {
|
|
20
|
+
private static providers;
|
|
21
|
+
/**
|
|
22
|
+
* 사용 가능한 제공자 목록 반환
|
|
23
|
+
*/
|
|
24
|
+
static getAvailableProviders(): IGeoIPProvider[];
|
|
25
|
+
/**
|
|
26
|
+
* 이름으로 제공자 찾기
|
|
27
|
+
*/
|
|
28
|
+
static getProvider(name: string): IGeoIPProvider | null;
|
|
29
|
+
/**
|
|
30
|
+
* 모든 제공자 목록 반환
|
|
31
|
+
*/
|
|
32
|
+
static getAllProviders(): IGeoIPProvider[];
|
|
33
|
+
/**
|
|
34
|
+
* 제공자별 성능 통계
|
|
35
|
+
*/
|
|
36
|
+
static getProviderStats(): Array<{
|
|
37
|
+
name: string;
|
|
38
|
+
available: boolean;
|
|
39
|
+
rateLimit: number;
|
|
40
|
+
timeout: number;
|
|
41
|
+
}>;
|
|
42
|
+
/**
|
|
43
|
+
* 최적의 제공자 선택 (성능 기준)
|
|
44
|
+
*/
|
|
45
|
+
static getOptimalProvider(): IGeoIPProvider | null;
|
|
46
|
+
/**
|
|
47
|
+
* 제공자 등록
|
|
48
|
+
*/
|
|
49
|
+
static registerProvider(provider: IGeoIPProvider): void;
|
|
50
|
+
/**
|
|
51
|
+
* 제공자 제거
|
|
52
|
+
*/
|
|
53
|
+
static unregisterProvider(name: string): boolean;
|
|
54
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import {
|
|
2
|
+
GeoIPProviderFactory
|
|
3
|
+
} from "../../chunk-S73334QY.js";
|
|
4
|
+
import {
|
|
5
|
+
IPApiProvider
|
|
6
|
+
} from "../../chunk-DEEJBDJE.js";
|
|
7
|
+
import {
|
|
8
|
+
IPApiCoProvider
|
|
9
|
+
} from "../../chunk-VSGKVZB4.js";
|
|
10
|
+
import {
|
|
11
|
+
IPGeolocationProvider
|
|
12
|
+
} from "../../chunk-DH2ZHGW2.js";
|
|
13
|
+
import {
|
|
14
|
+
MaxMindProvider
|
|
15
|
+
} from "../../chunk-4NWJ3WCZ.js";
|
|
16
|
+
import {
|
|
17
|
+
BaseGeoIPProvider,
|
|
18
|
+
truncateString
|
|
19
|
+
} from "../../chunk-AHDPGRXS.js";
|
|
20
|
+
import "../../chunk-ORMEWXMH.js";
|
|
21
|
+
export {
|
|
22
|
+
BaseGeoIPProvider,
|
|
23
|
+
GeoIPProviderFactory,
|
|
24
|
+
IPApiCoProvider,
|
|
25
|
+
IPApiProvider,
|
|
26
|
+
IPGeolocationProvider,
|
|
27
|
+
MaxMindProvider,
|
|
28
|
+
truncateString
|
|
29
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* IP-API.com Provider
|
|
3
|
+
*
|
|
4
|
+
* 무료 GeoIP 제공자 (분당 45회 요청 제한)
|
|
5
|
+
* - 프로젝트 독립적
|
|
6
|
+
* - HTTP 전용 (무료 플랜)
|
|
7
|
+
*/
|
|
8
|
+
import type { IGeoIPApiResponse } from '@withwiz/types/geoip';
|
|
9
|
+
import type { IGeoLocationData } from '@withwiz/types/database';
|
|
10
|
+
import { BaseGeoIPProvider } from './base-provider';
|
|
11
|
+
export declare class IPApiProvider extends BaseGeoIPProvider {
|
|
12
|
+
name: string;
|
|
13
|
+
protected rateLimit: number;
|
|
14
|
+
protected timeout: number;
|
|
15
|
+
url(ip: string): string;
|
|
16
|
+
parseResponse(data: IGeoIPApiResponse): IGeoLocationData | null;
|
|
17
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* IPAPI.co Provider
|
|
3
|
+
*
|
|
4
|
+
* 무료 GeoIP 제공자 (분당 1000회 요청 제한)
|
|
5
|
+
* - 프로젝트 독립적
|
|
6
|
+
* - HTTPS 지원
|
|
7
|
+
*/
|
|
8
|
+
import type { IGeoIPApiResponse } from '@withwiz/types/geoip';
|
|
9
|
+
import type { IGeoLocationData } from '@withwiz/types/database';
|
|
10
|
+
import { BaseGeoIPProvider } from './base-provider';
|
|
11
|
+
export declare class IPApiCoProvider extends BaseGeoIPProvider {
|
|
12
|
+
name: string;
|
|
13
|
+
protected rateLimit: number;
|
|
14
|
+
protected timeout: number;
|
|
15
|
+
url(ip: string): string;
|
|
16
|
+
parseResponse(data: IGeoIPApiResponse): IGeoLocationData | null;
|
|
17
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* IPGeolocation.io Provider
|
|
3
|
+
*
|
|
4
|
+
* 유료 GeoIP 제공자 (고성능)
|
|
5
|
+
* - 프로젝트 독립적
|
|
6
|
+
* - API 키 필요
|
|
7
|
+
*/
|
|
8
|
+
import type { IGeoIPApiResponse } from '@withwiz/types/geoip';
|
|
9
|
+
import type { IGeoLocationData } from '@withwiz/types/database';
|
|
10
|
+
import { BaseGeoIPProvider } from './base-provider';
|
|
11
|
+
export declare class IPGeolocationProvider extends BaseGeoIPProvider {
|
|
12
|
+
name: string;
|
|
13
|
+
protected rateLimit: number;
|
|
14
|
+
protected timeout: number;
|
|
15
|
+
url(ip: string): string;
|
|
16
|
+
parseResponse(data: IGeoIPApiResponse): IGeoLocationData | null;
|
|
17
|
+
isAvailable(): boolean;
|
|
18
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MaxMind GeoIP2 Provider
|
|
3
|
+
*
|
|
4
|
+
* 유료 GeoIP 제공자 (최고 성능, 로컬 DB)
|
|
5
|
+
* - 프로젝트 독립적
|
|
6
|
+
* - 로컬 데이터베이스 사용 (현재 미구현)
|
|
7
|
+
*/
|
|
8
|
+
import type { IGeoIPApiResponse } from '@withwiz/types/geoip';
|
|
9
|
+
import type { IGeoLocationData } from '@withwiz/types/database';
|
|
10
|
+
import { BaseGeoIPProvider } from './base-provider';
|
|
11
|
+
export declare class MaxMindProvider extends BaseGeoIPProvider {
|
|
12
|
+
name: string;
|
|
13
|
+
protected rateLimit: number;
|
|
14
|
+
protected timeout: number;
|
|
15
|
+
url(ip: string): string;
|
|
16
|
+
parseResponse(data: IGeoIPApiResponse): IGeoLocationData | null;
|
|
17
|
+
isAvailable(): boolean;
|
|
18
|
+
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
export interface DataTableFilters {
|
|
2
|
+
search?: string;
|
|
3
|
+
[key: string]: any;
|
|
4
|
+
}
|
|
5
|
+
export interface DataTableSort {
|
|
6
|
+
sort: string;
|
|
7
|
+
order: 'asc' | 'desc';
|
|
8
|
+
}
|
|
9
|
+
export interface DataTablePagination {
|
|
10
|
+
page: number;
|
|
11
|
+
pageSize: number;
|
|
12
|
+
total: number;
|
|
13
|
+
}
|
|
14
|
+
export interface UseDataTableOptions<T> {
|
|
15
|
+
initialFilters?: DataTableFilters;
|
|
16
|
+
initialSort?: DataTableSort;
|
|
17
|
+
initialPagination?: Partial<DataTablePagination>;
|
|
18
|
+
debounceMs?: number;
|
|
19
|
+
onDataChange?: (params: {
|
|
20
|
+
filters: DataTableFilters;
|
|
21
|
+
sort: DataTableSort;
|
|
22
|
+
pagination: DataTablePagination;
|
|
23
|
+
}) => Promise<void>;
|
|
24
|
+
}
|
|
25
|
+
export interface UseDataTableReturn<T> {
|
|
26
|
+
data: T[];
|
|
27
|
+
loading: boolean;
|
|
28
|
+
error: string | null;
|
|
29
|
+
total: number;
|
|
30
|
+
filters: DataTableFilters;
|
|
31
|
+
sort: DataTableSort;
|
|
32
|
+
pagination: DataTablePagination;
|
|
33
|
+
selectedIds: string[];
|
|
34
|
+
setData: (data: T[]) => void;
|
|
35
|
+
setLoading: (loading: boolean) => void;
|
|
36
|
+
setError: (error: string | null) => void;
|
|
37
|
+
setTotal: (total: number) => void;
|
|
38
|
+
setFilters: (filters: DataTableFilters) => void;
|
|
39
|
+
updateFilter: (key: string, value: any) => void;
|
|
40
|
+
clearFilters: () => void;
|
|
41
|
+
setSort: (sort: string, order?: 'asc' | 'desc') => void;
|
|
42
|
+
setPage: (page: number) => void;
|
|
43
|
+
setPageSize: (pageSize: number) => void;
|
|
44
|
+
setSelectedIds: (ids: string[]) => void;
|
|
45
|
+
toggleSelection: (id: string) => void;
|
|
46
|
+
selectAll: () => void;
|
|
47
|
+
clearSelection: () => void;
|
|
48
|
+
refresh: () => Promise<void>;
|
|
49
|
+
bulkAction: (action: (ids: string[]) => Promise<void>) => Promise<void>;
|
|
50
|
+
}
|
|
51
|
+
export declare function useDataTable<T>({ initialFilters, initialSort, initialPagination, debounceMs, onDataChange, }: UseDataTableOptions<T>): UseDataTableReturn<T>;
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import {
|
|
3
|
+
useDebounce
|
|
4
|
+
} from "../chunk-ZTN4X5FN.js";
|
|
5
|
+
import {
|
|
6
|
+
__spreadProps,
|
|
7
|
+
__spreadValues
|
|
8
|
+
} from "../chunk-ORMEWXMH.js";
|
|
9
|
+
|
|
10
|
+
// src/hooks/useDataTable.ts
|
|
11
|
+
import { useState, useCallback, useMemo } from "react";
|
|
12
|
+
function useDataTable({
|
|
13
|
+
initialFilters = {},
|
|
14
|
+
initialSort = { sort: "createdAt", order: "desc" },
|
|
15
|
+
initialPagination = { page: 1, pageSize: 10, total: 0 },
|
|
16
|
+
debounceMs = 500,
|
|
17
|
+
onDataChange
|
|
18
|
+
}) {
|
|
19
|
+
const [data, setData] = useState([]);
|
|
20
|
+
const [loading, setLoading] = useState(false);
|
|
21
|
+
const [error, setError] = useState(null);
|
|
22
|
+
const [total, setTotal] = useState(initialPagination.total || 0);
|
|
23
|
+
const [filters, setFilters] = useState(initialFilters);
|
|
24
|
+
const [sort, setSortState] = useState(initialSort);
|
|
25
|
+
const [pagination, setPaginationState] = useState({
|
|
26
|
+
page: initialPagination.page || 1,
|
|
27
|
+
pageSize: initialPagination.pageSize || 10,
|
|
28
|
+
total: initialPagination.total || 0
|
|
29
|
+
});
|
|
30
|
+
const [selectedIds, setSelectedIds] = useState([]);
|
|
31
|
+
const debouncedSearch = useDebounce(filters.search || "", debounceMs);
|
|
32
|
+
const refresh = useCallback(async () => {
|
|
33
|
+
if (!onDataChange) return;
|
|
34
|
+
setLoading(true);
|
|
35
|
+
setError(null);
|
|
36
|
+
try {
|
|
37
|
+
await onDataChange({
|
|
38
|
+
filters: __spreadProps(__spreadValues({}, filters), { search: debouncedSearch }),
|
|
39
|
+
sort,
|
|
40
|
+
pagination
|
|
41
|
+
});
|
|
42
|
+
} catch (err) {
|
|
43
|
+
setError(err instanceof Error ? err.message : "An error occurred");
|
|
44
|
+
} finally {
|
|
45
|
+
setLoading(false);
|
|
46
|
+
}
|
|
47
|
+
}, [filters, debouncedSearch, sort, pagination, onDataChange]);
|
|
48
|
+
const updateFilter = useCallback((key, value) => {
|
|
49
|
+
setFilters((prev) => __spreadProps(__spreadValues({}, prev), {
|
|
50
|
+
[key]: value
|
|
51
|
+
}));
|
|
52
|
+
if (key !== "search") {
|
|
53
|
+
setPaginationState((prev) => __spreadProps(__spreadValues({}, prev), { page: 1 }));
|
|
54
|
+
}
|
|
55
|
+
}, []);
|
|
56
|
+
const clearFilters = useCallback(() => {
|
|
57
|
+
setFilters(initialFilters);
|
|
58
|
+
setPaginationState((prev) => __spreadProps(__spreadValues({}, prev), { page: 1 }));
|
|
59
|
+
}, [initialFilters]);
|
|
60
|
+
const setSort = useCallback((newSort, newOrder) => {
|
|
61
|
+
setSortState((prev) => {
|
|
62
|
+
if (prev.sort === newSort) {
|
|
63
|
+
return {
|
|
64
|
+
sort: newSort,
|
|
65
|
+
order: newOrder || (prev.order === "asc" ? "desc" : "asc")
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
return {
|
|
69
|
+
sort: newSort,
|
|
70
|
+
order: newOrder || "asc"
|
|
71
|
+
};
|
|
72
|
+
});
|
|
73
|
+
setPaginationState((prev) => __spreadProps(__spreadValues({}, prev), { page: 1 }));
|
|
74
|
+
}, []);
|
|
75
|
+
const setPage = useCallback((page) => {
|
|
76
|
+
setPaginationState((prev) => __spreadProps(__spreadValues({}, prev), { page }));
|
|
77
|
+
}, []);
|
|
78
|
+
const setPageSize = useCallback((pageSize) => {
|
|
79
|
+
setPaginationState((prev) => __spreadProps(__spreadValues({}, prev), { pageSize, page: 1 }));
|
|
80
|
+
}, []);
|
|
81
|
+
const toggleSelection = useCallback((id) => {
|
|
82
|
+
setSelectedIds(
|
|
83
|
+
(prev) => prev.includes(id) ? prev.filter((selectedId) => selectedId !== id) : [...prev, id]
|
|
84
|
+
);
|
|
85
|
+
}, []);
|
|
86
|
+
const selectAll = useCallback(() => {
|
|
87
|
+
setSelectedIds(data.map((item) => item.id));
|
|
88
|
+
}, [data]);
|
|
89
|
+
const clearSelection = useCallback(() => {
|
|
90
|
+
setSelectedIds([]);
|
|
91
|
+
}, []);
|
|
92
|
+
const bulkAction = useCallback(async (action) => {
|
|
93
|
+
if (selectedIds.length === 0) return;
|
|
94
|
+
setLoading(true);
|
|
95
|
+
try {
|
|
96
|
+
await action(selectedIds);
|
|
97
|
+
setSelectedIds([]);
|
|
98
|
+
await refresh();
|
|
99
|
+
} catch (err) {
|
|
100
|
+
setError(err instanceof Error ? err.message : "Bulk action failed");
|
|
101
|
+
} finally {
|
|
102
|
+
setLoading(false);
|
|
103
|
+
}
|
|
104
|
+
}, [selectedIds, refresh]);
|
|
105
|
+
useMemo(() => {
|
|
106
|
+
if (debouncedSearch !== filters.search) {
|
|
107
|
+
setPaginationState((prev) => __spreadProps(__spreadValues({}, prev), { page: 1 }));
|
|
108
|
+
}
|
|
109
|
+
}, [debouncedSearch, filters.search]);
|
|
110
|
+
useMemo(() => {
|
|
111
|
+
refresh();
|
|
112
|
+
}, [debouncedSearch, sort.sort, sort.order, pagination.page, pagination.pageSize]);
|
|
113
|
+
return {
|
|
114
|
+
// 상태
|
|
115
|
+
data,
|
|
116
|
+
loading,
|
|
117
|
+
error,
|
|
118
|
+
total,
|
|
119
|
+
filters,
|
|
120
|
+
sort,
|
|
121
|
+
pagination,
|
|
122
|
+
selectedIds,
|
|
123
|
+
// 데이터 관리
|
|
124
|
+
setData,
|
|
125
|
+
setLoading,
|
|
126
|
+
setError,
|
|
127
|
+
setTotal,
|
|
128
|
+
// 필터 관리
|
|
129
|
+
setFilters,
|
|
130
|
+
updateFilter,
|
|
131
|
+
clearFilters,
|
|
132
|
+
// 정렬 관리
|
|
133
|
+
setSort,
|
|
134
|
+
// 페이지네이션 관리
|
|
135
|
+
setPage,
|
|
136
|
+
setPageSize,
|
|
137
|
+
// 선택 관리
|
|
138
|
+
setSelectedIds,
|
|
139
|
+
toggleSelection,
|
|
140
|
+
selectAll,
|
|
141
|
+
clearSelection,
|
|
142
|
+
// 액션
|
|
143
|
+
refresh,
|
|
144
|
+
bulkAction
|
|
145
|
+
};
|
|
146
|
+
}
|
|
147
|
+
export {
|
|
148
|
+
useDataTable
|
|
149
|
+
};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
export interface UseExitIntentOptions {
|
|
2
|
+
/** 팝업 표시 쿨다운 시간 (밀리초) - 기본 24시간 */
|
|
3
|
+
cooldown?: number;
|
|
4
|
+
/** 페이지 진입 후 대기 시간 (밀리초) - 기본 5초 */
|
|
5
|
+
delay?: number;
|
|
6
|
+
/** localStorage에 저장할 키 */
|
|
7
|
+
storageKey?: string;
|
|
8
|
+
/** 비활성화 여부 */
|
|
9
|
+
disabled?: boolean;
|
|
10
|
+
}
|
|
11
|
+
export interface UseExitIntentReturn {
|
|
12
|
+
/** 팝업 표시 여부 */
|
|
13
|
+
showPopup: boolean;
|
|
14
|
+
/** 팝업 닫기 */
|
|
15
|
+
closePopup: () => void;
|
|
16
|
+
/** 다시 보지 않기 처리 */
|
|
17
|
+
dismissForever: () => void;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Exit Intent 감지 훅
|
|
21
|
+
*
|
|
22
|
+
* @example
|
|
23
|
+
* ```tsx
|
|
24
|
+
* const { showPopup, closePopup, dismissForever } = useExitIntent({
|
|
25
|
+
* cooldown: 86400000, // 24시간
|
|
26
|
+
* delay: 5000, // 5초 후 활성화
|
|
27
|
+
* storageKey: 'my-popup',
|
|
28
|
+
* });
|
|
29
|
+
*
|
|
30
|
+
* if (showPopup) {
|
|
31
|
+
* return <Modal onClose={closePopup} onDismiss={dismissForever} />;
|
|
32
|
+
* }
|
|
33
|
+
* ```
|
|
34
|
+
*/
|
|
35
|
+
export declare function useExitIntent(options?: UseExitIntentOptions): UseExitIntentReturn;
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import "../chunk-ORMEWXMH.js";
|
|
3
|
+
|
|
4
|
+
// src/hooks/useExitIntent.ts
|
|
5
|
+
import { useState, useEffect, useCallback, useRef } from "react";
|
|
6
|
+
var DEFAULT_COOLDOWN = 24 * 60 * 60 * 1e3;
|
|
7
|
+
var DEFAULT_DELAY = 5e3;
|
|
8
|
+
var DEFAULT_STORAGE_KEY = "exit-intent-popup";
|
|
9
|
+
function useExitIntent(options = {}) {
|
|
10
|
+
const {
|
|
11
|
+
cooldown = DEFAULT_COOLDOWN,
|
|
12
|
+
delay = DEFAULT_DELAY,
|
|
13
|
+
storageKey = DEFAULT_STORAGE_KEY,
|
|
14
|
+
disabled = false
|
|
15
|
+
} = options;
|
|
16
|
+
const [showPopup, setShowPopup] = useState(false);
|
|
17
|
+
const hasTriggered = useRef(false);
|
|
18
|
+
const isReady = useRef(false);
|
|
19
|
+
const canShowPopup = useCallback(() => {
|
|
20
|
+
if (typeof window === "undefined") return false;
|
|
21
|
+
const lastShown = localStorage.getItem(`${storageKey}-last-shown`);
|
|
22
|
+
const isDismissed = localStorage.getItem(`${storageKey}-dismissed`) === "true";
|
|
23
|
+
if (isDismissed) return false;
|
|
24
|
+
if (!lastShown) return true;
|
|
25
|
+
const timeSinceLastShown = Date.now() - parseInt(lastShown, 10);
|
|
26
|
+
return timeSinceLastShown >= cooldown;
|
|
27
|
+
}, [storageKey, cooldown]);
|
|
28
|
+
const triggerPopup = useCallback(() => {
|
|
29
|
+
if (hasTriggered.current || !isReady.current || disabled) return;
|
|
30
|
+
if (!canShowPopup()) return;
|
|
31
|
+
hasTriggered.current = true;
|
|
32
|
+
setShowPopup(true);
|
|
33
|
+
localStorage.setItem(`${storageKey}-last-shown`, Date.now().toString());
|
|
34
|
+
}, [canShowPopup, storageKey, disabled]);
|
|
35
|
+
const closePopup = useCallback(() => {
|
|
36
|
+
setShowPopup(false);
|
|
37
|
+
}, []);
|
|
38
|
+
const dismissForever = useCallback(() => {
|
|
39
|
+
localStorage.setItem(`${storageKey}-dismissed`, "true");
|
|
40
|
+
setShowPopup(false);
|
|
41
|
+
}, [storageKey]);
|
|
42
|
+
useEffect(() => {
|
|
43
|
+
if (disabled) return;
|
|
44
|
+
const delayTimer = setTimeout(() => {
|
|
45
|
+
isReady.current = true;
|
|
46
|
+
}, delay);
|
|
47
|
+
const handleMouseLeave = (e) => {
|
|
48
|
+
if (e.clientY < 10 && isReady.current) {
|
|
49
|
+
triggerPopup();
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
const handleVisibilityChange = () => {
|
|
53
|
+
if (document.visibilityState === "hidden" && isReady.current) {
|
|
54
|
+
}
|
|
55
|
+
};
|
|
56
|
+
document.addEventListener("mouseleave", handleMouseLeave);
|
|
57
|
+
document.addEventListener("visibilitychange", handleVisibilityChange);
|
|
58
|
+
return () => {
|
|
59
|
+
clearTimeout(delayTimer);
|
|
60
|
+
document.removeEventListener("mouseleave", handleMouseLeave);
|
|
61
|
+
document.removeEventListener("visibilitychange", handleVisibilityChange);
|
|
62
|
+
};
|
|
63
|
+
}, [delay, disabled, triggerPopup]);
|
|
64
|
+
return {
|
|
65
|
+
showPopup,
|
|
66
|
+
closePopup,
|
|
67
|
+
dismissForever
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
export {
|
|
71
|
+
useExitIntent
|
|
72
|
+
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 사용자 타임존 정보를 관리하는 Hook
|
|
3
|
+
*/
|
|
4
|
+
export declare function useTimezone(): {
|
|
5
|
+
isLoading: boolean;
|
|
6
|
+
refreshTimezone: () => void;
|
|
7
|
+
timezone: string;
|
|
8
|
+
offset: number;
|
|
9
|
+
offsetFormatted: string;
|
|
10
|
+
};
|
|
11
|
+
/**
|
|
12
|
+
* 타임존 정보를 간단하게 표시하는 Hook
|
|
13
|
+
*/
|
|
14
|
+
export declare function useSimpleTimezone(): {
|
|
15
|
+
timezone: string;
|
|
16
|
+
offsetFormatted: string;
|
|
17
|
+
isLoading: boolean;
|
|
18
|
+
display: string;
|
|
19
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import winston from 'winston';
|
|
2
|
+
declare global {
|
|
3
|
+
var __maxListenersSet: boolean | undefined;
|
|
4
|
+
var __winstonLoggerInstance: winston.Logger | undefined;
|
|
5
|
+
}
|
|
6
|
+
export declare const logger: winston.Logger;
|
|
7
|
+
export declare function logDebug(message: string, meta?: any): void;
|
|
8
|
+
export declare function logInfo(message: string, meta?: any): void;
|
|
9
|
+
export declare function logError(message: string, meta?: any): void;
|
|
10
|
+
export declare function logApiRequest(request: Request, extra?: Record<string, any>): void;
|
|
11
|
+
export declare function logApiResponse(request: Request, response: Response, extra?: Record<string, any>): void;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import {
|
|
2
|
+
logApiRequest,
|
|
3
|
+
logApiResponse,
|
|
4
|
+
logDebug,
|
|
5
|
+
logError,
|
|
6
|
+
logInfo,
|
|
7
|
+
logger
|
|
8
|
+
} from "../chunk-EZR55KV2.js";
|
|
9
|
+
import "../chunk-ORMEWXMH.js";
|
|
10
|
+
export {
|
|
11
|
+
logApiRequest,
|
|
12
|
+
logApiResponse,
|
|
13
|
+
logDebug,
|
|
14
|
+
logError,
|
|
15
|
+
logInfo,
|
|
16
|
+
logger
|
|
17
|
+
};
|