@mohasinac/appkit 3.2.16 → 3.2.18
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/dist/_internal/client/features/layout/DashboardLayoutClient.js +13 -4
- package/dist/cli/index.js +6 -4
- package/dist/client/api/surface-error.js +3 -2
- package/dist/client/api/useApiQuery.js +3 -2
- package/dist/client/observability/reportClientError.js +3 -2
- package/dist/core/Logger.js +5 -4
- package/dist/core/StorageManager.js +6 -4
- package/dist/core/integration-keys.js +3 -3
- package/dist/errors/safe-read.js +2 -2
- package/dist/features/about/components/PolicyPageView.js +3 -1
- package/dist/features/admin/components/AdminAdEditorView.js +3 -1
- package/dist/features/admin/components/AdminAdsView.js +3 -1
- package/dist/features/admin/components/AdminBlogEditorView.js +3 -1
- package/dist/features/admin/components/AdminBundlesView.js +3 -1
- package/dist/features/admin/components/AdminCouponEditorView.js +3 -1
- package/dist/features/admin/components/AdminCouponsView.js +5 -2
- package/dist/features/admin/components/AdminGroupedListingsView.js +3 -1
- package/dist/features/admin/components/AdminNewsletterView.js +3 -1
- package/dist/features/admin/components/AdminPayoutsView.js +3 -1
- package/dist/features/admin/components/AdminSectionsView.js +3 -1
- package/dist/features/auctions/components/MarketplaceAuctionCard.js +3 -1
- package/dist/features/auctions/hooks/useRealtimeBids.js +3 -1
- package/dist/features/auth/hooks/useAuth.js +2 -1
- package/dist/features/blog/repository/blog.repository.js +2 -1
- package/dist/features/cart/utils/guest-cart.js +3 -1
- package/dist/features/cart/utils/pending-ops.js +5 -2
- package/dist/features/categories/hooks/useCategories.js +3 -1
- package/dist/features/categories/repository/categories.repository.js +2 -1
- package/dist/features/contact/components/ContactForm.js +3 -1
- package/dist/features/events/components/AdminEventEditorView.js +5 -2
- package/dist/features/events/components/EventBanner.js +5 -2
- package/dist/features/events/components/EventOfferCard.js +3 -1
- package/dist/features/events/components/EventRafflesSection.js +3 -1
- package/dist/features/history/hooks/useHistory.js +10 -5
- package/dist/features/history/utils/guest-history.js +3 -1
- package/dist/features/homepage/api/carousel/route.js +2 -1
- package/dist/features/homepage/api/route.js +2 -1
- package/dist/features/homepage/components/AdSlot.js +3 -1
- package/dist/features/homepage/components/AnnouncementBar.js +6 -2
- package/dist/features/homepage/components/CharacterHotspotForm.js +5 -2
- package/dist/features/homepage/components/GoogleReviewsSection.js +3 -1
- package/dist/features/homepage/components/NewsletterBanner.js +3 -1
- package/dist/features/homepage/lib/live-stats.js +2 -1
- package/dist/features/homepage/lib/section-helpers.d.ts +0 -1
- package/dist/features/homepage/lib/section-helpers.js +3 -1
- package/dist/features/media/MediaPickerModal.js +3 -1
- package/dist/features/media/finalize.js +7 -3
- package/dist/features/media/upload/MediaUploadField.js +6 -3
- package/dist/features/media/upload/MediaUploadList.js +2 -1
- package/dist/features/media/upload/video-poster.js +3 -1
- package/dist/features/messages/hooks/useConversation.js +2 -1
- package/dist/features/messages/hooks/useConversations.js +2 -1
- package/dist/features/pre-orders/components/MarketplacePreorderCard.js +3 -1
- package/dist/features/products/components/BidHistory.js +3 -1
- package/dist/features/products/components/GroupSettingsPanel.js +2 -1
- package/dist/features/products/components/PrizeDrawsSection.js +3 -1
- package/dist/features/products/components/ShareButton.js +3 -1
- package/dist/features/products/repository/products.repository.js +4 -2
- package/dist/features/promotions/components/CouponCard.js +3 -1
- package/dist/features/reviews/components/ReviewDetailShell.js +3 -1
- package/dist/features/scams/components/ScamProfileView.js +3 -1
- package/dist/features/scams/repository/scammer.repository.js +2 -1
- package/dist/features/search/api/route.js +2 -1
- package/dist/features/seller/components/PrintCenterView.js +3 -1
- package/dist/features/seller/components/SellerAddressesView.js +2 -1
- package/dist/features/site-settings/components/ActionPermissionsManager.js +3 -1
- package/dist/features/site-settings/components/NavPermissionsManager.js +3 -1
- package/dist/features/whatsapp-bot/helpers/whatsapp.js +4 -2
- package/dist/features/wishlist/repository/user-wishlist.repository.js +3 -1
- package/dist/features/wishlist/utils/guest-wishlist.js +3 -1
- package/dist/http/api-handler.js +5 -2
- package/dist/monitoring/cache-metrics.d.ts +0 -4
- package/dist/monitoring/cache-metrics.js +4 -2
- package/dist/monitoring/client-logger.js +4 -2
- package/dist/monitoring/server-logger.js +6 -5
- package/dist/next/api/apiHandler.js +2 -1
- package/dist/next/api/routeHandler.js +10 -5
- package/dist/next/middleware/pii-redactor.js +3 -1
- package/dist/next/middleware/pii-scrubber.js +3 -1
- package/dist/providers/auth-firebase/helpers.js +2 -1
- package/dist/providers/auth-firebase/session.js +2 -1
- package/dist/providers/db-firebase/admin.js +3 -1
- package/dist/providers/firebase-client/realtime.js +3 -1
- package/dist/providers/shipping-shiprocket/index.d.ts +0 -21
- package/dist/providers/shipping-shiprocket/index.js +3 -1
- package/dist/react/contexts/SessionContext.js +2 -1
- package/dist/react/hooks/useFormStatePreservation.js +3 -1
- package/dist/seed/seed-market-config.js +3 -1
- package/dist/ui/components/ClaimCouponButton.js +5 -2
- package/dist/ui/components/NavigationLoader.js +5 -2
- package/dist/utils/id-generators.js +3 -1
- package/dist/utils/string.formatter.d.ts +0 -3
- package/dist/utils/string.formatter.js +3 -1
- package/dist/validation/schemas.js +3 -1
- package/package.json +1 -1
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
* - hard cap WISHLIST_MAX (20); idempotent re-add is a no-op; over-cap throws WishlistFullError
|
|
9
9
|
* - all mutations run inside a Firestore transaction (concurrent-write safe)
|
|
10
10
|
*/
|
|
11
|
+
import { normalizeError } from "../../../errors/normalize";
|
|
11
12
|
import { getAdminDb } from "../../../providers/db-firebase";
|
|
12
13
|
import { serverLogger } from "../../../monitoring";
|
|
13
14
|
import { WISHLIST_COLLECTION, WISHLIST_DOC_ID, WISHLIST_MAX, } from "../../../constants/limits";
|
|
@@ -76,7 +77,8 @@ export class UserWishlistRepository {
|
|
|
76
77
|
const doc = await db.collection("products").doc(item.productId).get();
|
|
77
78
|
return doc.exists ? item : null;
|
|
78
79
|
}
|
|
79
|
-
catch {
|
|
80
|
+
catch (_err) {
|
|
81
|
+
void normalizeError(_err);
|
|
80
82
|
return item;
|
|
81
83
|
}
|
|
82
84
|
}));
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { normalizeError } from "../../../errors/normalize";
|
|
1
2
|
const DEFAULT_GUEST_WISHLIST_KEY = process.env.NEXT_PUBLIC_APP_ID
|
|
2
3
|
? `${process.env.NEXT_PUBLIC_APP_ID}_guest_wishlist`
|
|
3
4
|
: "guest_wishlist";
|
|
@@ -16,7 +17,8 @@ function readItems(storage, key) {
|
|
|
16
17
|
const parsed = JSON.parse(raw);
|
|
17
18
|
return Array.isArray(parsed) ? parsed : [];
|
|
18
19
|
}
|
|
19
|
-
catch {
|
|
20
|
+
catch (_err) {
|
|
21
|
+
void normalizeError(_err);
|
|
20
22
|
return [];
|
|
21
23
|
}
|
|
22
24
|
}
|
package/dist/http/api-handler.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { normalizeError } from "../errors/normalize";
|
|
1
2
|
import { createApiHandlerFactory } from "../next";
|
|
2
3
|
import { applyRateLimit } from "../security";
|
|
3
4
|
import { AuthenticationError, AuthorizationError, ERROR_MESSAGES, handleApiError, } from "../errors";
|
|
@@ -22,7 +23,8 @@ function parseCookieHeader(cookieHeader) {
|
|
|
22
23
|
try {
|
|
23
24
|
result.set(key, decodeURIComponent(value));
|
|
24
25
|
}
|
|
25
|
-
catch {
|
|
26
|
+
catch (_err) {
|
|
27
|
+
void normalizeError(_err);
|
|
26
28
|
result.set(key, value);
|
|
27
29
|
}
|
|
28
30
|
}
|
|
@@ -38,7 +40,8 @@ async function getUserFromRequest(request) {
|
|
|
38
40
|
try {
|
|
39
41
|
decoded = await providers.session.verifySession(sessionCookie);
|
|
40
42
|
}
|
|
41
|
-
catch {
|
|
43
|
+
catch (_err) {
|
|
44
|
+
void normalizeError(_err);
|
|
42
45
|
throw new AuthenticationError(ERROR_MESSAGES.USER.NOT_AUTHENTICATED);
|
|
43
46
|
}
|
|
44
47
|
const db = providers.db;
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
* Cache Performance Metrics — pure localStorage implementation.
|
|
3
3
|
* No Firebase dependencies.
|
|
4
4
|
*/
|
|
5
|
+
import { normalizeError } from "../errors/normalize";
|
|
5
6
|
const STORAGE_KEY = "mohasinac:cache_metrics";
|
|
6
7
|
const RESET_INTERVAL_MS = 3600000; // 1 hour
|
|
7
8
|
function nowISO() {
|
|
@@ -40,8 +41,9 @@ export function getCacheMetrics() {
|
|
|
40
41
|
}
|
|
41
42
|
return m;
|
|
42
43
|
}
|
|
43
|
-
catch {
|
|
44
|
-
|
|
44
|
+
catch (_err) {
|
|
45
|
+
void normalizeError(_err);
|
|
46
|
+
return initializeMetrics(); // stale or corrupt metrics record — reset to zero
|
|
45
47
|
}
|
|
46
48
|
}
|
|
47
49
|
function saveMetrics(m) {
|
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
* For server-side logging use `server-logger.ts`.
|
|
8
8
|
*/
|
|
9
9
|
import { logger } from "../core/Logger";
|
|
10
|
+
import { normalizeError } from "../errors/normalize";
|
|
10
11
|
import { AppError } from "../errors";
|
|
11
12
|
function buildClientMeta(error, context) {
|
|
12
13
|
const base = {
|
|
@@ -58,8 +59,9 @@ export const logApiError = async (endpoint, response, context) => {
|
|
|
58
59
|
try {
|
|
59
60
|
responseBody = await response.clone().json();
|
|
60
61
|
}
|
|
61
|
-
catch {
|
|
62
|
-
|
|
62
|
+
catch (_err) {
|
|
63
|
+
void normalizeError(_err);
|
|
64
|
+
responseBody = await response.clone().text(); // response body is not JSON — read as plain text
|
|
63
65
|
}
|
|
64
66
|
logClientError(`API Error: ${endpoint}`, new Error(response.statusText), {
|
|
65
67
|
...context,
|
|
@@ -74,7 +74,8 @@ function formatLogEntry(entry) {
|
|
|
74
74
|
try {
|
|
75
75
|
dataStr = `\n Data: ${JSON.stringify(sanitized, null, 2)}`;
|
|
76
76
|
}
|
|
77
|
-
catch {
|
|
77
|
+
catch (_err) {
|
|
78
|
+
void normalizeError(_err);
|
|
78
79
|
dataStr = `\n Data: [non-serializable — ${typeof sanitized}]`;
|
|
79
80
|
}
|
|
80
81
|
}
|
|
@@ -100,8 +101,8 @@ async function cleanOldLogFiles(logsDir) {
|
|
|
100
101
|
const filesToDelete = filesWithStats.slice(0, filesWithStats.length - MAX_LOG_FILES);
|
|
101
102
|
await Promise.all(filesToDelete.map((file) => unlink(file.path)));
|
|
102
103
|
}
|
|
103
|
-
catch {
|
|
104
|
-
// Logger failures must never break the request path
|
|
104
|
+
catch (_err) {
|
|
105
|
+
void normalizeError(_err); // Logger failures must never break the request path
|
|
105
106
|
}
|
|
106
107
|
}
|
|
107
108
|
async function rotateLogFileIfNeeded(filePath) {
|
|
@@ -119,8 +120,8 @@ async function rotateLogFileIfNeeded(filePath) {
|
|
|
119
120
|
await rename(filePath, rotatedPath);
|
|
120
121
|
await cleanOldLogFiles(dir);
|
|
121
122
|
}
|
|
122
|
-
catch {
|
|
123
|
-
// Logger failures must never break the request path
|
|
123
|
+
catch (_err) {
|
|
124
|
+
void normalizeError(_err); // Logger failures must never break the request path
|
|
124
125
|
}
|
|
125
126
|
}
|
|
126
127
|
async function writeLog(entry) {
|
|
@@ -12,7 +12,8 @@ async function validateSchema(request, schema) {
|
|
|
12
12
|
const data = (await request.json());
|
|
13
13
|
return { validationError: false, data };
|
|
14
14
|
}
|
|
15
|
-
catch {
|
|
15
|
+
catch (_err) {
|
|
16
|
+
void normalizeError(_err);
|
|
16
17
|
return { validationError: false, data: undefined };
|
|
17
18
|
}
|
|
18
19
|
}
|
|
@@ -66,7 +66,8 @@ async function verifySession(request) {
|
|
|
66
66
|
...payload.claims,
|
|
67
67
|
};
|
|
68
68
|
}
|
|
69
|
-
catch {
|
|
69
|
+
catch (_err) {
|
|
70
|
+
void normalizeError(_err);
|
|
70
71
|
throw Object.assign(new Error("Invalid or expired session"), {
|
|
71
72
|
status: 401,
|
|
72
73
|
});
|
|
@@ -150,7 +151,8 @@ export function createRouteHandler(options) {
|
|
|
150
151
|
try {
|
|
151
152
|
user = await verifySession(request);
|
|
152
153
|
}
|
|
153
|
-
catch {
|
|
154
|
+
catch (_err) {
|
|
155
|
+
void normalizeError(_err);
|
|
154
156
|
// anonymous
|
|
155
157
|
}
|
|
156
158
|
}
|
|
@@ -191,7 +193,8 @@ export function createRouteHandler(options) {
|
|
|
191
193
|
try {
|
|
192
194
|
raw = await request.json();
|
|
193
195
|
}
|
|
194
|
-
catch {
|
|
196
|
+
catch (_err) {
|
|
197
|
+
void normalizeError(_err);
|
|
195
198
|
return errorJson(400, HTTP_ERROR_CODES.VALIDATION_FAILED, "Invalid JSON body", requestId);
|
|
196
199
|
}
|
|
197
200
|
const result = resolvedSchema.safeParse(raw);
|
|
@@ -204,7 +207,8 @@ export function createRouteHandler(options) {
|
|
|
204
207
|
try {
|
|
205
208
|
body = (await request.json());
|
|
206
209
|
}
|
|
207
|
-
catch {
|
|
210
|
+
catch (_err) {
|
|
211
|
+
void normalizeError(_err);
|
|
208
212
|
return errorJson(400, HTTP_ERROR_CODES.VALIDATION_FAILED, "Invalid JSON body", requestId);
|
|
209
213
|
}
|
|
210
214
|
}
|
|
@@ -214,7 +218,8 @@ export function createRouteHandler(options) {
|
|
|
214
218
|
const text = await request.text();
|
|
215
219
|
body = text ? JSON.parse(text) : undefined;
|
|
216
220
|
}
|
|
217
|
-
catch {
|
|
221
|
+
catch (_err) {
|
|
222
|
+
void normalizeError(_err);
|
|
218
223
|
body = undefined;
|
|
219
224
|
}
|
|
220
225
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { normalizeError } from "../../errors/normalize";
|
|
1
2
|
import { NextResponse } from "next/server";
|
|
2
3
|
function maskPii(value) {
|
|
3
4
|
if (value.includes("@")) {
|
|
@@ -56,7 +57,8 @@ export function createPiiRedactorMiddleware(rules) {
|
|
|
56
57
|
try {
|
|
57
58
|
body = (await response.json());
|
|
58
59
|
}
|
|
59
|
-
catch {
|
|
60
|
+
catch (_err) {
|
|
61
|
+
void normalizeError(_err);
|
|
60
62
|
return response;
|
|
61
63
|
}
|
|
62
64
|
for (const { fields, mask = true, unless } of rules) {
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { normalizeError } from "../../errors/normalize";
|
|
1
2
|
import { NextResponse } from "next/server";
|
|
2
3
|
const ENC_PREFIX = "enc:v1:";
|
|
3
4
|
function scrubValue(value) {
|
|
@@ -32,7 +33,8 @@ export const piiScrubberMiddleware = async (_request, _ctx, next) => {
|
|
|
32
33
|
try {
|
|
33
34
|
body = await response.json();
|
|
34
35
|
}
|
|
35
|
-
catch {
|
|
36
|
+
catch (_err) {
|
|
37
|
+
void normalizeError(_err);
|
|
36
38
|
return response;
|
|
37
39
|
}
|
|
38
40
|
const scrubbed = scrubValue(body);
|
|
@@ -70,7 +70,8 @@ export const firebaseSessionProvider = {
|
|
|
70
70
|
const decoded = await getAdminAuthLite().verifySessionCookie(cookie, false);
|
|
71
71
|
await getAdminAuthLite().revokeRefreshTokens(decoded.uid);
|
|
72
72
|
}
|
|
73
|
-
catch {
|
|
73
|
+
catch (_err) {
|
|
74
|
+
void normalizeError(_err);
|
|
74
75
|
// Best-effort: if cookie is already invalid, treat as already destroyed
|
|
75
76
|
}
|
|
76
77
|
},
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { normalizeError } from "../../errors/normalize";
|
|
1
2
|
function nodePath() { return require("path"); }
|
|
2
3
|
function nodeFs() { return require("fs"); }
|
|
3
4
|
// process.cwd() is Node.js-only; access via module.require so the Edge
|
|
@@ -151,7 +152,8 @@ export function getAdminDb() {
|
|
|
151
152
|
// HMR reloads and duplicate module instances.
|
|
152
153
|
db.settings({ ignoreUndefinedProperties: true });
|
|
153
154
|
}
|
|
154
|
-
catch {
|
|
155
|
+
catch (_err) {
|
|
156
|
+
void normalizeError(_err);
|
|
155
157
|
// Already configured — safe to ignore.
|
|
156
158
|
}
|
|
157
159
|
set("__mohasinac_firebase_admin_db__", db);
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { getApps, initializeApp } from "firebase/app";
|
|
2
|
+
import { normalizeError } from "../../errors/normalize";
|
|
2
3
|
import { getDatabase, ref, onValue, off, } from "firebase/database";
|
|
3
4
|
import { getAuth, signInWithCustomToken, signOut } from "firebase/auth";
|
|
4
5
|
/**
|
|
@@ -19,7 +20,8 @@ export class FirebaseClientRealtimeProvider {
|
|
|
19
20
|
try {
|
|
20
21
|
await signOut(getAuth(this.app));
|
|
21
22
|
}
|
|
22
|
-
catch {
|
|
23
|
+
catch (_err) {
|
|
24
|
+
void normalizeError(_err);
|
|
23
25
|
// no-op — signing out of a secondary app can fail harmlessly
|
|
24
26
|
}
|
|
25
27
|
}
|
|
@@ -1,24 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @mohasinac/shipping-shiprocket — Shiprocket shipping API client
|
|
3
|
-
*
|
|
4
|
-
* Thin HTTP client for the Shiprocket REST API.
|
|
5
|
-
* No credential management — caller is responsible for obtaining and
|
|
6
|
-
* passing the JWT token (see your project's platform auth layer).
|
|
7
|
-
*
|
|
8
|
-
* API base: https://apiv2.shiprocket.in/v1/external
|
|
9
|
-
*
|
|
10
|
-
* @example
|
|
11
|
-
* ```ts
|
|
12
|
-
* import {
|
|
13
|
-
* shiprocketAuthenticate,
|
|
14
|
-
* shiprocketCreateOrder,
|
|
15
|
-
* shiprocketTrackByAWB,
|
|
16
|
-
* } from "@mohasinac/shipping-shiprocket";
|
|
17
|
-
*
|
|
18
|
-
* const { token } = await shiprocketAuthenticate({ email, password });
|
|
19
|
-
* const order = await shiprocketCreateOrder(token, orderData);
|
|
20
|
-
* ```
|
|
21
|
-
*/
|
|
22
1
|
export interface ShiprocketAuthRequest {
|
|
23
2
|
email: string;
|
|
24
3
|
password: string;
|
|
@@ -19,6 +19,7 @@
|
|
|
19
19
|
* const order = await shiprocketCreateOrder(token, orderData);
|
|
20
20
|
* ```
|
|
21
21
|
*/
|
|
22
|
+
import { normalizeError } from "../../errors/normalize";
|
|
22
23
|
const BASE_URL = "https://apiv2.shiprocket.in/v1/external";
|
|
23
24
|
// --- Internal fetch helper ----------------------------------------------------
|
|
24
25
|
async function shiprocketFetch(endpoint, options = {}) {
|
|
@@ -38,7 +39,8 @@ async function shiprocketFetch(endpoint, options = {}) {
|
|
|
38
39
|
try {
|
|
39
40
|
json = JSON.parse(text);
|
|
40
41
|
}
|
|
41
|
-
catch {
|
|
42
|
+
catch (_err) {
|
|
43
|
+
void normalizeError(_err);
|
|
42
44
|
throw new Error(`Shiprocket API non-JSON response ${response.status}: ${text.slice(0, 200)}`);
|
|
43
45
|
}
|
|
44
46
|
if (!response.ok) {
|
|
@@ -146,7 +146,8 @@ export function SessionProvider({ children, initialUser, endpoints: endpointOver
|
|
|
146
146
|
dismissedBannerHash: data.dismissedBannerHash,
|
|
147
147
|
};
|
|
148
148
|
}
|
|
149
|
-
catch {
|
|
149
|
+
catch (_err) {
|
|
150
|
+
void normalizeError(_err);
|
|
150
151
|
return null;
|
|
151
152
|
}
|
|
152
153
|
}, [ep.userProfile]);
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
"use client";
|
|
2
|
+
import { normalizeError } from "../../errors/normalize";
|
|
2
3
|
import { useEffect, useRef, useCallback } from "react";
|
|
3
4
|
const PARAM_DEFAULT = "_s";
|
|
4
5
|
function stripPii(values, stripFields) {
|
|
@@ -28,7 +29,8 @@ export function useFormStatePreservation({ values, onRestore, stripFields = [],
|
|
|
28
29
|
const decoded = JSON.parse(atob(encoded));
|
|
29
30
|
onRestore(decoded);
|
|
30
31
|
}
|
|
31
|
-
catch {
|
|
32
|
+
catch (_err) {
|
|
33
|
+
void normalizeError(_err);
|
|
32
34
|
// ignore corrupt payloads
|
|
33
35
|
}
|
|
34
36
|
}, [paramName, onRestore]);
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
// appkit/src/seed/seed-market-config.ts
|
|
2
2
|
// Locale-specific data pools for seed factories and fixtures.
|
|
3
3
|
// Default pools match current letitrip.in baseline (Indian market).
|
|
4
|
+
import { normalizeError } from "../errors/normalize";
|
|
4
5
|
import { getMarketProfile, getDefaultCurrency, getDefaultCurrencySymbol, getDefaultPhonePrefix, getDefaultCountry, } from "../core/baseline-resolver";
|
|
5
6
|
// ---------------------------------------------------------------------------
|
|
6
7
|
// Re-export baseline accessors for convenience within seed layer
|
|
@@ -167,7 +168,8 @@ export function formatSeedPrice(amount) {
|
|
|
167
168
|
maximumFractionDigits: 0,
|
|
168
169
|
}).format(amount);
|
|
169
170
|
}
|
|
170
|
-
catch {
|
|
171
|
+
catch (_err) {
|
|
172
|
+
void normalizeError(_err);
|
|
171
173
|
// Fallback if Intl is unavailable or currency unknown
|
|
172
174
|
return `${profile.currencySymbol}${amount.toLocaleString()}`;
|
|
173
175
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { normalizeError } from "../../errors/normalize";
|
|
3
4
|
/**
|
|
4
5
|
* ClaimCouponButton — surfaced anywhere a user wins or earns a coupon
|
|
5
6
|
* (SpinWheel "YOU WON" panel, raffle winner page, prize-draw reveal modal,
|
|
@@ -33,7 +34,8 @@ async function postClaim(couponCode, source) {
|
|
|
33
34
|
});
|
|
34
35
|
return res.ok;
|
|
35
36
|
}
|
|
36
|
-
catch {
|
|
37
|
+
catch (_err) {
|
|
38
|
+
void normalizeError(_err);
|
|
37
39
|
return false;
|
|
38
40
|
}
|
|
39
41
|
}
|
|
@@ -45,7 +47,8 @@ async function copyToClipboard(text) {
|
|
|
45
47
|
await navigator.clipboard.writeText(text);
|
|
46
48
|
return true;
|
|
47
49
|
}
|
|
48
|
-
catch {
|
|
50
|
+
catch (_err) {
|
|
51
|
+
void normalizeError(_err);
|
|
49
52
|
return false;
|
|
50
53
|
}
|
|
51
54
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { normalizeError } from "../../errors/normalize";
|
|
3
4
|
import { useEffect, useRef, useState } from "react";
|
|
4
5
|
import { usePathname, useSearchParams } from "next/navigation";
|
|
5
6
|
import { Spinner } from "./Spinner";
|
|
@@ -102,7 +103,8 @@ export function NavigationLoader({ spinnerVariant = "pokeball", label = "Loading
|
|
|
102
103
|
return false;
|
|
103
104
|
return true;
|
|
104
105
|
}
|
|
105
|
-
catch {
|
|
106
|
+
catch (_err) {
|
|
107
|
+
void normalizeError(_err);
|
|
106
108
|
return true;
|
|
107
109
|
}
|
|
108
110
|
}
|
|
@@ -115,7 +117,8 @@ export function NavigationLoader({ spinnerVariant = "pokeball", label = "Loading
|
|
|
115
117
|
const nextUrl = new URL(href, window.location.href);
|
|
116
118
|
showOverlay(`${nextUrl.pathname}?${nextUrl.searchParams.toString()}`);
|
|
117
119
|
}
|
|
118
|
-
catch {
|
|
120
|
+
catch (_err) {
|
|
121
|
+
void normalizeError(_err);
|
|
119
122
|
showOverlay();
|
|
120
123
|
}
|
|
121
124
|
}
|
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
* duplicating generator logic.
|
|
7
7
|
*/
|
|
8
8
|
import { slugify } from "./string.formatter";
|
|
9
|
+
import { normalizeError } from "../errors/normalize";
|
|
9
10
|
function generateRandomString(length = 6) {
|
|
10
11
|
const chars = "abcdefghijklmnopqrstuvwxyz0123456789";
|
|
11
12
|
const indices = new Uint8Array(length);
|
|
@@ -144,7 +145,8 @@ export async function idExists(getExistingId) {
|
|
|
144
145
|
const doc = await getExistingId();
|
|
145
146
|
return !!doc;
|
|
146
147
|
}
|
|
147
|
-
catch {
|
|
148
|
+
catch (_err) {
|
|
149
|
+
void normalizeError(_err);
|
|
148
150
|
return false;
|
|
149
151
|
}
|
|
150
152
|
}
|
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* String Formatting and Manipulation Utilities
|
|
3
|
-
*/
|
|
4
1
|
export declare function capitalize(str: string): string;
|
|
5
2
|
export declare function capitalizeWords(str: string): string;
|
|
6
3
|
export declare function truncate(str: string, maxLength: number, suffix?: string): string;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* String Formatting and Manipulation Utilities
|
|
3
3
|
*/
|
|
4
|
+
import { normalizeError } from "../errors/normalize";
|
|
4
5
|
export function capitalize(str) {
|
|
5
6
|
return str.charAt(0).toUpperCase() + str.slice(1).toLowerCase();
|
|
6
7
|
}
|
|
@@ -137,7 +138,8 @@ export function proseMirrorToHtml(value) {
|
|
|
137
138
|
}
|
|
138
139
|
return value;
|
|
139
140
|
}
|
|
140
|
-
catch {
|
|
141
|
+
catch (_err) {
|
|
142
|
+
void normalizeError(_err);
|
|
141
143
|
return value;
|
|
142
144
|
}
|
|
143
145
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
+
import { normalizeError } from "../errors/normalize";
|
|
2
3
|
// ============================================
|
|
3
4
|
// COMMON SCHEMAS
|
|
4
5
|
// ============================================
|
|
@@ -29,7 +30,8 @@ export const mediaUrlSchema = z
|
|
|
29
30
|
const { hostname } = new URL(url);
|
|
30
31
|
return APPROVED_MEDIA_DOMAINS.some((domain) => hostname === domain || hostname.endsWith(`.${domain}`));
|
|
31
32
|
}
|
|
32
|
-
catch {
|
|
33
|
+
catch (_err) {
|
|
34
|
+
void normalizeError(_err);
|
|
33
35
|
return false;
|
|
34
36
|
}
|
|
35
37
|
}, { message: "Image or video URL must be hosted on an approved CDN domain" });
|