@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
|
@@ -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.js";
|
|
43
43
|
export { ACCOUNT_ID_HEADER, CLIENT_BUILD_HEADER, CLIENT_KIND, CLIENT_KIND_HEADER, getClientBuild, } from "./api/clientHeaders.js";
|
|
44
|
-
export type { ContractCallConfig, ContractCaller } from "./api/contractCaller.js";
|
|
44
|
+
export type { ContractBodyCallConfig, ContractCallConfig, ContractCaller } from "./api/contractCaller.js";
|
|
45
45
|
export { createContractCaller } from "./api/contractCaller.js";
|
|
46
46
|
export { buildCurl, logCurl } from "./api/curl.js";
|
|
47
47
|
export type { FetchRetryPolicy } from "./api/fetchRetry.js";
|
|
@@ -85,8 +85,8 @@ export { PUSH_STATUS } from "./push/status.js";
|
|
|
85
85
|
export type { AsyncStorageLike, StorageApi } from "./storage/index.js";
|
|
86
86
|
export { isStorageAvailable, Storage, setStorageImplementation } from "./storage/index.js";
|
|
87
87
|
export { encodeBase64 } from "./utils/base64.js";
|
|
88
|
-
export type { PasswordRules } from "./validators/index.js";
|
|
89
|
-
export { isAlphanumeric, isBetween, isEmail, isHexColor, isInteger, isNonEmpty, isNumeric, isPhone, isStrongPassword, isUrl, maxLength, minLength, } from "./validators/index.js";
|
|
88
|
+
export type { FieldRule, FieldRuleSet, PasswordRules } from "./validators/index.js";
|
|
89
|
+
export { checkFields, FIELD_RULE_MESSAGES, fieldRules, isAlphanumeric, isBetween, isEmail, isHexColor, isInteger, isNonEmpty, isNumeric, isPhone, isStrongPassword, isUrl, maxLength, minLength, refineWith, } from "./validators/index.js";
|
|
90
90
|
export type { DeviceInfoLike, ParsedVersion, Platform, UpdateInfo, UpdateType, VersionCheckResult, VersionCheckType, VersionComparison, VersionData, } from "./versionCheck/index.js";
|
|
91
91
|
export { isBuildBelowMinimum, parseBuildNumber, setDeviceInfoImplementation, useVersionCheck, VersionCheck, } from "./versionCheck/index.js";
|
|
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.js";
|
|
35
36
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -2,7 +2,7 @@ import { type Environment } from "../config/index.js";
|
|
|
2
2
|
import { type DeviceInfoLike } from "./appBuild.js";
|
|
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;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@webority/mobile-core",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.165.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",
|
|
@@ -399,7 +399,7 @@
|
|
|
399
399
|
}
|
|
400
400
|
},
|
|
401
401
|
"dependencies": {
|
|
402
|
-
"@webority/api-contract": "0.
|
|
402
|
+
"@webority/api-contract": "0.165.0",
|
|
403
403
|
"axios": "^1.19.0",
|
|
404
404
|
"libphonenumber-js": "^1.12.41"
|
|
405
405
|
},
|
|
@@ -524,7 +524,7 @@
|
|
|
524
524
|
"devDependencies": {
|
|
525
525
|
"@react-native/metro-config": "0.88.1",
|
|
526
526
|
"@reduxjs/toolkit": "2.12.0",
|
|
527
|
-
"@testing-library/react-native": "
|
|
527
|
+
"@testing-library/react-native": "14.1.0",
|
|
528
528
|
"@types/jest": "29.5.14",
|
|
529
529
|
"@types/node": "25.6.0",
|
|
530
530
|
"@types/react": "19.3.0",
|
|
@@ -548,7 +548,7 @@
|
|
|
548
548
|
"react-native": "0.88.1",
|
|
549
549
|
"react-native-builder-bob": "0.43.0",
|
|
550
550
|
"react-redux": "9.3.0",
|
|
551
|
-
"
|
|
551
|
+
"test-renderer": "1.3.1",
|
|
552
552
|
"typescript": "7.0.2"
|
|
553
553
|
},
|
|
554
554
|
"scripts": {
|
|
@@ -2,7 +2,7 @@ import type { TurboModule } from "react-native";
|
|
|
2
2
|
import { TurboModuleRegistry } from "react-native";
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
|
-
* Android-only
|
|
5
|
+
* Android-only. The Play Services SMS Retriever API has no iOS equivalent.
|
|
6
6
|
* The JS wrapper in `smsRetriever/index.ts` never touches this module on
|
|
7
7
|
* iOS, so `getEnforcing` only ever runs on Android, where autolinking has
|
|
8
8
|
* registered `SmsRetrieverPackage`.
|