@webority/mobile-core 0.163.0 → 0.165.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/LICENSE.txt +1 -1
- package/README.md +6 -2
- package/android/src/newarch/java/com/webority/mobilecore/smsretriever/AppSignatureHelper.kt +2 -2
- package/android/src/newarch/java/com/webority/mobilecore/smsretriever/SmsRetrieverModuleImpl.kt +2 -2
- package/lib/commonjs/api/contractCaller.js +1 -1
- package/lib/commonjs/api/retry.js +1 -1
- package/lib/commonjs/api/tokenRefresh.js +1 -1
- package/lib/commonjs/formatters/dateMath.js +1 -1
- package/lib/commonjs/formatters/house.js +1 -1
- package/lib/commonjs/index.js +1 -1
- package/lib/commonjs/validators/fieldRules.js +1 -0
- package/lib/commonjs/validators/index.js +1 -1
- package/lib/commonjs/versionCheck/index.js +1 -1
- package/lib/module/api/contractCaller.js +1 -1
- package/lib/module/api/retry.js +1 -1
- package/lib/module/api/tokenRefresh.js +1 -1
- package/lib/module/formatters/dateMath.js +1 -1
- package/lib/module/formatters/house.js +1 -1
- package/lib/module/index.js +1 -1
- package/lib/module/validators/fieldRules.js +1 -0
- package/lib/module/validators/index.js +1 -1
- package/lib/module/versionCheck/index.js +1 -1
- package/lib/typescript/commonjs/api/baseUrl.d.ts +1 -1
- package/lib/typescript/commonjs/api/contractCaller.d.ts +5 -3
- package/lib/typescript/commonjs/api/retry.d.ts +6 -8
- package/lib/typescript/commonjs/config/index.d.ts +1 -1
- package/lib/typescript/commonjs/formatters/currency.d.ts +1 -1
- package/lib/typescript/commonjs/formatters/dateMath.d.ts +14 -14
- package/lib/typescript/commonjs/formatters/house.d.ts +4 -2
- package/lib/typescript/commonjs/formatters/number.d.ts +1 -1
- package/lib/typescript/commonjs/formatters/windowsToIanaTable.d.ts +3 -3
- package/lib/typescript/commonjs/geolocation/adapters/expoLocation.d.ts +1 -1
- package/lib/typescript/commonjs/index.d.ts +3 -3
- package/lib/typescript/commonjs/initUserAuth.d.ts +1 -1
- package/lib/typescript/commonjs/permissions/index.d.ts +1 -1
- package/lib/typescript/commonjs/smsRetriever/index.d.ts +2 -2
- package/lib/typescript/commonjs/specs/NativeSmsRetriever.d.ts +1 -1
- package/lib/typescript/commonjs/sqlite/index.d.ts +1 -1
- package/lib/typescript/commonjs/storage/index.d.ts +1 -1
- package/lib/typescript/commonjs/validators/fieldRules.d.ts +38 -0
- package/lib/typescript/commonjs/validators/index.d.ts +2 -1
- package/lib/typescript/commonjs/versionCheck/index.d.ts +1 -1
- package/lib/typescript/module/api/baseUrl.d.ts +1 -1
- package/lib/typescript/module/api/contractCaller.d.ts +5 -3
- package/lib/typescript/module/api/retry.d.ts +6 -8
- package/lib/typescript/module/config/index.d.ts +1 -1
- package/lib/typescript/module/formatters/currency.d.ts +1 -1
- package/lib/typescript/module/formatters/dateMath.d.ts +14 -14
- package/lib/typescript/module/formatters/house.d.ts +4 -2
- package/lib/typescript/module/formatters/number.d.ts +1 -1
- package/lib/typescript/module/formatters/windowsToIanaTable.d.ts +3 -3
- package/lib/typescript/module/geolocation/adapters/expoLocation.d.ts +1 -1
- package/lib/typescript/module/index.d.ts +3 -3
- package/lib/typescript/module/initUserAuth.d.ts +1 -1
- package/lib/typescript/module/permissions/index.d.ts +1 -1
- package/lib/typescript/module/smsRetriever/index.d.ts +2 -2
- package/lib/typescript/module/specs/NativeSmsRetriever.d.ts +1 -1
- package/lib/typescript/module/sqlite/index.d.ts +1 -1
- package/lib/typescript/module/storage/index.d.ts +1 -1
- package/lib/typescript/module/validators/fieldRules.d.ts +38 -0
- package/lib/typescript/module/validators/index.d.ts +2 -1
- package/lib/typescript/module/versionCheck/index.d.ts +1 -1
- package/package.json +4 -4
- package/src/specs/NativeSmsRetriever.ts +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";import{useMemo,useSyncExternalStore}from"react";import{addMinAppVersionListener,getMinAppVersion}from"../api/minAppVersion.js";import{getConfigValue}from"../config/index.js";import{Logger}from"../logger/index.js";import{expoApplicationBackend,getDeviceInfo,readAppBuild,setDeviceInfo}from"./appBuild.js";import{isBuildBelowMinimum}from"./buildNumber.js";export const setDeviceInfoImplementation=e=>{setDeviceInfo(e)};const missing=(e,r)=>{const t=new Error(`[VersionCheck] the app's ${e} is not available. Call setConfig({ ${r}: ... })
|
|
1
|
+
"use strict";import{useMemo,useSyncExternalStore}from"react";import{addMinAppVersionListener,getMinAppVersion}from"../api/minAppVersion.js";import{getConfigValue}from"../config/index.js";import{Logger}from"../logger/index.js";import{expoApplicationBackend,getDeviceInfo,readAppBuild,setDeviceInfo}from"./appBuild.js";import{isBuildBelowMinimum}from"./buildNumber.js";export const setDeviceInfoImplementation=e=>{setDeviceInfo(e)};const missing=(e,r)=>{const t=new Error(`[VersionCheck] the app's ${e} is not available. Call setConfig({ ${r}: ... }). Every Webority app already has this value in appsettings.Compiled.json, or setDeviceInfoImplementation() with a native provider.`);return Logger.error(t.message),t},getSystemName=()=>{const{Platform:e}=require("react-native");return e.OS},getBundleId=()=>{const e=getConfigValue("appId");if(e)return e;const r=(getDeviceInfo()??expoApplicationBackend).getBundleId();if(r)return r;throw missing("store identifier","appId")},getBuildNumber=()=>{const e=readAppBuild();if(null!==e)return e;throw missing("build number","appBuild")},getCountry=()=>getConfigValue("country","in").toLowerCase(),subscribeMinimum=e=>addMinAppVersionListener(()=>e()),getFallbackStoreUrl=()=>{const e=getSystemName().toLowerCase(),r=getCountry();if("ios"===e){const e=getConfigValue("appStoreId");return e?`https://apps.apple.com/${r}/app/id${e}`:`https://apps.apple.com/${r}/app/${getBundleId()}`}return`https://play.google.com/store/apps/details?id=${getBundleId()}&hl=${r}`},storeUrlOrNull=()=>{try{return getFallbackStoreUrl()}catch{return null}},checkForUpdates=()=>{const e=isBuildBelowMinimum(getBuildNumber(),getMinAppVersion());return{isNewVersionAvailable:e,updateType:e?"major":null,url:e?storeUrlOrNull():null}};export const VersionCheck={isNewVersionAvailable:async()=>checkForUpdates(),openUpdateUrl:async e=>{const{Linking:r}=require("react-native");try{if(e)Logger.info(`Opening app store URL: ${e}`),await r.openURL(e);else{const e=getFallbackStoreUrl();Logger.info(`Opening fallback store URL: ${e}`),await r.openURL(e)}return!0}catch(t){const o=t instanceof Error?t.message:String(t);Logger.error(`Failed to open store URL: ${o}`);try{if(e){const e=getFallbackStoreUrl();return Logger.info(`Trying fallback store URL: ${e}`),await r.openURL(e),!0}}catch(e){const r=e instanceof Error?e.message:String(e);Logger.error(`Failed to open fallback URL: ${r}`)}return!1}},getFallbackStoreUrl:getFallbackStoreUrl};const NOT_REQUIRED={isUpdateRequired:!1,updateUrl:null};export const useVersionCheck=(e,r=getConfigValue("environment","Development"))=>{const t=useSyncExternalStore(subscribeMinimum,getMinAppVersion,getMinAppVersion);return useMemo(()=>{if(!e||"Production"!==r||null===t)return NOT_REQUIRED;try{if(!isBuildBelowMinimum(getBuildNumber(),t))return NOT_REQUIRED}catch{return NOT_REQUIRED}return{isUpdateRequired:!0,updateUrl:storeUrlOrNull()}},[e,r,t])};export default VersionCheck;export{readAppBuild}from"./appBuild.js";export{isBuildBelowMinimum,parseBuildNumber}from"./buildNumber.js";
|
|
@@ -3,7 +3,7 @@ import type { AxiosInstance } from "axios";
|
|
|
3
3
|
* Resolves `baseURL` PER REQUEST rather than at module evaluation.
|
|
4
4
|
*
|
|
5
5
|
* `axios.create({ baseURL: getConfigValue('baseUrl') })` reads the value once,
|
|
6
|
-
* when the module is first imported
|
|
6
|
+
* when the module is first imported, which happens the moment anything touches
|
|
7
7
|
* the package barrel, long before an app's startup code can call `setConfig`.
|
|
8
8
|
* The result was a client permanently pinned to `undefined` and a `setConfig`
|
|
9
9
|
* that appeared to do nothing, with no error anywhere: requests just went to a
|
|
@@ -9,15 +9,17 @@ import type { AxiosInstance, AxiosRequestConfig } from "axios";
|
|
|
9
9
|
* on an invalid value before anything is sent.
|
|
10
10
|
*/
|
|
11
11
|
export type ContractCallConfig = Pick<AxiosRequestConfig, "signal" | "timeout" | "retry" | "onSessionReplaced"> & ContractCallOptions;
|
|
12
|
+
/** The call config of a wrapper that only reads the body: `ContractCallConfig` without `reply: "full"`, so it forwards to the body overload of a `ContractCaller`. */
|
|
13
|
+
export type ContractBodyCallConfig = ContractCallConfig & {
|
|
14
|
+
readonly reply?: "body" | undefined;
|
|
15
|
+
};
|
|
12
16
|
export interface ContractCaller<TOperations extends {
|
|
13
17
|
readonly [K in keyof TOperations]: OperationShape;
|
|
14
18
|
}> {
|
|
15
19
|
<TId extends keyof TOperations & string>(id: TId, request: TOperations[TId]["request"], config: ContractCallConfig & {
|
|
16
20
|
readonly reply: "full";
|
|
17
21
|
}): Promise<ContractFullReply<TOperations[TId]["response"]>>;
|
|
18
|
-
<TId extends keyof TOperations & string>(id: TId, request: TOperations[TId]["request"], config?:
|
|
19
|
-
readonly reply?: "body" | undefined;
|
|
20
|
-
}): Promise<TOperations[TId]["response"]>;
|
|
22
|
+
<TId extends keyof TOperations & string>(id: TId, request: TOperations[TId]["request"], config?: ContractBodyCallConfig): Promise<TOperations[TId]["response"]>;
|
|
21
23
|
}
|
|
22
24
|
export declare function createContractCaller<TOperations extends {
|
|
23
25
|
readonly [K in keyof TOperations]: OperationShape;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { IDEMPOTENCY_KEY_HEADER } from "@webority/api-contract/call";
|
|
1
2
|
import { type AxiosError, type AxiosInstance, type GenericAbortSignal } from "axios";
|
|
2
3
|
export interface RetryPolicy {
|
|
3
4
|
retries?: number | undefined;
|
|
@@ -18,11 +19,7 @@ declare module "axios" {
|
|
|
18
19
|
__retryStartedAt?: number | undefined;
|
|
19
20
|
}
|
|
20
21
|
}
|
|
21
|
-
|
|
22
|
-
* A write carrying this header asserts that the API deduplicates it, which is
|
|
23
|
-
* the only thing that makes a POST or PATCH safe to send twice.
|
|
24
|
-
*/
|
|
25
|
-
export declare const IDEMPOTENCY_KEY_HEADER = "Idempotency-Key";
|
|
22
|
+
export { IDEMPOTENCY_KEY_HEADER };
|
|
26
23
|
export declare const isRetryableStatus: (status: number | undefined) => boolean;
|
|
27
24
|
export declare const isIdempotentMethod: (method: string) => boolean;
|
|
28
25
|
export declare const isNeverSentError: (error: AxiosError) => boolean;
|
|
@@ -49,8 +46,9 @@ export declare const isRetryableRequest: (facts: RetryFacts) => boolean;
|
|
|
49
46
|
* - a request that provably never reached the server is resent, whatever its method;
|
|
50
47
|
* - GET, HEAD, OPTIONS, PUT and DELETE are resent on 429, any 5xx, a timeout or a
|
|
51
48
|
* dropped connection, because a second one leaves the server as one would;
|
|
52
|
-
* - POST and PATCH are resent only on 429 or 503
|
|
53
|
-
* doing the work)
|
|
49
|
+
* - POST and PATCH are resent only when they carry an `Idempotency-Key`: on 429 or 503
|
|
50
|
+
* (the server refused before doing the work), or on a timeout or dropped connection
|
|
51
|
+
* (the reply was lost); otherwise never;
|
|
54
52
|
* - a refusal that names a wait longer than 30 seconds is final, and the 20 second
|
|
55
53
|
* total retry budget also ends a retry whose wait would pass it;
|
|
56
54
|
* - a cancelled request is never resent.
|
|
@@ -61,7 +59,7 @@ export declare const isRetryableFailure: (error: AxiosError) => boolean;
|
|
|
61
59
|
* For a write the server can safely take twice, such as a sign-in token exchange: the shared
|
|
62
60
|
* rule, plus one resend when no answer came back at all. iOS drops a request with "the network
|
|
63
61
|
* connection was lost" when it reuses a connection that went stale while the app waited in the
|
|
64
|
-
* background (a browser sign-in page), and the shared rule never resends
|
|
62
|
+
* background (a browser sign-in page), and the shared rule never resends an unkeyed POST that got no answer.
|
|
65
63
|
*/
|
|
66
64
|
export declare const resendWhenUnanswered: RetryPolicy;
|
|
67
65
|
export declare const waitOrAbort: (delay: number, signal: GenericAbortSignal | undefined) => Promise<boolean>;
|
|
@@ -19,7 +19,7 @@ export interface Config {
|
|
|
19
19
|
*/
|
|
20
20
|
country: string;
|
|
21
21
|
/**
|
|
22
|
-
* The app's store identifier
|
|
22
|
+
* The app's store identifier (Android package name / iOS bundle id). Every
|
|
23
23
|
* Webority app already has this in its `appsettings.Compiled.json`, so the
|
|
24
24
|
* version-check module reads it from here rather than crossing the native
|
|
25
25
|
* bridge for a value the app already knows.
|
|
@@ -11,7 +11,7 @@ export interface FormatCurrencyOptions extends Omit<Intl.NumberFormatOptions, "s
|
|
|
11
11
|
minimumFractionDigits?: number | undefined;
|
|
12
12
|
/** Maximum fraction digits. Defaults to the currency's own. */
|
|
13
13
|
maximumFractionDigits?: number | undefined;
|
|
14
|
-
/** Strip the currency symbol
|
|
14
|
+
/** Strip the currency symbol. Useful when the symbol is rendered separately. */
|
|
15
15
|
stripSymbol?: boolean | undefined;
|
|
16
16
|
/**
|
|
17
17
|
* What a missing amount prints. Defaults to the configured placeholder once the app has
|
|
@@ -27,24 +27,24 @@ export declare const startOfDay: (value: DateInput) => Date | null;
|
|
|
27
27
|
*/
|
|
28
28
|
export declare const addDays: (value: DateInput | null | undefined, count: number) => Date | null;
|
|
29
29
|
/**
|
|
30
|
-
* Small dayjs/moment-style token formatter
|
|
30
|
+
* Small dayjs/moment-style token formatter: YYYY/YY, MMMM/MMM/MM/M,
|
|
31
31
|
* DD/D, dddd/ddd, HH/H (24h), hh/h (12h), mm/m, ss/s, A/a (upper/lower AM/PM).
|
|
32
32
|
* Everything else in the pattern (spaces, commas, colons) passes through
|
|
33
33
|
* literally. Hand-rolled rather than a dependency because the date
|
|
34
|
-
* formatting needs are a small, closed token set, not general i18n
|
|
34
|
+
* formatting needs are a small, closed token set, not general i18n; for
|
|
35
35
|
* genuinely locale-aware output, `formatDate`/`formatTime` (Intl-backed, in
|
|
36
36
|
* `./date`) are the ones to reach for; this is for matching an exact
|
|
37
37
|
* existing pattern (a legacy display string, an API's expected shape).
|
|
38
38
|
*
|
|
39
39
|
* `utc: true` reads every field from the UTC calendar/clock instead of the
|
|
40
|
-
* device's local one
|
|
40
|
+
* device's local one. See `formatDateDDMMMYYYY`'s note on why this isn't
|
|
41
41
|
* cosmetic.
|
|
42
42
|
*/
|
|
43
43
|
export declare const formatDatePattern: (value: DateInput, pattern: string, options?: {
|
|
44
44
|
utc?: boolean | undefined;
|
|
45
45
|
}) => string;
|
|
46
46
|
/**
|
|
47
|
-
* `DD MMM, YYYY
|
|
47
|
+
* `DD MMM, YYYY`: zero-padded day, short month, comma, year (e.g.
|
|
48
48
|
* `05 Sep, 2025`). A specific legacy pattern some apps already display,
|
|
49
49
|
* not the recommended convention: `formatDate` (the Intl `style`-based
|
|
50
50
|
* formatter in `./date`) is the one to reach for in new code. This exists so
|
|
@@ -52,7 +52,7 @@ export declare const formatDatePattern: (value: DateInput, pattern: string, opti
|
|
|
52
52
|
* without a visible change.
|
|
53
53
|
*
|
|
54
54
|
* `utc: true` reads the calendar day from the UTC fields instead of the
|
|
55
|
-
* device's local ones
|
|
55
|
+
* device's local ones, matching `dayjs.utc(x).format(...)`, not
|
|
56
56
|
* `dayjs(x).format(...)`. The two disagree whenever local time has crossed a
|
|
57
57
|
* day boundary UTC hasn't yet (or vice versa), so this is not a cosmetic
|
|
58
58
|
* option; pass it only to match a call site that was genuinely UTC-explicit.
|
|
@@ -63,26 +63,26 @@ export declare const formatDateDDMMMYYYY: (value: DateInput, options?: {
|
|
|
63
63
|
/** `YYYY-MM-DD`, in the device's local timezone. */
|
|
64
64
|
export declare const formatDateISO: (value: DateInput) => string;
|
|
65
65
|
/**
|
|
66
|
-
* `hh:mm A` in the device's local timezone
|
|
66
|
+
* `hh:mm A` in the device's local timezone: zero-padded 12-hour clock,
|
|
67
67
|
* uppercase AM/PM (e.g. `09:30 PM`).
|
|
68
68
|
*/
|
|
69
69
|
export declare const formatTime12h: (value: DateInput) => string;
|
|
70
70
|
/**
|
|
71
71
|
* `hh:mm a` (zero-padded 12-hour, lowercase am/pm) of the given instant as
|
|
72
|
-
* seen in `ianaTimeZone` (e.g. `Asia/Kolkata`)
|
|
73
|
-
* timezone. Reads the hour
|
|
74
|
-
* `
|
|
75
|
-
*
|
|
76
|
-
*
|
|
77
|
-
*
|
|
78
|
-
*
|
|
72
|
+
* seen in `ianaTimeZone` (e.g. `Asia/Kolkata`), not the device's own
|
|
73
|
+
* timezone. Reads the hour and minute digit runs and the AM/PM word from
|
|
74
|
+
* `Intl.DateTimeFormat`'s assembled string, never from a fixed layout: the
|
|
75
|
+
* spacing before AM/PM varies by JS engine (some insert a narrow no-break
|
|
76
|
+
* space, U+202F, instead of a plain space). Throws if `ianaTimeZone` isn't a
|
|
77
|
+
* timezone Intl recognises: the same failure mode as handing dayjs.tz() a bad
|
|
78
|
+
* zone name.
|
|
79
79
|
*/
|
|
80
80
|
export declare const formatTimeInZone: (value: DateInput, ianaTimeZone: string) => string;
|
|
81
81
|
/**
|
|
82
82
|
* Same as {@link formatTimeInZone}, but for a .NET-style Windows timezone ID
|
|
83
83
|
* (e.g. `"India Standard Time"`) rather than an IANA one. .NET's own
|
|
84
84
|
* `TimeZoneInfo` API only knows Windows IDs, so a backend built on it hands
|
|
85
|
-
* these to clients directly
|
|
85
|
+
* these to clients directly. `Intl`, by contrast, only recognises IANA
|
|
86
86
|
* names, so the ID has to be translated before it can be used here. Throws
|
|
87
87
|
* if `windowsTimeZoneId` has no known IANA mapping.
|
|
88
88
|
*/
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
* Intl options exist at all (Hermes has no RelativeTimeFormat and no
|
|
12
12
|
* trailingZeroDisplay). IST and the viewer's zone are therefore computed with
|
|
13
13
|
* plain Date arithmetic; Intl is used only to read the wall clock of an
|
|
14
|
-
* explicitly named IANA zone, through
|
|
14
|
+
* explicitly named IANA zone, through format() with numeric fields read as digit runs, to
|
|
15
15
|
* read the locale's 12- or 24-hour clock, and where a caller asks for Intl
|
|
16
16
|
* output itself (Intl number options, `formatRelative({ intl: true })`).
|
|
17
17
|
*
|
|
@@ -26,7 +26,9 @@
|
|
|
26
26
|
* With a configured locale (`configureFormatters({ locale })`), the words and separators come
|
|
27
27
|
* from Intl for that locale and the date order stays DD-MMM-YYYY. For en-IN in the viewer zone:
|
|
28
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".
|
|
29
|
+
* "₹1,50,000". For de-DE: "08-Sept-2026", "20:05", "1.234.567,891". A runtime whose
|
|
30
|
+
* DateTimeFormat has no formatToParts (iOS) reads each date part from its own single-field format,
|
|
31
|
+
* so a few configured locales print a different month word there: de-DE "Sep", ja-JP "9月".
|
|
30
32
|
*
|
|
31
33
|
* A configured `numberStyle` puts its decimal mark and group separator in every number and amount,
|
|
32
34
|
* whichever path wrote it: "1.23.456,789" for `'CommaWithPointGroups'` with the house text. A
|
|
@@ -15,7 +15,7 @@ export declare function formatNumber(value: number | null | undefined, fractionD
|
|
|
15
15
|
export declare function formatPercent(value: number | string | null | undefined, options?: FormatPercentOptions): string;
|
|
16
16
|
/**
|
|
17
17
|
* Intl percent output. Pass `asRatio: false` if the input is already on the
|
|
18
|
-
* 0
|
|
18
|
+
* 0 to 100 scale.
|
|
19
19
|
*/
|
|
20
20
|
export declare function formatPercent(value: number | null | undefined, fractionDigits: number | undefined, asRatio?: boolean, locale?: string): string;
|
|
21
21
|
/**
|
|
@@ -3,15 +3,15 @@
|
|
|
3
3
|
* Windows zone, generated from CLDR's `windowsZones.xml` (the same
|
|
4
4
|
* upstream source the retired `windows-iana` npm package derived its own
|
|
5
5
|
* table from). Only the `territory="001"` (world-default) row is kept per
|
|
6
|
-
* Windows zone
|
|
6
|
+
* Windows zone. `formatTimeInWindowsZone` only ever reads the first IANA
|
|
7
7
|
* candidate, and CLDR's `001` row is exactly that default candidate, so
|
|
8
8
|
* per-country territory variants (`US`, `CA`, `ZZ`, …) carry no information
|
|
9
9
|
* this table's one caller uses.
|
|
10
10
|
*
|
|
11
11
|
* Regenerate with `node packages/core/scripts/generate-windows-to-iana-table.mjs
|
|
12
12
|
* <path-to-windowsZones.xml>` (CLDR: `common/supplemental/windowsZones.xml` in
|
|
13
|
-
* https://github.com/unicode-org/cldr) whenever CLDR adds/renames a zone
|
|
14
|
-
*
|
|
13
|
+
* https://github.com/unicode-org/cldr) whenever CLDR adds/renames a zone.
|
|
14
|
+
* This is a committed, static table; nothing fetches CLDR at build or test
|
|
15
15
|
* time.
|
|
16
16
|
*/
|
|
17
17
|
export declare const WINDOWS_TO_IANA: Readonly<Record<string, string>>;
|
|
@@ -34,7 +34,7 @@ export interface ExpoLocationLike {
|
|
|
34
34
|
* subscription later. So the adapter mints its own id immediately and stores
|
|
35
35
|
* the subscription against it on arrival. `clearWatch` called during that
|
|
36
36
|
* window records the id as cancelled, and the subscription is removed the
|
|
37
|
-
* moment it lands
|
|
37
|
+
* moment it lands. Without that, a screen that unmounts before the watch
|
|
38
38
|
* starts leaks a live GPS listener for the rest of the session, which is a
|
|
39
39
|
* battery drain nobody would attribute to this code.
|
|
40
40
|
*/
|
|
@@ -41,7 +41,7 @@ export { listQuery } from "@webority/api-contract/call";
|
|
|
41
41
|
export type { AxiosError, AxiosInstance, AxiosRequestConfig, AxiosResponse } from "axios";
|
|
42
42
|
export type { AccountIdProvider, ClientKind } from "./api/clientHeaders";
|
|
43
43
|
export { ACCOUNT_ID_HEADER, CLIENT_BUILD_HEADER, CLIENT_KIND, CLIENT_KIND_HEADER, getClientBuild, } from "./api/clientHeaders";
|
|
44
|
-
export type { ContractCallConfig, ContractCaller } from "./api/contractCaller";
|
|
44
|
+
export type { ContractBodyCallConfig, ContractCallConfig, ContractCaller } from "./api/contractCaller";
|
|
45
45
|
export { createContractCaller } from "./api/contractCaller";
|
|
46
46
|
export { buildCurl, logCurl } from "./api/curl";
|
|
47
47
|
export type { FetchRetryPolicy } from "./api/fetchRetry";
|
|
@@ -85,8 +85,8 @@ export { PUSH_STATUS } from "./push/status";
|
|
|
85
85
|
export type { AsyncStorageLike, StorageApi } from "./storage";
|
|
86
86
|
export { isStorageAvailable, Storage, setStorageImplementation } from "./storage";
|
|
87
87
|
export { encodeBase64 } from "./utils/base64";
|
|
88
|
-
export type { PasswordRules } from "./validators";
|
|
89
|
-
export { isAlphanumeric, isBetween, isEmail, isHexColor, isInteger, isNonEmpty, isNumeric, isPhone, isStrongPassword, isUrl, maxLength, minLength, } from "./validators";
|
|
88
|
+
export type { FieldRule, FieldRuleSet, PasswordRules } from "./validators";
|
|
89
|
+
export { checkFields, FIELD_RULE_MESSAGES, fieldRules, isAlphanumeric, isBetween, isEmail, isHexColor, isInteger, isNonEmpty, isNumeric, isPhone, isStrongPassword, isUrl, maxLength, minLength, refineWith, } from "./validators";
|
|
90
90
|
export type { DeviceInfoLike, ParsedVersion, Platform, UpdateInfo, UpdateType, VersionCheckResult, VersionCheckType, VersionComparison, VersionData, } from "./versionCheck";
|
|
91
91
|
export { isBuildBelowMinimum, parseBuildNumber, setDeviceInfoImplementation, useVersionCheck, VersionCheck, } from "./versionCheck";
|
|
92
92
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -28,7 +28,7 @@ export interface TokenRefreshConfig {
|
|
|
28
28
|
headers?: (() => Record<string, string> | Promise<Record<string, string>>) | undefined;
|
|
29
29
|
/**
|
|
30
30
|
* Reads the new tokens from the response body. Defaults to the Webority API's
|
|
31
|
-
* `{ accessToken,
|
|
31
|
+
* `{ accessToken, accessTokenExpiresDateTimeUtc, refreshToken, refreshTokenExpiresDateTimeUtc }`.
|
|
32
32
|
*/
|
|
33
33
|
readTokens?: ((data: unknown) => TokenRefreshResult) | undefined;
|
|
34
34
|
}
|
|
@@ -38,7 +38,7 @@ declare const openAppSettings: () => Promise<boolean>;
|
|
|
38
38
|
/**
|
|
39
39
|
* Cross-platform permissions wrapper. Maps an abstract `PermissionKind`
|
|
40
40
|
* (camera, photos, location, notifications, …) to whichever Expo adapter an
|
|
41
|
-
* app has registered by importing that kind's entry point
|
|
41
|
+
* app has registered by importing that kind's entry point: expo-camera,
|
|
42
42
|
* expo-image-picker, expo-location, expo-contacts, expo-calendar,
|
|
43
43
|
* expo-notifications, expo-media-library. An app imports only the entry
|
|
44
44
|
* points for the kinds it actually asks for.
|
|
@@ -12,14 +12,14 @@ export interface SmsRetrieverBackend {
|
|
|
12
12
|
/** Test-only injection point. Pass `null` to reset to the native module. */
|
|
13
13
|
export declare const setSmsRetrieverImplementation: (impl: SmsRetrieverBackend | null) => void;
|
|
14
14
|
/**
|
|
15
|
-
* The Play Services SMS Retriever API
|
|
15
|
+
* The Play Services SMS Retriever API, which auto-reads an incoming OTP SMS with
|
|
16
16
|
* no SMS permission, matched by an 11-character app-signature hash
|
|
17
17
|
* (`getAppHash`) the backend appends to the message. Android only; every
|
|
18
18
|
* method is safe to call on iOS and resolves/reports unavailable rather than
|
|
19
19
|
* throwing, so a caller doesn't need a platform check at every call site.
|
|
20
20
|
* A native listener that fails to start is reported through `onError` as `UNKNOWN_ERROR`; without an `onError` it throws.
|
|
21
21
|
*
|
|
22
|
-
* OTP extraction is left to the caller
|
|
22
|
+
* OTP extraction is left to the caller: `onMessage` receives the raw SMS
|
|
23
23
|
* text, since the expected OTP format (digit count, prefix) is a backend
|
|
24
24
|
* concern, not this module's.
|
|
25
25
|
*/
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { TurboModule } from "react-native";
|
|
2
2
|
/**
|
|
3
|
-
* Android-only
|
|
3
|
+
* Android-only. The Play Services SMS Retriever API has no iOS equivalent.
|
|
4
4
|
* The JS wrapper in `smsRetriever/index.ts` never touches this module on
|
|
5
5
|
* iOS, so `getEnforcing` only ever runs on Android, where autolinking has
|
|
6
6
|
* registered `SmsRetrieverPackage`.
|
|
@@ -21,7 +21,7 @@ export interface SqliteDriver {
|
|
|
21
21
|
}) => Promise<SqliteDatabase>;
|
|
22
22
|
}
|
|
23
23
|
/**
|
|
24
|
-
* Test/showcase-only injection point
|
|
24
|
+
* Test/showcase-only injection point; see the module header. Not a way to
|
|
25
25
|
* pick an alternate real driver; `@webority/mobile-core` always
|
|
26
26
|
* resolves expo-sqlite when nothing is injected. Pass `null` to clear it.
|
|
27
27
|
*/
|
|
@@ -14,7 +14,7 @@ interface AsyncStorageLike {
|
|
|
14
14
|
* pairs, and `setMany` takes a Record where `multiSet` took pairs. The v1
|
|
15
15
|
* names are still what `expo-sqlite/kv-store` and AsyncStorage 2 expose.
|
|
16
16
|
*
|
|
17
|
-
* Declaring only one set is not a compile error and not a runtime error
|
|
17
|
+
* Declaring only one set is not a compile error and not a runtime error; it
|
|
18
18
|
* silently falls through to the per-key loop below. Apps pin
|
|
19
19
|
* AsyncStorage 3, so recognising only the v1 names put every consumer on N
|
|
20
20
|
* round-trips per batch with nothing to notice.
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/** Checks one value: the message when it fails, undefined when it passes. Fits react-hook-form's `rules.validate` as it stands. */
|
|
2
|
+
export type FieldRule = (value: unknown) => string | undefined;
|
|
3
|
+
/** Field name to its rule. */
|
|
4
|
+
export type FieldRuleSet = Readonly<Record<string, FieldRule>>;
|
|
5
|
+
export declare const FIELD_RULE_MESSAGES: Readonly<{
|
|
6
|
+
required: string;
|
|
7
|
+
minLength: (length: number) => string;
|
|
8
|
+
maxLength: (length: number) => string;
|
|
9
|
+
email: string;
|
|
10
|
+
phone: string;
|
|
11
|
+
url: string;
|
|
12
|
+
integer: string;
|
|
13
|
+
between: (min: number, max: number) => string;
|
|
14
|
+
}>;
|
|
15
|
+
/** Every rule but `required` passes an empty value (null, undefined, or a string of spaces). */
|
|
16
|
+
export declare const fieldRules: Readonly<{
|
|
17
|
+
required: (message?: string) => FieldRule;
|
|
18
|
+
minLength: (length: number, message?: string) => FieldRule;
|
|
19
|
+
maxLength: (length: number, message?: string) => FieldRule;
|
|
20
|
+
pattern: (pattern: RegExp, message: string) => FieldRule;
|
|
21
|
+
email: (message?: string) => FieldRule;
|
|
22
|
+
phone: (message?: string) => FieldRule;
|
|
23
|
+
url: (message?: string) => FieldRule;
|
|
24
|
+
integer: (message?: string) => FieldRule;
|
|
25
|
+
between: (min: number, max: number, message?: string) => FieldRule;
|
|
26
|
+
/** The first failing rule's message. */
|
|
27
|
+
all: (...rules: readonly FieldRule[]) => FieldRule;
|
|
28
|
+
}>;
|
|
29
|
+
/** Runs each field's rule over `values`; returns field name to message, the shape of `ApiError.fieldErrors`. */
|
|
30
|
+
export declare function checkFields(values: Readonly<Record<string, unknown>>, rules: FieldRuleSet): Record<string, string>;
|
|
31
|
+
/** A rule as a zod `superRefine` callback: `z.string().superRefine(refineWith(rule))`. No zod import. */
|
|
32
|
+
export declare function refineWith(rule: FieldRule): (value: unknown, context: {
|
|
33
|
+
addIssue: (issue: {
|
|
34
|
+
code: "custom";
|
|
35
|
+
message: string;
|
|
36
|
+
}) => void;
|
|
37
|
+
}) => void;
|
|
38
|
+
//# sourceMappingURL=fieldRules.d.ts.map
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
export declare const isNonEmpty: (value: unknown) => boolean;
|
|
9
9
|
export declare const isEmail: (value: unknown) => boolean;
|
|
10
10
|
/**
|
|
11
|
-
* Generic phone validator: 7
|
|
11
|
+
* Generic phone validator: 7 to 15 digits, optional `+` prefix.
|
|
12
12
|
* Use `isIndianMobile` from `@webority/mobile-core/india` when you specifically need an Indian mobile number.
|
|
13
13
|
*/
|
|
14
14
|
export declare const isPhone: (value: unknown) => boolean;
|
|
@@ -32,4 +32,5 @@ export declare const isHexColor: (value: unknown) => boolean;
|
|
|
32
32
|
export declare const isBetween: (value: unknown, min: number, max: number, inclusive?: boolean) => boolean;
|
|
33
33
|
export declare const minLength: (value: unknown, length: number) => boolean;
|
|
34
34
|
export declare const maxLength: (value: unknown, length: number) => boolean;
|
|
35
|
+
export * from "./fieldRules";
|
|
35
36
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -2,7 +2,7 @@ import { type Environment } from "../config";
|
|
|
2
2
|
import { type DeviceInfoLike } from "./appBuild";
|
|
3
3
|
/**
|
|
4
4
|
* Supply the app identity from a native module instead of config.
|
|
5
|
-
* Prefer `setConfig({ appId, appBuild })
|
|
5
|
+
* Prefer `setConfig({ appId, appBuild })`. It needs no native dependency.
|
|
6
6
|
* Pass `null` to clear.
|
|
7
7
|
*/
|
|
8
8
|
export declare const setDeviceInfoImplementation: (impl: DeviceInfoLike | null) => void;
|
|
@@ -3,7 +3,7 @@ import type { AxiosInstance } from "axios";
|
|
|
3
3
|
* Resolves `baseURL` PER REQUEST rather than at module evaluation.
|
|
4
4
|
*
|
|
5
5
|
* `axios.create({ baseURL: getConfigValue('baseUrl') })` reads the value once,
|
|
6
|
-
* when the module is first imported
|
|
6
|
+
* when the module is first imported, which happens the moment anything touches
|
|
7
7
|
* the package barrel, long before an app's startup code can call `setConfig`.
|
|
8
8
|
* The result was a client permanently pinned to `undefined` and a `setConfig`
|
|
9
9
|
* that appeared to do nothing, with no error anywhere: requests just went to a
|
|
@@ -9,15 +9,17 @@ import type { AxiosInstance, AxiosRequestConfig } from "axios";
|
|
|
9
9
|
* on an invalid value before anything is sent.
|
|
10
10
|
*/
|
|
11
11
|
export type ContractCallConfig = Pick<AxiosRequestConfig, "signal" | "timeout" | "retry" | "onSessionReplaced"> & ContractCallOptions;
|
|
12
|
+
/** The call config of a wrapper that only reads the body: `ContractCallConfig` without `reply: "full"`, so it forwards to the body overload of a `ContractCaller`. */
|
|
13
|
+
export type ContractBodyCallConfig = ContractCallConfig & {
|
|
14
|
+
readonly reply?: "body" | undefined;
|
|
15
|
+
};
|
|
12
16
|
export interface ContractCaller<TOperations extends {
|
|
13
17
|
readonly [K in keyof TOperations]: OperationShape;
|
|
14
18
|
}> {
|
|
15
19
|
<TId extends keyof TOperations & string>(id: TId, request: TOperations[TId]["request"], config: ContractCallConfig & {
|
|
16
20
|
readonly reply: "full";
|
|
17
21
|
}): Promise<ContractFullReply<TOperations[TId]["response"]>>;
|
|
18
|
-
<TId extends keyof TOperations & string>(id: TId, request: TOperations[TId]["request"], config?:
|
|
19
|
-
readonly reply?: "body" | undefined;
|
|
20
|
-
}): Promise<TOperations[TId]["response"]>;
|
|
22
|
+
<TId extends keyof TOperations & string>(id: TId, request: TOperations[TId]["request"], config?: ContractBodyCallConfig): Promise<TOperations[TId]["response"]>;
|
|
21
23
|
}
|
|
22
24
|
export declare function createContractCaller<TOperations extends {
|
|
23
25
|
readonly [K in keyof TOperations]: OperationShape;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { IDEMPOTENCY_KEY_HEADER } from "@webority/api-contract/call";
|
|
1
2
|
import { type AxiosError, type AxiosInstance, type GenericAbortSignal } from "axios";
|
|
2
3
|
export interface RetryPolicy {
|
|
3
4
|
retries?: number | undefined;
|
|
@@ -18,11 +19,7 @@ declare module "axios" {
|
|
|
18
19
|
__retryStartedAt?: number | undefined;
|
|
19
20
|
}
|
|
20
21
|
}
|
|
21
|
-
|
|
22
|
-
* A write carrying this header asserts that the API deduplicates it, which is
|
|
23
|
-
* the only thing that makes a POST or PATCH safe to send twice.
|
|
24
|
-
*/
|
|
25
|
-
export declare const IDEMPOTENCY_KEY_HEADER = "Idempotency-Key";
|
|
22
|
+
export { IDEMPOTENCY_KEY_HEADER };
|
|
26
23
|
export declare const isRetryableStatus: (status: number | undefined) => boolean;
|
|
27
24
|
export declare const isIdempotentMethod: (method: string) => boolean;
|
|
28
25
|
export declare const isNeverSentError: (error: AxiosError) => boolean;
|
|
@@ -49,8 +46,9 @@ export declare const isRetryableRequest: (facts: RetryFacts) => boolean;
|
|
|
49
46
|
* - a request that provably never reached the server is resent, whatever its method;
|
|
50
47
|
* - GET, HEAD, OPTIONS, PUT and DELETE are resent on 429, any 5xx, a timeout or a
|
|
51
48
|
* dropped connection, because a second one leaves the server as one would;
|
|
52
|
-
* - POST and PATCH are resent only on 429 or 503
|
|
53
|
-
* doing the work)
|
|
49
|
+
* - POST and PATCH are resent only when they carry an `Idempotency-Key`: on 429 or 503
|
|
50
|
+
* (the server refused before doing the work), or on a timeout or dropped connection
|
|
51
|
+
* (the reply was lost); otherwise never;
|
|
54
52
|
* - a refusal that names a wait longer than 30 seconds is final, and the 20 second
|
|
55
53
|
* total retry budget also ends a retry whose wait would pass it;
|
|
56
54
|
* - a cancelled request is never resent.
|
|
@@ -61,7 +59,7 @@ export declare const isRetryableFailure: (error: AxiosError) => boolean;
|
|
|
61
59
|
* For a write the server can safely take twice, such as a sign-in token exchange: the shared
|
|
62
60
|
* rule, plus one resend when no answer came back at all. iOS drops a request with "the network
|
|
63
61
|
* connection was lost" when it reuses a connection that went stale while the app waited in the
|
|
64
|
-
* background (a browser sign-in page), and the shared rule never resends
|
|
62
|
+
* background (a browser sign-in page), and the shared rule never resends an unkeyed POST that got no answer.
|
|
65
63
|
*/
|
|
66
64
|
export declare const resendWhenUnanswered: RetryPolicy;
|
|
67
65
|
export declare const waitOrAbort: (delay: number, signal: GenericAbortSignal | undefined) => Promise<boolean>;
|
|
@@ -19,7 +19,7 @@ export interface Config {
|
|
|
19
19
|
*/
|
|
20
20
|
country: string;
|
|
21
21
|
/**
|
|
22
|
-
* The app's store identifier
|
|
22
|
+
* The app's store identifier (Android package name / iOS bundle id). Every
|
|
23
23
|
* Webority app already has this in its `appsettings.Compiled.json`, so the
|
|
24
24
|
* version-check module reads it from here rather than crossing the native
|
|
25
25
|
* bridge for a value the app already knows.
|
|
@@ -11,7 +11,7 @@ export interface FormatCurrencyOptions extends Omit<Intl.NumberFormatOptions, "s
|
|
|
11
11
|
minimumFractionDigits?: number | undefined;
|
|
12
12
|
/** Maximum fraction digits. Defaults to the currency's own. */
|
|
13
13
|
maximumFractionDigits?: number | undefined;
|
|
14
|
-
/** Strip the currency symbol
|
|
14
|
+
/** Strip the currency symbol. Useful when the symbol is rendered separately. */
|
|
15
15
|
stripSymbol?: boolean | undefined;
|
|
16
16
|
/**
|
|
17
17
|
* What a missing amount prints. Defaults to the configured placeholder once the app has
|
|
@@ -27,24 +27,24 @@ export declare const startOfDay: (value: DateInput) => Date | null;
|
|
|
27
27
|
*/
|
|
28
28
|
export declare const addDays: (value: DateInput | null | undefined, count: number) => Date | null;
|
|
29
29
|
/**
|
|
30
|
-
* Small dayjs/moment-style token formatter
|
|
30
|
+
* Small dayjs/moment-style token formatter: YYYY/YY, MMMM/MMM/MM/M,
|
|
31
31
|
* DD/D, dddd/ddd, HH/H (24h), hh/h (12h), mm/m, ss/s, A/a (upper/lower AM/PM).
|
|
32
32
|
* Everything else in the pattern (spaces, commas, colons) passes through
|
|
33
33
|
* literally. Hand-rolled rather than a dependency because the date
|
|
34
|
-
* formatting needs are a small, closed token set, not general i18n
|
|
34
|
+
* formatting needs are a small, closed token set, not general i18n; for
|
|
35
35
|
* genuinely locale-aware output, `formatDate`/`formatTime` (Intl-backed, in
|
|
36
36
|
* `./date`) are the ones to reach for; this is for matching an exact
|
|
37
37
|
* existing pattern (a legacy display string, an API's expected shape).
|
|
38
38
|
*
|
|
39
39
|
* `utc: true` reads every field from the UTC calendar/clock instead of the
|
|
40
|
-
* device's local one
|
|
40
|
+
* device's local one. See `formatDateDDMMMYYYY`'s note on why this isn't
|
|
41
41
|
* cosmetic.
|
|
42
42
|
*/
|
|
43
43
|
export declare const formatDatePattern: (value: DateInput, pattern: string, options?: {
|
|
44
44
|
utc?: boolean | undefined;
|
|
45
45
|
}) => string;
|
|
46
46
|
/**
|
|
47
|
-
* `DD MMM, YYYY
|
|
47
|
+
* `DD MMM, YYYY`: zero-padded day, short month, comma, year (e.g.
|
|
48
48
|
* `05 Sep, 2025`). A specific legacy pattern some apps already display,
|
|
49
49
|
* not the recommended convention: `formatDate` (the Intl `style`-based
|
|
50
50
|
* formatter in `./date`) is the one to reach for in new code. This exists so
|
|
@@ -52,7 +52,7 @@ export declare const formatDatePattern: (value: DateInput, pattern: string, opti
|
|
|
52
52
|
* without a visible change.
|
|
53
53
|
*
|
|
54
54
|
* `utc: true` reads the calendar day from the UTC fields instead of the
|
|
55
|
-
* device's local ones
|
|
55
|
+
* device's local ones, matching `dayjs.utc(x).format(...)`, not
|
|
56
56
|
* `dayjs(x).format(...)`. The two disagree whenever local time has crossed a
|
|
57
57
|
* day boundary UTC hasn't yet (or vice versa), so this is not a cosmetic
|
|
58
58
|
* option; pass it only to match a call site that was genuinely UTC-explicit.
|
|
@@ -63,26 +63,26 @@ export declare const formatDateDDMMMYYYY: (value: DateInput, options?: {
|
|
|
63
63
|
/** `YYYY-MM-DD`, in the device's local timezone. */
|
|
64
64
|
export declare const formatDateISO: (value: DateInput) => string;
|
|
65
65
|
/**
|
|
66
|
-
* `hh:mm A` in the device's local timezone
|
|
66
|
+
* `hh:mm A` in the device's local timezone: zero-padded 12-hour clock,
|
|
67
67
|
* uppercase AM/PM (e.g. `09:30 PM`).
|
|
68
68
|
*/
|
|
69
69
|
export declare const formatTime12h: (value: DateInput) => string;
|
|
70
70
|
/**
|
|
71
71
|
* `hh:mm a` (zero-padded 12-hour, lowercase am/pm) of the given instant as
|
|
72
|
-
* seen in `ianaTimeZone` (e.g. `Asia/Kolkata`)
|
|
73
|
-
* timezone. Reads the hour
|
|
74
|
-
* `
|
|
75
|
-
*
|
|
76
|
-
*
|
|
77
|
-
*
|
|
78
|
-
*
|
|
72
|
+
* seen in `ianaTimeZone` (e.g. `Asia/Kolkata`), not the device's own
|
|
73
|
+
* timezone. Reads the hour and minute digit runs and the AM/PM word from
|
|
74
|
+
* `Intl.DateTimeFormat`'s assembled string, never from a fixed layout: the
|
|
75
|
+
* spacing before AM/PM varies by JS engine (some insert a narrow no-break
|
|
76
|
+
* space, U+202F, instead of a plain space). Throws if `ianaTimeZone` isn't a
|
|
77
|
+
* timezone Intl recognises: the same failure mode as handing dayjs.tz() a bad
|
|
78
|
+
* zone name.
|
|
79
79
|
*/
|
|
80
80
|
export declare const formatTimeInZone: (value: DateInput, ianaTimeZone: string) => string;
|
|
81
81
|
/**
|
|
82
82
|
* Same as {@link formatTimeInZone}, but for a .NET-style Windows timezone ID
|
|
83
83
|
* (e.g. `"India Standard Time"`) rather than an IANA one. .NET's own
|
|
84
84
|
* `TimeZoneInfo` API only knows Windows IDs, so a backend built on it hands
|
|
85
|
-
* these to clients directly
|
|
85
|
+
* these to clients directly. `Intl`, by contrast, only recognises IANA
|
|
86
86
|
* names, so the ID has to be translated before it can be used here. Throws
|
|
87
87
|
* if `windowsTimeZoneId` has no known IANA mapping.
|
|
88
88
|
*/
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
* Intl options exist at all (Hermes has no RelativeTimeFormat and no
|
|
12
12
|
* trailingZeroDisplay). IST and the viewer's zone are therefore computed with
|
|
13
13
|
* plain Date arithmetic; Intl is used only to read the wall clock of an
|
|
14
|
-
* explicitly named IANA zone, through
|
|
14
|
+
* explicitly named IANA zone, through format() with numeric fields read as digit runs, to
|
|
15
15
|
* read the locale's 12- or 24-hour clock, and where a caller asks for Intl
|
|
16
16
|
* output itself (Intl number options, `formatRelative({ intl: true })`).
|
|
17
17
|
*
|
|
@@ -26,7 +26,9 @@
|
|
|
26
26
|
* With a configured locale (`configureFormatters({ locale })`), the words and separators come
|
|
27
27
|
* from Intl for that locale and the date order stays DD-MMM-YYYY. For en-IN in the viewer zone:
|
|
28
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".
|
|
29
|
+
* "₹1,50,000". For de-DE: "08-Sept-2026", "20:05", "1.234.567,891". A runtime whose
|
|
30
|
+
* DateTimeFormat has no formatToParts (iOS) reads each date part from its own single-field format,
|
|
31
|
+
* so a few configured locales print a different month word there: de-DE "Sep", ja-JP "9月".
|
|
30
32
|
*
|
|
31
33
|
* A configured `numberStyle` puts its decimal mark and group separator in every number and amount,
|
|
32
34
|
* whichever path wrote it: "1.23.456,789" for `'CommaWithPointGroups'` with the house text. A
|
|
@@ -15,7 +15,7 @@ export declare function formatNumber(value: number | null | undefined, fractionD
|
|
|
15
15
|
export declare function formatPercent(value: number | string | null | undefined, options?: FormatPercentOptions): string;
|
|
16
16
|
/**
|
|
17
17
|
* Intl percent output. Pass `asRatio: false` if the input is already on the
|
|
18
|
-
* 0
|
|
18
|
+
* 0 to 100 scale.
|
|
19
19
|
*/
|
|
20
20
|
export declare function formatPercent(value: number | null | undefined, fractionDigits: number | undefined, asRatio?: boolean, locale?: string): string;
|
|
21
21
|
/**
|