@orjok/commons 1.0.2 → 1.2.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/dist/amplify.cjs +30 -5
- package/dist/amplify.cjs.map +1 -1
- package/dist/amplify.d.cts +5 -2
- package/dist/amplify.d.ts +5 -2
- package/dist/amplify.js +30 -5
- package/dist/amplify.js.map +1 -1
- package/dist/chunk-B4UJE3F4.js +529 -0
- package/dist/chunk-B4UJE3F4.js.map +1 -0
- package/dist/chunk-ODXD2WJN.cjs +529 -0
- package/dist/chunk-ODXD2WJN.cjs.map +1 -0
- package/dist/hooks.cjs +639 -2
- package/dist/hooks.cjs.map +1 -1
- package/dist/hooks.d.cts +162 -3
- package/dist/hooks.d.ts +162 -3
- package/dist/hooks.js +638 -1
- package/dist/hooks.js.map +1 -1
- package/dist/index.cjs +2454 -363
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +303 -15
- package/dist/index.d.ts +303 -15
- package/dist/index.js +2430 -339
- package/dist/index.js.map +1 -1
- package/dist/{client-BaOC79Nc.d.cts → notification-BoqtkNrc.d.ts} +392 -12
- package/dist/{client-Bm9aiyTx.d.ts → notification-Ctfy0m05.d.cts} +392 -12
- package/dist/{storage-DLqdJgQt.d.cts → storage-9pK8KwIM.d.cts} +4 -2
- package/dist/{storage-DLqdJgQt.d.ts → storage-9pK8KwIM.d.ts} +4 -2
- package/dist/testing.cjs +34 -3
- package/dist/testing.cjs.map +1 -1
- package/dist/testing.d.cts +9 -2
- package/dist/testing.d.ts +9 -2
- package/dist/testing.js +34 -3
- package/dist/testing.js.map +1 -1
- package/package.json +6 -3
package/dist/index.d.cts
CHANGED
|
@@ -1,7 +1,50 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export {
|
|
3
|
-
import { S as StorageProvider } from './storage-
|
|
4
|
-
export { A as AuthProvider, a as AuthSession, G as GraphQLResult, N as NetworkProvider,
|
|
1
|
+
import { k as QuestionType, Q as QuestionObject, D as Difficulty, L as Language, l as Level, m as PaginatedList } from './notification-Ctfy0m05.cjs';
|
|
2
|
+
export { n as AIService, o as AIUsageLog, p as AddQuestionTagInput, A as Announcement, C as Chapter, b as CheckParticipationResponse, a as Contest, q as ContestAnswersResponse, r as ContestOption, s as ContestParticipant, t as ContestQuestion, u as ContestQuestionsResponse, v as ContestService, c as Course, w as CourseEnrolled, x as CourseEnrollmentRequest, d as CourseItem, y as CourseItemType, e as CourseLiveExam, z as CourseLiveExamParticipant, B as CourseLiveExamQuestionsResponse, E as CourseService, F as CreateAnnouncementInput, G as CreateContestInput, H as CreateCourseInput, I as CreateCourseItemInput, J as CreateCourseLiveExamInput, K as CreateCourseResponse, M as CreateCourseVideoInput, R as CreateCourseVideoResponse, V as CreatePackGroupInput, W as CreatePackInput, X as CreateQuestionInput, Y as CreateQuestionResponse, Z as CreateSubscriptionRequestInput, _ as CreateUserNotificationInput, $ as CurriculumService, a0 as DeleteCourseItemInput, a1 as EnrollStudentInput, a2 as EvaluateWrittenAnswerInput, a3 as EvaluateWrittenAnswerResponse, a4 as FormatLevelUpParams, a5 as GetSignedFileURLInput, a6 as GetSignedURLInput, a7 as LeaderboardResponse, a8 as LevelUpNotificationResult, a9 as ListByCurriculumInput, aa as ListByLevelInput, ab as ListByPublicExamInput, ac as ListByRandomHashInput, ad as ListPackGroupsInput, ae as ListSubscriptionRequestsInput, af as ListUsersInput, ag as MediaService, ah as MergeTimelineParams, ai as ModelType, aj as NewsArticle, ak as NewsService, al as NotificationService, N as NotificationTimelineItem, am as Option, O as OrjokClient, an as OrjokClientConfig, P as Pack, ao as PackExamResults, ap as PackGroup, aq as PackReport, ar as PackService, as as PackTag, at as PaymentMethod, au as PaymentStatus, av as PaymentTransaction, h as PracticeMetrics, aw as ProgressService, i as PublicExamOption, ax as QuestionReport, ay as QuestionService, az as QuestionTag, aA as QuestionTracking, aB as QuestionTrackingStatus, aC as QuestionVote, aD as SelectOption, aE as SendEnrollmentRequestInput, aF as SignedURLResponse, aG as SortDirection, aH as StatusIdResponse, aI as StatusResponse, S as Subject, aJ as SubmitPackExamInput, aK as SubscriptionRequest, aL as SubscriptionService, aM as Tag, aN as Tier, T as Topic, aO as TrackPracticeProgressInput, aP as UpdateSubscriptionRequestInput, aQ as UpdateUserAvatarInput, aR as UpdateUserNotificationInput, aS as UpdateUserProfileInput, aT as UploadCourseItemInput, aU as UploadImageResponse, aV as UploadVideoToBunnyInput, aW as User, f as UserChapterProgress, j as UserNotification, aX as UserService, U as UserSubjectProgress, aY as UserTopicMetric, g as UserTopicProgress, aZ as Verification, a_ as VerificationType, a$ as VoteInput, b0 as VoteType, b1 as aggregateChapterMetrics, b2 as aggregateSubjectMetrics, b3 as aggregateTopicMetrics, b4 as calculateAccuracy, b5 as calculateUnreadCount, b6 as createOrjokClient, b7 as difficultyOptions, b8 as formatLevelUpNotification, b9 as getPublicExamsByLevel, ba as isDifficultyMatch, bb as isLanguageMatch, bc as isValidMCQ, bd as languageOptions, be as levelOptions, bf as mergeNotificationTimeline, bg as publicExamOptions } from './notification-Ctfy0m05.cjs';
|
|
3
|
+
import { S as StorageProvider } from './storage-9pK8KwIM.cjs';
|
|
4
|
+
export { b as AuthEventListener, A as AuthProvider, a as AuthSession, G as GraphQLResult, N as NetworkProvider, c as UploadOptions, U as UserAttributes } from './storage-9pK8KwIM.cjs';
|
|
5
|
+
|
|
6
|
+
type RenderCategory = "Background" | "Hair Back" | "Skin Color Body" | "Skin Color Head" | "Skin Color" | "Clothes Back" | "Clothes Front" | "Accessories" | "Headwears" | "Facial Expression" | "Beard" | "Eyewear" | "Hair Front";
|
|
7
|
+
type UICategory = "Background" | "Hair" | "Skin Color" | "Clothes" | "Accessories" | "Headwears" | "Eyewear" | "Facial Expression" | "Beard";
|
|
8
|
+
interface ColorOption {
|
|
9
|
+
name: string;
|
|
10
|
+
filter: string;
|
|
11
|
+
hex: string;
|
|
12
|
+
brightness: number;
|
|
13
|
+
}
|
|
14
|
+
interface AvatarConfigItem {
|
|
15
|
+
raw_name: string;
|
|
16
|
+
safe_name: string;
|
|
17
|
+
base_name: string;
|
|
18
|
+
conditions: string[];
|
|
19
|
+
is_multicolor: boolean;
|
|
20
|
+
has_inner_color?: boolean;
|
|
21
|
+
brightness?: number;
|
|
22
|
+
hue?: number;
|
|
23
|
+
}
|
|
24
|
+
type AvatarConfig = Record<string, AvatarConfigItem[]>;
|
|
25
|
+
interface AvatarState {
|
|
26
|
+
selections: Record<string, string>;
|
|
27
|
+
colors: Record<string, string>;
|
|
28
|
+
gender?: string;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
declare const HAIR_COLORS: ColorOption[];
|
|
32
|
+
declare const CLOTHES_COLORS: ColorOption[];
|
|
33
|
+
declare const COLOR_HUES: Record<string, number>;
|
|
34
|
+
declare const RENDER_ORDER: readonly ["Background", "Hair Back", "Clothes Back", "Skin Color Body", "Clothes Front", "Skin Color Head", "Accessories", "Facial Expression", "Beard", "Hair Front", "Eyewear", "Headwears"];
|
|
35
|
+
declare const INITIAL_AVATAR_DATA: Record<UICategory, string[]>;
|
|
36
|
+
declare function getActualOptionFileName(category: string, baseName: string, config: AvatarConfig, selections: Record<string, string>): AvatarConfigItem | null;
|
|
37
|
+
declare function parseAvatarConfig(configStr: string | null | undefined): AvatarState;
|
|
38
|
+
declare function parseAvatarConfigWithDefaults(configStr: string | null | undefined, seed?: string): AvatarState;
|
|
39
|
+
declare function serializeAvatarConfig(state: AvatarState): string;
|
|
40
|
+
declare function generateRandomAvatarState(options?: {
|
|
41
|
+
gender?: "Male" | "Female";
|
|
42
|
+
seed?: string;
|
|
43
|
+
}): AvatarState;
|
|
44
|
+
declare function generateRandomAvatarConfig(options?: {
|
|
45
|
+
gender?: "Male" | "Female";
|
|
46
|
+
seed?: string;
|
|
47
|
+
}): string;
|
|
5
48
|
|
|
6
49
|
interface EloTier {
|
|
7
50
|
name: string;
|
|
@@ -35,6 +78,48 @@ declare function parseImageKeys(answer: string): string[];
|
|
|
35
78
|
declare function buildImageAnswer(keys: string[]): string;
|
|
36
79
|
declare function normalizeDifficulty(raw: string): Difficulty | undefined;
|
|
37
80
|
declare function detectQuestionType(option2: string, option3: string, option4: string): QuestionType;
|
|
81
|
+
declare function isCorrectAnswer(selected: string | null | undefined, correct: string | null | undefined): boolean;
|
|
82
|
+
declare function calculateDefaultExamMinutes(mode: ExamMode, questions: Array<{
|
|
83
|
+
type?: string | null;
|
|
84
|
+
}>): number;
|
|
85
|
+
declare function reorderObjectKeys<T>(obj: {
|
|
86
|
+
[key: number]: T;
|
|
87
|
+
}, oldIndex: number, newIndex: number, length: number): {
|
|
88
|
+
[key: number]: T;
|
|
89
|
+
};
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* Home Logic Utilities
|
|
93
|
+
* Supports Signed-In User Homepage customization, greeting, streak calculation, and level mapping.
|
|
94
|
+
*/
|
|
95
|
+
interface SubjectShortcut {
|
|
96
|
+
id: string;
|
|
97
|
+
name: string;
|
|
98
|
+
iconKey: string;
|
|
99
|
+
colorClass: string;
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* Maps Cognito user level string to standard level enum values: "SSC" | "HSC+Admission" | "BCS"
|
|
103
|
+
*/
|
|
104
|
+
declare function mapCognitoLevelToStandardLevel(cognitoLevel?: string | null): string;
|
|
105
|
+
/**
|
|
106
|
+
* Returns contextual time of day greeting
|
|
107
|
+
*/
|
|
108
|
+
declare function getTimeOfDayGreeting(customHour?: number, lang?: "en" | "bn"): {
|
|
109
|
+
greeting: string;
|
|
110
|
+
period: "morning" | "afternoon" | "evening" | "night";
|
|
111
|
+
};
|
|
112
|
+
/**
|
|
113
|
+
* Returns recommended subject shortcuts for the given level
|
|
114
|
+
*/
|
|
115
|
+
declare function getRecommendedSubjectsForLevel(level: string, lang?: "en" | "bn"): SubjectShortcut[];
|
|
116
|
+
/**
|
|
117
|
+
* Calculates continuous consecutive active study streak in days
|
|
118
|
+
*/
|
|
119
|
+
declare function calculateStreakFromDates(activityDates: string[]): {
|
|
120
|
+
streak: number;
|
|
121
|
+
isActiveToday: boolean;
|
|
122
|
+
};
|
|
38
123
|
|
|
39
124
|
interface ParsedQuestion {
|
|
40
125
|
id?: string;
|
|
@@ -51,6 +136,7 @@ interface ParsedQuestion {
|
|
|
51
136
|
subjectId?: string;
|
|
52
137
|
chapterId?: string;
|
|
53
138
|
topicId?: string;
|
|
139
|
+
publicExam?: string;
|
|
54
140
|
type: "MCQ" | "WRITTEN";
|
|
55
141
|
markingInstructions?: string;
|
|
56
142
|
answerImageUrl?: string;
|
|
@@ -80,26 +166,228 @@ declare function resolveMediaUrl(value: string | null | undefined, storage: Stor
|
|
|
80
166
|
declare function resolveMediaUrls<T extends Record<string, unknown>>(obj: T, fields: (keyof T)[], storage: StorageProvider | undefined, cache?: MediaUrlCache): Promise<T>;
|
|
81
167
|
declare function _resetMediaUrlWarning(): void;
|
|
82
168
|
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
169
|
+
type BillingCycle = "monthly" | "quarterly" | "biannually" | "annually";
|
|
170
|
+
type SubscriptionTier = "FREE" | "PRO" | "PRO_AI";
|
|
171
|
+
interface PlanCyclePricing {
|
|
172
|
+
monthly: number;
|
|
173
|
+
quarterly: number;
|
|
174
|
+
biannually: number;
|
|
175
|
+
annually: number;
|
|
176
|
+
}
|
|
177
|
+
interface PlanAiQuotaConfig {
|
|
178
|
+
monthly: {
|
|
179
|
+
aiEvals: number;
|
|
180
|
+
aiQuestions: number;
|
|
181
|
+
};
|
|
182
|
+
quarterly: {
|
|
183
|
+
aiEvals: number;
|
|
184
|
+
aiQuestions: number;
|
|
185
|
+
};
|
|
186
|
+
biannually: {
|
|
187
|
+
aiEvals: number;
|
|
188
|
+
aiQuestions: number;
|
|
189
|
+
};
|
|
190
|
+
annually: {
|
|
191
|
+
aiEvals: number;
|
|
192
|
+
aiQuestions: number;
|
|
193
|
+
};
|
|
194
|
+
}
|
|
195
|
+
interface SubscriptionPlan {
|
|
196
|
+
id: SubscriptionTier;
|
|
197
|
+
tier: SubscriptionTier;
|
|
198
|
+
titleKey: string;
|
|
199
|
+
descKey: string;
|
|
200
|
+
pricing: PlanCyclePricing;
|
|
201
|
+
aiQuotas: PlanAiQuotaConfig;
|
|
202
|
+
}
|
|
203
|
+
interface TopUpBoosterPack {
|
|
204
|
+
id: string;
|
|
205
|
+
type: "AI_EVAL" | "AI_QUESTION";
|
|
206
|
+
amount: number;
|
|
207
|
+
price: number;
|
|
208
|
+
titleKey: string;
|
|
209
|
+
descKey: string;
|
|
210
|
+
badgeKey?: string;
|
|
211
|
+
}
|
|
212
|
+
declare const MANUAL_PAYMENT_CONFIG: {
|
|
213
|
+
phoneNumber: string;
|
|
214
|
+
accountType: string;
|
|
215
|
+
methods: readonly ["BKASH", "ROCKET"];
|
|
216
|
+
};
|
|
217
|
+
declare const SUBSCRIPTION_PLANS: Record<SubscriptionTier, SubscriptionPlan>;
|
|
218
|
+
declare const AI_EVAL_BOOSTER_PACKS: TopUpBoosterPack[];
|
|
219
|
+
declare const AI_QUESTION_BOOSTER_PACKS: TopUpBoosterPack[];
|
|
220
|
+
declare function getCycleMultiplier(cycle: BillingCycle): number;
|
|
221
|
+
declare function getPlanOriginalPrice(tier: SubscriptionTier | string, cycle: BillingCycle): number;
|
|
222
|
+
declare function getPlanPrice(tier: SubscriptionTier | string, cycle: BillingCycle): number;
|
|
223
|
+
declare function getPlanMonthlyEquivalentPrice(tier: SubscriptionTier | string, cycle: BillingCycle): number;
|
|
224
|
+
declare function getPlanDiscountPercent(cycle: BillingCycle): number;
|
|
225
|
+
declare function getPlanAiQuotas(tier: SubscriptionTier | string, cycle: BillingCycle): {
|
|
226
|
+
aiEvals: number;
|
|
227
|
+
aiQuestions: number;
|
|
228
|
+
};
|
|
229
|
+
declare function isValidBangladeshiPhone(phone: string): boolean;
|
|
230
|
+
declare function isValidTrxId(trxId: string): boolean;
|
|
231
|
+
declare function hasProAccess(tier?: string | null, expiresAt?: string | null): boolean;
|
|
232
|
+
declare function hasAiTierAccess(tier?: string | null, expiresAt?: string | null): boolean;
|
|
233
|
+
declare const FREE_DAILY_PRACTICE_LIMIT = 30;
|
|
234
|
+
declare function canExportPack(tier?: string | null, expiresAt?: string | null, isCreator?: boolean): boolean;
|
|
235
|
+
declare function canAccessMistakeVault(tier?: string | null, expiresAt?: string | null, isCreator?: boolean): boolean;
|
|
236
|
+
declare function canWatchContestSolution(tier?: string | null, expiresAt?: string | null, isCreator?: boolean): boolean;
|
|
237
|
+
declare function shouldTrackPracticeProgress(tier?: string | null, expiresAt?: string | null, isCreator?: boolean): boolean;
|
|
238
|
+
declare function getDailyPracticeLimit(tier?: string | null, expiresAt?: string | null): number | null;
|
|
239
|
+
declare function checkDailyPracticeLimit(dailyCount: number, lastPracticeDate: string | null | undefined, tier?: string | null, expiresAt?: string | null, todayStr?: string): {
|
|
240
|
+
allowed: boolean;
|
|
241
|
+
remaining: number;
|
|
242
|
+
currentCount: number;
|
|
243
|
+
isUnlimited: boolean;
|
|
244
|
+
};
|
|
245
|
+
declare function hasSufficientAiQuestionQuota(quota: number | null | undefined, requested: number): boolean;
|
|
246
|
+
declare function hasSufficientAiEvalQuota(quota: number | null | undefined): boolean;
|
|
247
|
+
|
|
248
|
+
/**
|
|
249
|
+
* @file xp.ts
|
|
250
|
+
* @description Experience Points (XP) and Level progression logic for the Orjok platform.
|
|
251
|
+
*/
|
|
252
|
+
interface XpTier {
|
|
253
|
+
id: "novice" | "dedicated" | "skilled" | "master" | "grandmaster" | "legend";
|
|
254
|
+
minLevel: number;
|
|
255
|
+
maxLevel: number;
|
|
256
|
+
nameEn: string;
|
|
257
|
+
nameBn: string;
|
|
258
|
+
color: string;
|
|
259
|
+
badgeBg: string;
|
|
260
|
+
badgeBorder: string;
|
|
261
|
+
badgeText: string;
|
|
262
|
+
}
|
|
263
|
+
declare const XP_TIERS: XpTier[];
|
|
264
|
+
declare const XP_REWARDS: {
|
|
265
|
+
readonly PRACTICE_CORRECT: 10;
|
|
266
|
+
readonly PRACTICE_ATTEMPT: 2;
|
|
267
|
+
readonly PACK_EXAM_BASE: 20;
|
|
268
|
+
readonly PACK_EXAM_CORRECT: 5;
|
|
269
|
+
readonly PACK_EXAM_HIGH_SCORE_BONUS: 25;
|
|
270
|
+
readonly CONTEST_PARTICIPATION: 50;
|
|
271
|
+
readonly CONTEST_TOP_10_BONUS: 100;
|
|
272
|
+
readonly CONTEST_TOP_25_BONUS: 50;
|
|
273
|
+
readonly CREATE_QUESTION: 25;
|
|
274
|
+
readonly CREATE_PACK: 50;
|
|
275
|
+
readonly VOTE: 2;
|
|
276
|
+
readonly AI_EVALUATION: 15;
|
|
277
|
+
};
|
|
278
|
+
type XpRewardAction = "practice" | "packExam" | "contest" | "createQuestion" | "createPack" | "vote" | "aiEvaluation";
|
|
279
|
+
interface XpRewardMetadata {
|
|
280
|
+
isCorrect?: boolean;
|
|
281
|
+
correctCount?: number;
|
|
282
|
+
totalQuestions?: number;
|
|
283
|
+
rank?: number;
|
|
284
|
+
totalParticipants?: number;
|
|
285
|
+
}
|
|
286
|
+
interface XpProgressInfo {
|
|
287
|
+
level: number;
|
|
288
|
+
xp: number;
|
|
289
|
+
currentLevelXp: number;
|
|
290
|
+
nextLevelXp: number;
|
|
291
|
+
xpInLevel: number;
|
|
292
|
+
xpRequiredForLevel: number;
|
|
293
|
+
xpToNextLevel: number;
|
|
294
|
+
progressPercent: number;
|
|
295
|
+
tier: XpTier;
|
|
88
296
|
}
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
297
|
+
/**
|
|
298
|
+
* Calculates the total cumulative XP required to reach a specific level.
|
|
299
|
+
* Formula: 25 * (L^2 + L - 2) = 25 * (L - 1) * (L + 2)
|
|
300
|
+
* Level 1 = 0 XP
|
|
301
|
+
* Level 2 = 100 XP
|
|
302
|
+
* Level 3 = 250 XP
|
|
303
|
+
* Level 4 = 450 XP
|
|
304
|
+
* Level 5 = 700 XP
|
|
305
|
+
* Level 6 = 1000 XP
|
|
306
|
+
* Level 10 = 2700 XP
|
|
307
|
+
* Level 20 = 10450 XP
|
|
308
|
+
* Level 50 = 63700 XP
|
|
309
|
+
*/
|
|
310
|
+
declare function getXpForLevel(level: number): number;
|
|
311
|
+
/**
|
|
312
|
+
* Calculates the user's level based on cumulative XP.
|
|
313
|
+
* Derived by inverting: 25 * L^2 + 25 * L - (50 + XP) = 0
|
|
314
|
+
* L = floor((sqrt(9 + 0.16 * XP) - 1) / 2)
|
|
315
|
+
*/
|
|
316
|
+
declare function getLevelFromXp(xp: number): number;
|
|
317
|
+
/**
|
|
318
|
+
* Returns the XP required to advance from `level` to `level + 1`.
|
|
319
|
+
*/
|
|
320
|
+
declare function getXpRequiredForNextLevel(level: number): number;
|
|
321
|
+
/**
|
|
322
|
+
* Returns complete progress details for a given cumulative XP value.
|
|
323
|
+
*/
|
|
324
|
+
declare function getXpProgress(xp: number): XpProgressInfo;
|
|
325
|
+
/**
|
|
326
|
+
* Returns the tier metadata for a given level.
|
|
327
|
+
*/
|
|
328
|
+
declare function getXpTier(level: number): XpTier;
|
|
329
|
+
/**
|
|
330
|
+
* Returns all configured XP tiers.
|
|
331
|
+
*/
|
|
332
|
+
declare function getAllXpTiers(): XpTier[];
|
|
333
|
+
/**
|
|
334
|
+
* Calculates the XP reward for a given user activity.
|
|
335
|
+
*/
|
|
336
|
+
declare function calculateXpReward(action: XpRewardAction, metadata?: XpRewardMetadata): number;
|
|
337
|
+
|
|
338
|
+
type PrimaryTab = "home" | "learn" | "contests" | "courses" | "profile";
|
|
339
|
+
declare function getActiveTab(pathname: string): PrimaryTab;
|
|
340
|
+
declare function getCanonicalPath(pathname: string): string;
|
|
341
|
+
declare function isAuthGatedRoute(pathname: string): boolean;
|
|
93
342
|
|
|
94
343
|
declare function shuffle<T>(array: T[]): T[];
|
|
95
344
|
declare function shuffleInPlace<T>(array: T[]): void;
|
|
96
345
|
|
|
97
346
|
declare function engToBanglaNumber(num: number | string): string;
|
|
98
347
|
|
|
99
|
-
|
|
348
|
+
/**
|
|
349
|
+
* Splits a bilingual string formatted as "Bangla Name (English Name)"
|
|
350
|
+
* into the requested language ("bn" or "en").
|
|
351
|
+
* If the string does not follow the bilingual pattern, returns the clean string.
|
|
352
|
+
*/
|
|
353
|
+
declare function extractBilingualName(name: string, language?: "bn" | "en" | string): string;
|
|
354
|
+
declare function formatCurriculumName(idString: string, dbName?: string | null, language?: "bn" | "en" | string): string;
|
|
100
355
|
|
|
101
356
|
declare function getRelativeTime(startTime: string | Date, endTime?: string | Date): string;
|
|
102
357
|
|
|
103
358
|
declare function processLatexText(str: string): string;
|
|
104
359
|
|
|
105
|
-
|
|
360
|
+
interface TimeLeft {
|
|
361
|
+
days: number;
|
|
362
|
+
hours: number;
|
|
363
|
+
minutes: number;
|
|
364
|
+
seconds: number;
|
|
365
|
+
isEnded: boolean;
|
|
366
|
+
}
|
|
367
|
+
declare function convertToBangladeshTime(isoString: string, locale?: string): string;
|
|
368
|
+
declare function getDhakaNow(): Date;
|
|
369
|
+
declare function calculateTimeLeft(endTime: string | Date): TimeLeft;
|
|
370
|
+
declare function formatDate(date: Date | string, locale?: string): string;
|
|
371
|
+
|
|
372
|
+
declare function formatBDT(amount: number): string;
|
|
373
|
+
|
|
374
|
+
declare function getYouTubeId(url: string | null | undefined): string | null;
|
|
375
|
+
|
|
376
|
+
declare function sanitizeFileName(name: string): string;
|
|
377
|
+
|
|
378
|
+
declare function isQuestionLevel(value: unknown): value is Level;
|
|
379
|
+
declare function isLanguage(value: unknown): value is Language;
|
|
380
|
+
declare function isDifficulty(value: unknown): value is Difficulty;
|
|
381
|
+
declare function normalizeLevel(value?: string | null): string;
|
|
382
|
+
|
|
383
|
+
/**
|
|
384
|
+
* Accumulates items across paginated GraphQL queries until targetLimit is reached
|
|
385
|
+
* or nextToken is exhausted (null/undefined).
|
|
386
|
+
*
|
|
387
|
+
* This guarantees that even when DynamoDB evaluates filter expressions post-read
|
|
388
|
+
* and yields fewer than requested items in a single scan batch, the consumer
|
|
389
|
+
* receives up to `targetLimit` matching items and the exact continuation token.
|
|
390
|
+
*/
|
|
391
|
+
declare function paginateWithAccumulator<T>(fetchPage: (limit: number, nextToken?: string | null) => Promise<PaginatedList<T>>, targetLimit?: number, initialNextToken?: string | null, maxIterations?: number): Promise<PaginatedList<T>>;
|
|
392
|
+
|
|
393
|
+
export { AI_EVAL_BOOSTER_PACKS, AI_QUESTION_BOOSTER_PACKS, type AvatarConfig, type AvatarConfigItem, type AvatarState, type BillingCycle, CLOTHES_COLORS, COLOR_HUES, type ColorOption, Difficulty, type EloTier, type ExamConfig, type ExamMode, FREE_DAILY_PRACTICE_LIMIT, HAIR_COLORS, INITIAL_AVATAR_DATA, Language, Level, MANUAL_PAYMENT_CONFIG, MediaUrlCache, PaginatedList, type ParseResult, type ParsedQuestion, type PlanAiQuotaConfig, type PlanCyclePricing, type PrimaryTab, QuestionObject, QuestionType, RENDER_ORDER, type RatingField, type RenderCategory, SUBSCRIPTION_PLANS, StorageProvider, type SubjectShortcut, type SubscriptionPlan, type SubscriptionTier, type TimeLeft, type TopUpBoosterPack, type UICategory, XP_REWARDS, XP_TIERS, type XpProgressInfo, type XpRewardAction, type XpRewardMetadata, type XpTier, _resetMediaUrlWarning, buildImageAnswer, calculateDefaultExamMinutes, calculateExamTime, calculateStreakFromDates, calculateTimeLeft, calculateXpReward, canAccessMistakeVault, canExportPack, canWatchContestSolution, checkDailyPracticeLimit, computeRatingDelta, convertToBangladeshTime, detectQuestionType, engToBanglaNumber, extractBilingualName, filterQuestionsByMode, formatBDT, formatCurriculumName, formatDate, formatExamTime, formatQuestionsToCsv, formatQuestionsToText, generateRandomAvatarConfig, generateRandomAvatarState, getActiveTab, getActualOptionFileName, getAllTiers, getAllXpTiers, getCanonicalPath, getCycleMultiplier, getDailyPracticeLimit, getDhakaNow, getEloProgress, getEloTier, getLevelFromXp, getPlanAiQuotas, getPlanDiscountPercent, getPlanMonthlyEquivalentPrice, getPlanOriginalPrice, getPlanPrice, getRatingForSubject, getRecommendedSubjectsForLevel, getRelativeTime, getTimeOfDayGreeting, getXpForLevel, getXpProgress, getXpRequiredForNextLevel, getXpTier, getYouTubeId, hasAiTierAccess, hasProAccess, hasSufficientAiEvalQuota, hasSufficientAiQuestionQuota, isAuthGatedRoute, isCorrectAnswer, isDifficulty, isImageAnswer, isLanguage, isQuestionLevel, isStorageKey, isValidBangladeshiPhone, isValidTrxId, mapCognitoLevelToStandardLevel, normalizeDifficulty, normalizeLevel, paginateWithAccumulator, parseAvatarConfig, parseAvatarConfigWithDefaults, parseCsvQuestions, parseImageKeys, parseTextQuestions, processLatexText, reorderObjectKeys, resolveMediaUrl, resolveMediaUrls, sanitizeFileName, scoreExam, serializeAvatarConfig, shouldTrackPracticeProgress, shuffle, shuffleInPlace };
|