@webority/mobile-core 0.127.0 → 0.129.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 +2 -0
- package/lib/commonjs/formatters/currency.js +1 -1
- package/lib/commonjs/formatters/house.js +1 -1
- package/lib/commonjs/index.js +1 -1
- package/lib/commonjs/india/aadhaar.js +1 -0
- package/lib/commonjs/india/financialYear.js +1 -0
- package/lib/commonjs/india/gstStates.g.js +1 -0
- package/lib/commonjs/india/gstin.js +1 -0
- package/lib/commonjs/india/ifsc.js +1 -0
- package/lib/commonjs/india/index.js +1 -0
- package/lib/commonjs/india/indiaTime.js +1 -0
- package/lib/commonjs/india/indianMobile.js +1 -0
- package/lib/commonjs/india/nicDivisions.g.js +1 -0
- package/lib/commonjs/india/paise.js +1 -0
- package/lib/commonjs/india/pan.js +1 -0
- package/lib/commonjs/india/pincode.js +1 -0
- package/lib/commonjs/india/text.js +1 -0
- package/lib/commonjs/india/vectors.g.json +660 -0
- package/lib/commonjs/validators/index.js +1 -1
- package/lib/module/formatters/currency.js +1 -1
- package/lib/module/formatters/house.js +1 -1
- package/lib/module/index.js +1 -1
- package/lib/module/india/aadhaar.js +1 -0
- package/lib/module/india/financialYear.js +1 -0
- package/lib/module/india/gstStates.g.js +1 -0
- package/lib/module/india/gstin.js +1 -0
- package/lib/module/india/ifsc.js +1 -0
- package/lib/module/india/index.js +1 -0
- package/lib/module/india/indiaTime.js +1 -0
- package/lib/module/india/indianMobile.js +1 -0
- package/lib/module/india/nicDivisions.g.js +1 -0
- package/lib/module/india/paise.js +1 -0
- package/lib/module/india/pan.js +1 -0
- package/lib/module/india/pincode.js +1 -0
- package/lib/module/india/text.js +1 -0
- package/lib/module/india/vectors.g.json +660 -0
- package/lib/module/validators/index.js +1 -1
- package/lib/typescript/commonjs/formatters/currency.d.ts +5 -5
- package/lib/typescript/commonjs/formatters/house.d.ts +38 -3
- package/lib/typescript/commonjs/index.d.ts +1 -1
- package/lib/typescript/commonjs/india/aadhaar.d.ts +6 -0
- package/lib/typescript/commonjs/india/financialYear.d.ts +14 -0
- package/lib/typescript/commonjs/india/gstStates.g.d.ts +13 -0
- package/lib/typescript/commonjs/india/gstin.d.ts +11 -0
- package/lib/typescript/commonjs/india/ifsc.d.ts +3 -0
- package/lib/typescript/commonjs/india/index.d.ts +14 -0
- package/lib/typescript/commonjs/india/indiaTime.d.ts +7 -0
- package/lib/typescript/commonjs/india/indianMobile.d.ts +4 -0
- package/lib/typescript/commonjs/india/nicDivisions.g.d.ts +8 -0
- package/lib/typescript/commonjs/india/paise.d.ts +13 -0
- package/lib/typescript/commonjs/india/pan.d.ts +4 -0
- package/lib/typescript/commonjs/india/pincode.d.ts +3 -0
- package/lib/typescript/commonjs/india/text.d.ts +9 -0
- package/lib/typescript/commonjs/validators/index.d.ts +1 -17
- package/lib/typescript/module/formatters/currency.d.ts +5 -5
- package/lib/typescript/module/formatters/house.d.ts +38 -3
- package/lib/typescript/module/index.d.ts +1 -1
- package/lib/typescript/module/india/aadhaar.d.ts +6 -0
- package/lib/typescript/module/india/financialYear.d.ts +14 -0
- package/lib/typescript/module/india/gstStates.g.d.ts +13 -0
- package/lib/typescript/module/india/gstin.d.ts +11 -0
- package/lib/typescript/module/india/ifsc.d.ts +3 -0
- package/lib/typescript/module/india/index.d.ts +14 -0
- package/lib/typescript/module/india/indiaTime.d.ts +7 -0
- package/lib/typescript/module/india/indianMobile.d.ts +4 -0
- package/lib/typescript/module/india/nicDivisions.g.d.ts +8 -0
- package/lib/typescript/module/india/paise.d.ts +13 -0
- package/lib/typescript/module/india/pan.d.ts +4 -0
- package/lib/typescript/module/india/pincode.d.ts +3 -0
- package/lib/typescript/module/india/text.d.ts +9 -0
- package/lib/typescript/module/validators/index.d.ts +1 -17
- package/package.json +31 -1
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
* `signDisplay`, ...), passed through to Intl.NumberFormat.
|
|
4
4
|
*/
|
|
5
5
|
export interface FormatCurrencyOptions extends Omit<Intl.NumberFormatOptions, "style" | "currency"> {
|
|
6
|
-
/** ISO 4217 currency code.
|
|
7
|
-
currency
|
|
6
|
+
/** ISO 4217 currency code. Required: a missing or empty one throws a TypeError. */
|
|
7
|
+
currency: string;
|
|
8
8
|
/** BCP-47 locale tag. Defaults to the configured locale, else `'en-IN'` (Indian numbering system). */
|
|
9
9
|
locale?: string;
|
|
10
10
|
/** Minimum fraction digits. Defaults to 0 for whole amounts, else the currency's own (2 for INR, 0 for JPY). */
|
|
@@ -20,8 +20,8 @@ export interface FormatCurrencyOptions extends Omit<Intl.NumberFormatOptions, "s
|
|
|
20
20
|
empty?: string;
|
|
21
21
|
}
|
|
22
22
|
/**
|
|
23
|
-
* Format an amount as currency. Pass an ISO 4217 code: a missing or empty one
|
|
24
|
-
*
|
|
23
|
+
* Format an amount as currency. Pass an ISO 4217 code on every call: a missing or empty one
|
|
24
|
+
* throws a TypeError. Amounts print with Indian numbering (`en-IN`) unless a locale is configured.
|
|
25
25
|
* With `{ currency: 'INR' }`: "₹1,50,000" for 150000, "₹1,234.50" for 1234.5, and `''` for a
|
|
26
26
|
* missing amount.
|
|
27
27
|
* Once the app configures a locale (`configureFormatters({ locale })`), the amount is
|
|
@@ -38,5 +38,5 @@ export interface FormatCurrencyOptions extends Omit<Intl.NumberFormatOptions, "s
|
|
|
38
38
|
* formatCurrency(150000, { currency: 'INR', stripSymbol: true }) // 1,50,000
|
|
39
39
|
* formatCurrency(1500000, { currency: 'INR', notation: 'compact' }) // ₹15L
|
|
40
40
|
*/
|
|
41
|
-
export declare const formatCurrency: (amount: number | string | null | undefined, options
|
|
41
|
+
export declare const formatCurrency: (amount: number | string | null | undefined, options: FormatCurrencyOptions) => string;
|
|
42
42
|
//# sourceMappingURL=currency.d.ts.map
|
|
@@ -1,3 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The house formatters: DD-MMM-YYYY dates, IST by default or the viewer's own
|
|
3
|
+
* zone with a label, Indian digit grouping by default, money in minor units,
|
|
4
|
+
* and one empty placeholder. Byte-identical in @webority/mobile-core and
|
|
5
|
+
* @webority/web-core.
|
|
6
|
+
*
|
|
7
|
+
* Same output on Hermes and in every browser is the design constraint, so the
|
|
8
|
+
* text is assembled here rather than by Intl. Engines disagree on month
|
|
9
|
+
* abbreviations ("Sep" or "Sept"), on the space before AM/PM (a plain or a
|
|
10
|
+
* narrow no-break space), on zone names ("IST" or "GMT+5:30") and on which
|
|
11
|
+
* Intl options exist at all (Hermes has no RelativeTimeFormat and no
|
|
12
|
+
* trailingZeroDisplay). IST and the viewer's zone are therefore computed with
|
|
13
|
+
* plain Date arithmetic; Intl is used only to read the wall clock of an
|
|
14
|
+
* explicitly named IANA zone, through formatToParts with numeric fields, to
|
|
15
|
+
* read the locale's 12- or 24-hour clock, and where a caller asks for Intl
|
|
16
|
+
* output itself (Intl number options, `formatRelative({ intl: true })`).
|
|
17
|
+
*
|
|
18
|
+
* Called with no options (house defaults: zone IST, locale en-IN, empty "-"):
|
|
19
|
+
* - formatDate(v) "08-Apr-2026"; formatTime(v) "8:05 PM"; formatDateTime(v) "08-Apr-2026, 8:05 PM";
|
|
20
|
+
* - formatRelative(v) "5 minutes ago", "in 3 days", "just now";
|
|
21
|
+
* - formatNumber(v) "1,23,456.789" (Indian grouping, up to 3 decimals);
|
|
22
|
+
* - formatPercent(0.42) "42%"; formatMinor(15000000, { currency: "INR" }) "₹1,50,000.00";
|
|
23
|
+
* - a missing or unreadable value "-".
|
|
24
|
+
* formatMinor needs a currency and throws without one.
|
|
25
|
+
*
|
|
26
|
+
* With a configured locale (`configureFormatters({ locale })`), the words and separators come
|
|
27
|
+
* from Intl for that locale and the date order stays DD-MMM-YYYY. For en-IN in the viewer zone:
|
|
28
|
+
* "08-Sept-2026", "08:05 pm", "08-Sept-2026, 08:05 pm IST", "yesterday", "12,34,567.891",
|
|
29
|
+
* "₹1,50,000". For de-DE: "08-Sept-2026", "20:05", "1.234.567,891".
|
|
30
|
+
*
|
|
31
|
+
* A configured `numberStyle` puts its decimal mark and group separator in every number and amount,
|
|
32
|
+
* whichever path wrote it: "1.23.456,789" for `'CommaWithPointGroups'` with the house text. A
|
|
33
|
+
* configured `dateOrder` other than DD-MMM-YYYY writes the date as digits from the wall clock,
|
|
34
|
+
* in every locale: "08/04/2026", "04/08/2026", "2026-04-08".
|
|
35
|
+
*/
|
|
1
36
|
import { type NumberGrouping, type ZoneMode } from "./formatConfig";
|
|
2
37
|
/** A date the house formatters accept; null, undefined and "" read as missing. */
|
|
3
38
|
export type DateValue = Date | string | number | null | undefined;
|
|
@@ -62,8 +97,8 @@ export interface FormatPercentOptions extends FormatNumberOptions {
|
|
|
62
97
|
scale?: "ratio" | "percent";
|
|
63
98
|
}
|
|
64
99
|
export interface FormatMinorOptions {
|
|
65
|
-
/** ISO 4217 code.
|
|
66
|
-
currency
|
|
100
|
+
/** ISO 4217 code. Required: a missing or empty one throws a TypeError. */
|
|
101
|
+
currency: string;
|
|
67
102
|
/** Defaults to Indian grouping for INR and international grouping for every other currency. */
|
|
68
103
|
grouping?: NumberGrouping;
|
|
69
104
|
/** Print a whole amount without its zero decimals: "₹1,500" instead of "₹1,500.00". */
|
|
@@ -110,5 +145,5 @@ export declare const formatPercent: (value: number | string | null | undefined,
|
|
|
110
145
|
* minor unit. A currency without a known symbol prints its code: "AED 1,000.00".
|
|
111
146
|
* With a configured locale, Intl writes it in that locale ("150.000,00 €" for de-DE).
|
|
112
147
|
*/
|
|
113
|
-
export declare const formatMinor: (amountMinor: number | string | null | undefined, options
|
|
148
|
+
export declare const formatMinor: (amountMinor: number | string | null | undefined, options: FormatMinorOptions) => string;
|
|
114
149
|
//# sourceMappingURL=house.d.ts.map
|
|
@@ -79,7 +79,7 @@ export type { AsyncStorageLike, StorageApi } from "./storage";
|
|
|
79
79
|
export { isStorageAvailable, Storage, setStorageImplementation } from "./storage";
|
|
80
80
|
export { encodeBase64 } from "./utils/base64";
|
|
81
81
|
export type { PasswordRules } from "./validators";
|
|
82
|
-
export {
|
|
82
|
+
export { isAlphanumeric, isBetween, isEmail, isHexColor, isInteger, isNonEmpty, isNumeric, isPhone, isStrongPassword, isUrl, maxLength, minLength, } from "./validators";
|
|
83
83
|
export type { DeviceInfoLike, ParsedVersion, Platform, UpdateInfo, UpdateType, VersionCheckResult, VersionCheckType, VersionComparison, VersionData, } from "./versionCheck";
|
|
84
84
|
export { isBuildBelowMinimum, parseBuildNumber, setDeviceInfoImplementation, useVersionCheck, VersionCheck, } from "./versionCheck";
|
|
85
85
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export declare const normalizeAadhaar: (value: unknown) => string | null;
|
|
2
|
+
export declare const isAadhaar: (value: unknown) => boolean;
|
|
3
|
+
export declare const maskAadhaar: (value: unknown) => string | null;
|
|
4
|
+
/** The last four digits of a valid Aadhaar number, or null when it is not valid. */
|
|
5
|
+
export declare const aadhaarLastFour: (value: unknown) => string | null;
|
|
6
|
+
//# sourceMappingURL=aadhaar.d.ts.map
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export interface FinancialYear {
|
|
2
|
+
startYear: number;
|
|
3
|
+
label: string;
|
|
4
|
+
displayLabel: string;
|
|
5
|
+
assessmentYearLabel: string;
|
|
6
|
+
startDate: string;
|
|
7
|
+
endDate: string;
|
|
8
|
+
}
|
|
9
|
+
export declare const financialYearLabel: (startYear: number) => string;
|
|
10
|
+
export declare const financialYearOf: (date: Date) => FinancialYear;
|
|
11
|
+
export declare const currentFinancialYear: (now?: Date) => FinancialYear;
|
|
12
|
+
export declare const parseFinancialYear: (value: unknown) => FinancialYear | null;
|
|
13
|
+
export declare const recentFinancialYears: (count: number, now?: Date) => FinancialYear[];
|
|
14
|
+
//# sourceMappingURL=financialYear.d.ts.map
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export type GstStateStatus = "Current" | "Retired";
|
|
2
|
+
export interface GstState {
|
|
3
|
+
code: string;
|
|
4
|
+
name: string;
|
|
5
|
+
status: GstStateStatus;
|
|
6
|
+
replacedByCode?: string;
|
|
7
|
+
aliases: readonly string[];
|
|
8
|
+
}
|
|
9
|
+
export declare const GST_STATES: readonly GstState[];
|
|
10
|
+
export declare const findGstState: (code: unknown) => GstState | null;
|
|
11
|
+
export declare const gstStateByName: (name: unknown) => GstState | null;
|
|
12
|
+
export declare const currentGstStates: () => readonly GstState[];
|
|
13
|
+
//# sourceMappingURL=gstStates.g.d.ts.map
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { type GstState } from "./gstStates.g";
|
|
2
|
+
export type GstinProblem = "pattern" | "stateCode" | "checkCharacter";
|
|
3
|
+
export declare const normalizeGstin: (value: unknown) => string | null;
|
|
4
|
+
export declare const gstinProblem: (value: unknown) => GstinProblem | null;
|
|
5
|
+
export declare const isGstin: (value: unknown) => boolean;
|
|
6
|
+
export declare const sanitizeGstinInput: (value: unknown) => string;
|
|
7
|
+
export declare const gstinStateCode: (value: unknown) => string | null;
|
|
8
|
+
/** The GST state row of a valid GSTIN (a retired code returns its Retired row), or null when the GSTIN is not valid. */
|
|
9
|
+
export declare const gstinState: (value: unknown) => GstState | null;
|
|
10
|
+
export declare const gstinHolderPan: (value: unknown) => string | null;
|
|
11
|
+
//# sourceMappingURL=gstin.d.ts.map
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export { aadhaarLastFour, isAadhaar, maskAadhaar, normalizeAadhaar } from "./aadhaar";
|
|
2
|
+
export type { FinancialYear } from "./financialYear";
|
|
3
|
+
export { currentFinancialYear, financialYearLabel, financialYearOf, parseFinancialYear, recentFinancialYears } from "./financialYear";
|
|
4
|
+
export type { GstinProblem } from "./gstin";
|
|
5
|
+
export { gstinHolderPan, gstinProblem, gstinState, gstinStateCode, isGstin, normalizeGstin, sanitizeGstinInput } from "./gstin";
|
|
6
|
+
export type { GstState, GstStateStatus } from "./gstStates.g";
|
|
7
|
+
export { isIfsc, normalizeIfsc } from "./ifsc";
|
|
8
|
+
export { formatIndianMobile, isIndianMobile, normalizeIndianMobile } from "./indianMobile";
|
|
9
|
+
export { istDateOf, istDayBoundsUtc, istToday } from "./indiaTime";
|
|
10
|
+
export type { NicDivision } from "./nicDivisions.g";
|
|
11
|
+
export { formatPaise, formatRupees, PAISE_PER_RUPEE, paiseFromRupees } from "./paise";
|
|
12
|
+
export { isPan, maskPan, normalizePan } from "./pan";
|
|
13
|
+
export { isPincode, normalizePincode } from "./pincode";
|
|
14
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export interface NicDivision {
|
|
2
|
+
code: string;
|
|
3
|
+
section: string;
|
|
4
|
+
title: string;
|
|
5
|
+
}
|
|
6
|
+
export declare const NIC_DIVISIONS: readonly NicDivision[];
|
|
7
|
+
export declare const findNicDivision: (code: unknown) => NicDivision | null;
|
|
8
|
+
//# sourceMappingURL=nicDivisions.g.d.ts.map
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/** Paise in one rupee. */
|
|
2
|
+
export declare const PAISE_PER_RUPEE = 100;
|
|
3
|
+
/**
|
|
4
|
+
* The amount in paise of a rupee amount, read from the number's decimal text so no float multiplication can shift a paisa.
|
|
5
|
+
* Throws a RangeError for a fraction of a paisa (1.005), a non-finite number, an exponent form (1e21) or an amount beyond the safe integer range;
|
|
6
|
+
* round the amount by the rule that applies first.
|
|
7
|
+
*/
|
|
8
|
+
export declare const paiseFromRupees: (rupees: number) => number;
|
|
9
|
+
/** Two-decimal text with lakh and crore grouping: ₹1,50,000.00 and -₹12.50. The rupee sign is dropped when `symbol` is false. */
|
|
10
|
+
export declare const formatPaise: (paise: number, symbol?: boolean) => string;
|
|
11
|
+
/** Whole rupees for display, half away from zero: ₹2,50,00,000 and -₹13 for -1250. An amount that rounds to zero prints without a sign. */
|
|
12
|
+
export declare const formatRupees: (paise: number) => string;
|
|
13
|
+
//# sourceMappingURL=paise.d.ts.map
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The value with every space (U+0020) removed and its ends trimmed, or null when it is not a string or is blank.
|
|
3
|
+
* This is the server's Normalize for GSTIN, PAN, IFSC and PIN code (Aadhaar also drops hyphens): a tab or a
|
|
4
|
+
* no-break space inside the value is NOT removed, so such a value fails the shape check as it does on the server.
|
|
5
|
+
*/
|
|
6
|
+
export declare const withoutSpaces: (value: unknown) => string | null;
|
|
7
|
+
/** Upper-cases ASCII letters only. Full Unicode upper-casing turns "ß" into "SS" and could lengthen a value into a valid shape. */
|
|
8
|
+
export declare const upperAscii: (text: string) => string;
|
|
9
|
+
//# sourceMappingURL=text.d.ts.map
|
|
@@ -7,15 +7,9 @@
|
|
|
7
7
|
*/
|
|
8
8
|
export declare const isNonEmpty: (value: unknown) => boolean;
|
|
9
9
|
export declare const isEmail: (value: unknown) => boolean;
|
|
10
|
-
/**
|
|
11
|
-
* Validate an Indian mobile number. Accepts:
|
|
12
|
-
* - 10-digit number starting with 6-9
|
|
13
|
-
* - Optional `+91` or `91` country code prefix
|
|
14
|
-
*/
|
|
15
|
-
export declare const isIndianMobile: (value: unknown) => boolean;
|
|
16
10
|
/**
|
|
17
11
|
* Generic phone validator: 7–15 digits, optional `+` prefix.
|
|
18
|
-
* Use `isIndianMobile` when you specifically need an Indian mobile number.
|
|
12
|
+
* Use `isIndianMobile` from `@webority/mobile-core/india` when you specifically need an Indian mobile number.
|
|
19
13
|
*/
|
|
20
14
|
export declare const isPhone: (value: unknown) => boolean;
|
|
21
15
|
export declare const isUrl: (value: unknown) => boolean;
|
|
@@ -34,16 +28,6 @@ export interface PasswordRules {
|
|
|
34
28
|
* one uppercase, one lowercase, one digit.
|
|
35
29
|
*/
|
|
36
30
|
export declare const isStrongPassword: (value: unknown, rules?: PasswordRules) => boolean;
|
|
37
|
-
export declare const isIndianPincode: (value: unknown) => boolean;
|
|
38
|
-
export declare const isPan: (value: unknown) => boolean;
|
|
39
|
-
export declare const isGstin: (value: unknown) => boolean;
|
|
40
|
-
/**
|
|
41
|
-
* The same rules the Webority servers apply: spaces and hyphens stripped (as
|
|
42
|
-
* printed on the card), twelve digits, no leading 0 or 1, and a correct
|
|
43
|
-
* Verhoeff check digit.
|
|
44
|
-
*/
|
|
45
|
-
export declare const isAadhaar: (value: unknown) => boolean;
|
|
46
|
-
export declare const isIfsc: (value: unknown) => boolean;
|
|
47
31
|
export declare const isHexColor: (value: unknown) => boolean;
|
|
48
32
|
export declare const isBetween: (value: unknown, min: number, max: number, inclusive?: boolean) => boolean;
|
|
49
33
|
export declare const minLength: (value: unknown, length: number) => boolean;
|
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
* `signDisplay`, ...), passed through to Intl.NumberFormat.
|
|
4
4
|
*/
|
|
5
5
|
export interface FormatCurrencyOptions extends Omit<Intl.NumberFormatOptions, "style" | "currency"> {
|
|
6
|
-
/** ISO 4217 currency code.
|
|
7
|
-
currency
|
|
6
|
+
/** ISO 4217 currency code. Required: a missing or empty one throws a TypeError. */
|
|
7
|
+
currency: string;
|
|
8
8
|
/** BCP-47 locale tag. Defaults to the configured locale, else `'en-IN'` (Indian numbering system). */
|
|
9
9
|
locale?: string;
|
|
10
10
|
/** Minimum fraction digits. Defaults to 0 for whole amounts, else the currency's own (2 for INR, 0 for JPY). */
|
|
@@ -20,8 +20,8 @@ export interface FormatCurrencyOptions extends Omit<Intl.NumberFormatOptions, "s
|
|
|
20
20
|
empty?: string;
|
|
21
21
|
}
|
|
22
22
|
/**
|
|
23
|
-
* Format an amount as currency. Pass an ISO 4217 code: a missing or empty one
|
|
24
|
-
*
|
|
23
|
+
* Format an amount as currency. Pass an ISO 4217 code on every call: a missing or empty one
|
|
24
|
+
* throws a TypeError. Amounts print with Indian numbering (`en-IN`) unless a locale is configured.
|
|
25
25
|
* With `{ currency: 'INR' }`: "₹1,50,000" for 150000, "₹1,234.50" for 1234.5, and `''` for a
|
|
26
26
|
* missing amount.
|
|
27
27
|
* Once the app configures a locale (`configureFormatters({ locale })`), the amount is
|
|
@@ -38,5 +38,5 @@ export interface FormatCurrencyOptions extends Omit<Intl.NumberFormatOptions, "s
|
|
|
38
38
|
* formatCurrency(150000, { currency: 'INR', stripSymbol: true }) // 1,50,000
|
|
39
39
|
* formatCurrency(1500000, { currency: 'INR', notation: 'compact' }) // ₹15L
|
|
40
40
|
*/
|
|
41
|
-
export declare const formatCurrency: (amount: number | string | null | undefined, options
|
|
41
|
+
export declare const formatCurrency: (amount: number | string | null | undefined, options: FormatCurrencyOptions) => string;
|
|
42
42
|
//# sourceMappingURL=currency.d.ts.map
|
|
@@ -1,3 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The house formatters: DD-MMM-YYYY dates, IST by default or the viewer's own
|
|
3
|
+
* zone with a label, Indian digit grouping by default, money in minor units,
|
|
4
|
+
* and one empty placeholder. Byte-identical in @webority/mobile-core and
|
|
5
|
+
* @webority/web-core.
|
|
6
|
+
*
|
|
7
|
+
* Same output on Hermes and in every browser is the design constraint, so the
|
|
8
|
+
* text is assembled here rather than by Intl. Engines disagree on month
|
|
9
|
+
* abbreviations ("Sep" or "Sept"), on the space before AM/PM (a plain or a
|
|
10
|
+
* narrow no-break space), on zone names ("IST" or "GMT+5:30") and on which
|
|
11
|
+
* Intl options exist at all (Hermes has no RelativeTimeFormat and no
|
|
12
|
+
* trailingZeroDisplay). IST and the viewer's zone are therefore computed with
|
|
13
|
+
* plain Date arithmetic; Intl is used only to read the wall clock of an
|
|
14
|
+
* explicitly named IANA zone, through formatToParts with numeric fields, to
|
|
15
|
+
* read the locale's 12- or 24-hour clock, and where a caller asks for Intl
|
|
16
|
+
* output itself (Intl number options, `formatRelative({ intl: true })`).
|
|
17
|
+
*
|
|
18
|
+
* Called with no options (house defaults: zone IST, locale en-IN, empty "-"):
|
|
19
|
+
* - formatDate(v) "08-Apr-2026"; formatTime(v) "8:05 PM"; formatDateTime(v) "08-Apr-2026, 8:05 PM";
|
|
20
|
+
* - formatRelative(v) "5 minutes ago", "in 3 days", "just now";
|
|
21
|
+
* - formatNumber(v) "1,23,456.789" (Indian grouping, up to 3 decimals);
|
|
22
|
+
* - formatPercent(0.42) "42%"; formatMinor(15000000, { currency: "INR" }) "₹1,50,000.00";
|
|
23
|
+
* - a missing or unreadable value "-".
|
|
24
|
+
* formatMinor needs a currency and throws without one.
|
|
25
|
+
*
|
|
26
|
+
* With a configured locale (`configureFormatters({ locale })`), the words and separators come
|
|
27
|
+
* from Intl for that locale and the date order stays DD-MMM-YYYY. For en-IN in the viewer zone:
|
|
28
|
+
* "08-Sept-2026", "08:05 pm", "08-Sept-2026, 08:05 pm IST", "yesterday", "12,34,567.891",
|
|
29
|
+
* "₹1,50,000". For de-DE: "08-Sept-2026", "20:05", "1.234.567,891".
|
|
30
|
+
*
|
|
31
|
+
* A configured `numberStyle` puts its decimal mark and group separator in every number and amount,
|
|
32
|
+
* whichever path wrote it: "1.23.456,789" for `'CommaWithPointGroups'` with the house text. A
|
|
33
|
+
* configured `dateOrder` other than DD-MMM-YYYY writes the date as digits from the wall clock,
|
|
34
|
+
* in every locale: "08/04/2026", "04/08/2026", "2026-04-08".
|
|
35
|
+
*/
|
|
1
36
|
import { type NumberGrouping, type ZoneMode } from "./formatConfig.js";
|
|
2
37
|
/** A date the house formatters accept; null, undefined and "" read as missing. */
|
|
3
38
|
export type DateValue = Date | string | number | null | undefined;
|
|
@@ -62,8 +97,8 @@ export interface FormatPercentOptions extends FormatNumberOptions {
|
|
|
62
97
|
scale?: "ratio" | "percent";
|
|
63
98
|
}
|
|
64
99
|
export interface FormatMinorOptions {
|
|
65
|
-
/** ISO 4217 code.
|
|
66
|
-
currency
|
|
100
|
+
/** ISO 4217 code. Required: a missing or empty one throws a TypeError. */
|
|
101
|
+
currency: string;
|
|
67
102
|
/** Defaults to Indian grouping for INR and international grouping for every other currency. */
|
|
68
103
|
grouping?: NumberGrouping;
|
|
69
104
|
/** Print a whole amount without its zero decimals: "₹1,500" instead of "₹1,500.00". */
|
|
@@ -110,5 +145,5 @@ export declare const formatPercent: (value: number | string | null | undefined,
|
|
|
110
145
|
* minor unit. A currency without a known symbol prints its code: "AED 1,000.00".
|
|
111
146
|
* With a configured locale, Intl writes it in that locale ("150.000,00 €" for de-DE).
|
|
112
147
|
*/
|
|
113
|
-
export declare const formatMinor: (amountMinor: number | string | null | undefined, options
|
|
148
|
+
export declare const formatMinor: (amountMinor: number | string | null | undefined, options: FormatMinorOptions) => string;
|
|
114
149
|
//# sourceMappingURL=house.d.ts.map
|
|
@@ -79,7 +79,7 @@ export type { AsyncStorageLike, StorageApi } from "./storage/index.js";
|
|
|
79
79
|
export { isStorageAvailable, Storage, setStorageImplementation } from "./storage/index.js";
|
|
80
80
|
export { encodeBase64 } from "./utils/base64.js";
|
|
81
81
|
export type { PasswordRules } from "./validators/index.js";
|
|
82
|
-
export {
|
|
82
|
+
export { isAlphanumeric, isBetween, isEmail, isHexColor, isInteger, isNonEmpty, isNumeric, isPhone, isStrongPassword, isUrl, maxLength, minLength, } from "./validators/index.js";
|
|
83
83
|
export type { DeviceInfoLike, ParsedVersion, Platform, UpdateInfo, UpdateType, VersionCheckResult, VersionCheckType, VersionComparison, VersionData, } from "./versionCheck/index.js";
|
|
84
84
|
export { isBuildBelowMinimum, parseBuildNumber, setDeviceInfoImplementation, useVersionCheck, VersionCheck, } from "./versionCheck/index.js";
|
|
85
85
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export declare const normalizeAadhaar: (value: unknown) => string | null;
|
|
2
|
+
export declare const isAadhaar: (value: unknown) => boolean;
|
|
3
|
+
export declare const maskAadhaar: (value: unknown) => string | null;
|
|
4
|
+
/** The last four digits of a valid Aadhaar number, or null when it is not valid. */
|
|
5
|
+
export declare const aadhaarLastFour: (value: unknown) => string | null;
|
|
6
|
+
//# sourceMappingURL=aadhaar.d.ts.map
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export interface FinancialYear {
|
|
2
|
+
startYear: number;
|
|
3
|
+
label: string;
|
|
4
|
+
displayLabel: string;
|
|
5
|
+
assessmentYearLabel: string;
|
|
6
|
+
startDate: string;
|
|
7
|
+
endDate: string;
|
|
8
|
+
}
|
|
9
|
+
export declare const financialYearLabel: (startYear: number) => string;
|
|
10
|
+
export declare const financialYearOf: (date: Date) => FinancialYear;
|
|
11
|
+
export declare const currentFinancialYear: (now?: Date) => FinancialYear;
|
|
12
|
+
export declare const parseFinancialYear: (value: unknown) => FinancialYear | null;
|
|
13
|
+
export declare const recentFinancialYears: (count: number, now?: Date) => FinancialYear[];
|
|
14
|
+
//# sourceMappingURL=financialYear.d.ts.map
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export type GstStateStatus = "Current" | "Retired";
|
|
2
|
+
export interface GstState {
|
|
3
|
+
code: string;
|
|
4
|
+
name: string;
|
|
5
|
+
status: GstStateStatus;
|
|
6
|
+
replacedByCode?: string;
|
|
7
|
+
aliases: readonly string[];
|
|
8
|
+
}
|
|
9
|
+
export declare const GST_STATES: readonly GstState[];
|
|
10
|
+
export declare const findGstState: (code: unknown) => GstState | null;
|
|
11
|
+
export declare const gstStateByName: (name: unknown) => GstState | null;
|
|
12
|
+
export declare const currentGstStates: () => readonly GstState[];
|
|
13
|
+
//# sourceMappingURL=gstStates.g.d.ts.map
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { type GstState } from "./gstStates.g.js";
|
|
2
|
+
export type GstinProblem = "pattern" | "stateCode" | "checkCharacter";
|
|
3
|
+
export declare const normalizeGstin: (value: unknown) => string | null;
|
|
4
|
+
export declare const gstinProblem: (value: unknown) => GstinProblem | null;
|
|
5
|
+
export declare const isGstin: (value: unknown) => boolean;
|
|
6
|
+
export declare const sanitizeGstinInput: (value: unknown) => string;
|
|
7
|
+
export declare const gstinStateCode: (value: unknown) => string | null;
|
|
8
|
+
/** The GST state row of a valid GSTIN (a retired code returns its Retired row), or null when the GSTIN is not valid. */
|
|
9
|
+
export declare const gstinState: (value: unknown) => GstState | null;
|
|
10
|
+
export declare const gstinHolderPan: (value: unknown) => string | null;
|
|
11
|
+
//# sourceMappingURL=gstin.d.ts.map
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export { aadhaarLastFour, isAadhaar, maskAadhaar, normalizeAadhaar } from "./aadhaar.js";
|
|
2
|
+
export type { FinancialYear } from "./financialYear.js";
|
|
3
|
+
export { currentFinancialYear, financialYearLabel, financialYearOf, parseFinancialYear, recentFinancialYears } from "./financialYear.js";
|
|
4
|
+
export type { GstinProblem } from "./gstin.js";
|
|
5
|
+
export { gstinHolderPan, gstinProblem, gstinState, gstinStateCode, isGstin, normalizeGstin, sanitizeGstinInput } from "./gstin.js";
|
|
6
|
+
export type { GstState, GstStateStatus } from "./gstStates.g.js";
|
|
7
|
+
export { isIfsc, normalizeIfsc } from "./ifsc.js";
|
|
8
|
+
export { formatIndianMobile, isIndianMobile, normalizeIndianMobile } from "./indianMobile.js";
|
|
9
|
+
export { istDateOf, istDayBoundsUtc, istToday } from "./indiaTime.js";
|
|
10
|
+
export type { NicDivision } from "./nicDivisions.g.js";
|
|
11
|
+
export { formatPaise, formatRupees, PAISE_PER_RUPEE, paiseFromRupees } from "./paise.js";
|
|
12
|
+
export { isPan, maskPan, normalizePan } from "./pan.js";
|
|
13
|
+
export { isPincode, normalizePincode } from "./pincode.js";
|
|
14
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export interface NicDivision {
|
|
2
|
+
code: string;
|
|
3
|
+
section: string;
|
|
4
|
+
title: string;
|
|
5
|
+
}
|
|
6
|
+
export declare const NIC_DIVISIONS: readonly NicDivision[];
|
|
7
|
+
export declare const findNicDivision: (code: unknown) => NicDivision | null;
|
|
8
|
+
//# sourceMappingURL=nicDivisions.g.d.ts.map
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/** Paise in one rupee. */
|
|
2
|
+
export declare const PAISE_PER_RUPEE = 100;
|
|
3
|
+
/**
|
|
4
|
+
* The amount in paise of a rupee amount, read from the number's decimal text so no float multiplication can shift a paisa.
|
|
5
|
+
* Throws a RangeError for a fraction of a paisa (1.005), a non-finite number, an exponent form (1e21) or an amount beyond the safe integer range;
|
|
6
|
+
* round the amount by the rule that applies first.
|
|
7
|
+
*/
|
|
8
|
+
export declare const paiseFromRupees: (rupees: number) => number;
|
|
9
|
+
/** Two-decimal text with lakh and crore grouping: ₹1,50,000.00 and -₹12.50. The rupee sign is dropped when `symbol` is false. */
|
|
10
|
+
export declare const formatPaise: (paise: number, symbol?: boolean) => string;
|
|
11
|
+
/** Whole rupees for display, half away from zero: ₹2,50,00,000 and -₹13 for -1250. An amount that rounds to zero prints without a sign. */
|
|
12
|
+
export declare const formatRupees: (paise: number) => string;
|
|
13
|
+
//# sourceMappingURL=paise.d.ts.map
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The value with every space (U+0020) removed and its ends trimmed, or null when it is not a string or is blank.
|
|
3
|
+
* This is the server's Normalize for GSTIN, PAN, IFSC and PIN code (Aadhaar also drops hyphens): a tab or a
|
|
4
|
+
* no-break space inside the value is NOT removed, so such a value fails the shape check as it does on the server.
|
|
5
|
+
*/
|
|
6
|
+
export declare const withoutSpaces: (value: unknown) => string | null;
|
|
7
|
+
/** Upper-cases ASCII letters only. Full Unicode upper-casing turns "ß" into "SS" and could lengthen a value into a valid shape. */
|
|
8
|
+
export declare const upperAscii: (text: string) => string;
|
|
9
|
+
//# sourceMappingURL=text.d.ts.map
|
|
@@ -7,15 +7,9 @@
|
|
|
7
7
|
*/
|
|
8
8
|
export declare const isNonEmpty: (value: unknown) => boolean;
|
|
9
9
|
export declare const isEmail: (value: unknown) => boolean;
|
|
10
|
-
/**
|
|
11
|
-
* Validate an Indian mobile number. Accepts:
|
|
12
|
-
* - 10-digit number starting with 6-9
|
|
13
|
-
* - Optional `+91` or `91` country code prefix
|
|
14
|
-
*/
|
|
15
|
-
export declare const isIndianMobile: (value: unknown) => boolean;
|
|
16
10
|
/**
|
|
17
11
|
* Generic phone validator: 7–15 digits, optional `+` prefix.
|
|
18
|
-
* Use `isIndianMobile` when you specifically need an Indian mobile number.
|
|
12
|
+
* Use `isIndianMobile` from `@webority/mobile-core/india` when you specifically need an Indian mobile number.
|
|
19
13
|
*/
|
|
20
14
|
export declare const isPhone: (value: unknown) => boolean;
|
|
21
15
|
export declare const isUrl: (value: unknown) => boolean;
|
|
@@ -34,16 +28,6 @@ export interface PasswordRules {
|
|
|
34
28
|
* one uppercase, one lowercase, one digit.
|
|
35
29
|
*/
|
|
36
30
|
export declare const isStrongPassword: (value: unknown, rules?: PasswordRules) => boolean;
|
|
37
|
-
export declare const isIndianPincode: (value: unknown) => boolean;
|
|
38
|
-
export declare const isPan: (value: unknown) => boolean;
|
|
39
|
-
export declare const isGstin: (value: unknown) => boolean;
|
|
40
|
-
/**
|
|
41
|
-
* The same rules the Webority servers apply: spaces and hyphens stripped (as
|
|
42
|
-
* printed on the card), twelve digits, no leading 0 or 1, and a correct
|
|
43
|
-
* Verhoeff check digit.
|
|
44
|
-
*/
|
|
45
|
-
export declare const isAadhaar: (value: unknown) => boolean;
|
|
46
|
-
export declare const isIfsc: (value: unknown) => boolean;
|
|
47
31
|
export declare const isHexColor: (value: unknown) => boolean;
|
|
48
32
|
export declare const isBetween: (value: unknown, min: number, max: number, inclusive?: boolean) => boolean;
|
|
49
33
|
export declare const minLength: (value: unknown, length: number) => boolean;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@webority/mobile-core",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.129.0",
|
|
4
4
|
"description": "Platform layer for Webority React Native apps: HTTP clients, auth/token storage, config, logging, formatters, validators, network status, permissions, storage, version checks and over-the-air updates. No UI.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react-native",
|
|
@@ -312,6 +312,36 @@
|
|
|
312
312
|
"default": "./lib/commonjs/phone/countries.js"
|
|
313
313
|
}
|
|
314
314
|
},
|
|
315
|
+
"./india": {
|
|
316
|
+
"import": {
|
|
317
|
+
"types": "./lib/typescript/module/india/index.d.ts",
|
|
318
|
+
"default": "./lib/module/india/index.js"
|
|
319
|
+
},
|
|
320
|
+
"require": {
|
|
321
|
+
"types": "./lib/typescript/commonjs/india/index.d.ts",
|
|
322
|
+
"default": "./lib/commonjs/india/index.js"
|
|
323
|
+
}
|
|
324
|
+
},
|
|
325
|
+
"./india/gst-states": {
|
|
326
|
+
"import": {
|
|
327
|
+
"types": "./lib/typescript/module/india/gstStates.g.d.ts",
|
|
328
|
+
"default": "./lib/module/india/gstStates.g.js"
|
|
329
|
+
},
|
|
330
|
+
"require": {
|
|
331
|
+
"types": "./lib/typescript/commonjs/india/gstStates.g.d.ts",
|
|
332
|
+
"default": "./lib/commonjs/india/gstStates.g.js"
|
|
333
|
+
}
|
|
334
|
+
},
|
|
335
|
+
"./india/nic-divisions": {
|
|
336
|
+
"import": {
|
|
337
|
+
"types": "./lib/typescript/module/india/nicDivisions.g.d.ts",
|
|
338
|
+
"default": "./lib/module/india/nicDivisions.g.js"
|
|
339
|
+
},
|
|
340
|
+
"require": {
|
|
341
|
+
"types": "./lib/typescript/commonjs/india/nicDivisions.g.d.ts",
|
|
342
|
+
"default": "./lib/commonjs/india/nicDivisions.g.js"
|
|
343
|
+
}
|
|
344
|
+
},
|
|
315
345
|
"./redux": {
|
|
316
346
|
"import": {
|
|
317
347
|
"types": "./lib/typescript/module/redux/index.d.ts",
|