@webority/mobile-core 0.0.23
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 +21 -0
- package/README.md +39 -0
- package/android/build.gradle +65 -0
- package/android/src/newarch/java/com/webority/mobilecore/smsretriever/AppSignatureHelper.kt +57 -0
- package/android/src/newarch/java/com/webority/mobilecore/smsretriever/SmsRetrieverModule.kt +20 -0
- package/android/src/newarch/java/com/webority/mobilecore/smsretriever/SmsRetrieverModuleImpl.kt +146 -0
- package/android/src/newarch/java/com/webority/mobilecore/smsretriever/SmsRetrieverPackage.kt +33 -0
- package/lib/commonjs/api/baseUrl.js +34 -0
- package/lib/commonjs/api/curl.js +109 -0
- package/lib/commonjs/api/publicClient.js +73 -0
- package/lib/commonjs/api/retry.js +75 -0
- package/lib/commonjs/api/tokenRefresh.js +205 -0
- package/lib/commonjs/api/userClient.js +255 -0
- package/lib/commonjs/auth/authStore.js +232 -0
- package/lib/commonjs/auth/index.js +44 -0
- package/lib/commonjs/auth/jwt.js +112 -0
- package/lib/commonjs/config/index.js +66 -0
- package/lib/commonjs/deepLink/index.js +286 -0
- package/lib/commonjs/download/adapters/expoFs.js +69 -0
- package/lib/commonjs/download/adapters/shared.js +13 -0
- package/lib/commonjs/download/index.js +250 -0
- package/lib/commonjs/formatters/currency.js +69 -0
- package/lib/commonjs/formatters/date.js +168 -0
- package/lib/commonjs/formatters/dateMath.js +310 -0
- package/lib/commonjs/formatters/index.js +246 -0
- package/lib/commonjs/formatters/initials.js +32 -0
- package/lib/commonjs/formatters/number.js +88 -0
- package/lib/commonjs/formatters/phone.js +369 -0
- package/lib/commonjs/formatters/windowsToIanaTable.js +164 -0
- package/lib/commonjs/geolocation/adapters/expoLocation.js +126 -0
- package/lib/commonjs/geolocation/index.js +355 -0
- package/lib/commonjs/index.js +630 -0
- package/lib/commonjs/initSDK.js +66 -0
- package/lib/commonjs/initUserAuth.js +37 -0
- package/lib/commonjs/logger/index.js +291 -0
- package/lib/commonjs/network/index.js +31 -0
- package/lib/commonjs/network/networkStatus.js +133 -0
- package/lib/commonjs/package.json +1 -0
- package/lib/commonjs/permissions/calendar.js +14 -0
- package/lib/commonjs/permissions/camera.js +14 -0
- package/lib/commonjs/permissions/contacts.js +10 -0
- package/lib/commonjs/permissions/index.js +133 -0
- package/lib/commonjs/permissions/location.js +14 -0
- package/lib/commonjs/permissions/mediaLibrary.js +10 -0
- package/lib/commonjs/permissions/notifications.js +10 -0
- package/lib/commonjs/permissions/photos.js +14 -0
- package/lib/commonjs/phone/countries.js +265 -0
- package/lib/commonjs/share/index.js +70 -0
- package/lib/commonjs/smsRetriever/index.js +91 -0
- package/lib/commonjs/specs/NativeSmsRetriever.js +15 -0
- package/lib/commonjs/sqlite/adapters/expo.js +53 -0
- package/lib/commonjs/sqlite/index.js +604 -0
- package/lib/commonjs/storage/index.js +214 -0
- package/lib/commonjs/types/globals.d.js +6 -0
- package/lib/commonjs/utils/imageCompression.js +389 -0
- package/lib/commonjs/utils/index.js +19 -0
- package/lib/commonjs/validators/index.js +227 -0
- package/lib/commonjs/versionCheck/index.js +419 -0
- package/lib/module/api/baseUrl.js +30 -0
- package/lib/module/api/curl.js +104 -0
- package/lib/module/api/publicClient.js +69 -0
- package/lib/module/api/retry.js +69 -0
- package/lib/module/api/tokenRefresh.js +192 -0
- package/lib/module/api/userClient.js +233 -0
- package/lib/module/auth/authStore.js +224 -0
- package/lib/module/auth/index.js +5 -0
- package/lib/module/auth/jwt.js +106 -0
- package/lib/module/config/index.js +58 -0
- package/lib/module/deepLink/index.js +280 -0
- package/lib/module/download/adapters/expoFs.js +64 -0
- package/lib/module/download/adapters/shared.js +8 -0
- package/lib/module/download/index.js +242 -0
- package/lib/module/formatters/currency.js +64 -0
- package/lib/module/formatters/date.js +160 -0
- package/lib/module/formatters/dateMath.js +294 -0
- package/lib/module/formatters/index.js +9 -0
- package/lib/module/formatters/initials.js +27 -0
- package/lib/module/formatters/number.js +81 -0
- package/lib/module/formatters/phone.js +302 -0
- package/lib/module/formatters/windowsToIanaTable.js +160 -0
- package/lib/module/geolocation/adapters/expoLocation.js +121 -0
- package/lib/module/geolocation/index.js +347 -0
- package/lib/module/index.js +54 -0
- package/lib/module/initSDK.js +61 -0
- package/lib/module/initUserAuth.js +33 -0
- package/lib/module/logger/index.js +285 -0
- package/lib/module/network/index.js +4 -0
- package/lib/module/network/networkStatus.js +124 -0
- package/lib/module/package.json +1 -0
- package/lib/module/permissions/calendar.js +15 -0
- package/lib/module/permissions/camera.js +15 -0
- package/lib/module/permissions/contacts.js +11 -0
- package/lib/module/permissions/index.js +128 -0
- package/lib/module/permissions/location.js +15 -0
- package/lib/module/permissions/mediaLibrary.js +11 -0
- package/lib/module/permissions/notifications.js +11 -0
- package/lib/module/permissions/photos.js +15 -0
- package/lib/module/phone/countries.js +261 -0
- package/lib/module/share/index.js +64 -0
- package/lib/module/smsRetriever/index.js +86 -0
- package/lib/module/specs/NativeSmsRetriever.js +13 -0
- package/lib/module/sqlite/adapters/expo.js +48 -0
- package/lib/module/sqlite/index.js +594 -0
- package/lib/module/storage/index.js +208 -0
- package/lib/module/types/globals.d.js +10 -0
- package/lib/module/utils/imageCompression.js +383 -0
- package/lib/module/utils/index.js +4 -0
- package/lib/module/validators/index.js +205 -0
- package/lib/module/versionCheck/index.js +413 -0
- package/lib/typescript/commonjs/api/baseUrl.d.ts +20 -0
- package/lib/typescript/commonjs/api/curl.d.ts +18 -0
- package/lib/typescript/commonjs/api/publicClient.d.ts +11 -0
- package/lib/typescript/commonjs/api/retry.d.ts +27 -0
- package/lib/typescript/commonjs/api/tokenRefresh.d.ts +43 -0
- package/lib/typescript/commonjs/api/userClient.d.ts +37 -0
- package/lib/typescript/commonjs/auth/authStore.d.ts +79 -0
- package/lib/typescript/commonjs/auth/index.d.ts +5 -0
- package/lib/typescript/commonjs/auth/jwt.d.ts +31 -0
- package/lib/typescript/commonjs/config/index.d.ts +55 -0
- package/lib/typescript/commonjs/deepLink/index.d.ts +54 -0
- package/lib/typescript/commonjs/download/adapters/expoFs.d.ts +38 -0
- package/lib/typescript/commonjs/download/adapters/shared.d.ts +3 -0
- package/lib/typescript/commonjs/download/index.d.ts +86 -0
- package/lib/typescript/commonjs/formatters/currency.d.ts +24 -0
- package/lib/typescript/commonjs/formatters/date.d.ts +22 -0
- package/lib/typescript/commonjs/formatters/dateMath.d.ts +88 -0
- package/lib/typescript/commonjs/formatters/index.d.ts +10 -0
- package/lib/typescript/commonjs/formatters/initials.d.ts +11 -0
- package/lib/typescript/commonjs/formatters/number.d.ts +15 -0
- package/lib/typescript/commonjs/formatters/phone.d.ts +133 -0
- package/lib/typescript/commonjs/formatters/windowsToIanaTable.d.ts +18 -0
- package/lib/typescript/commonjs/geolocation/adapters/expoLocation.d.ts +42 -0
- package/lib/typescript/commonjs/geolocation/index.d.ts +90 -0
- package/lib/typescript/commonjs/index.d.ts +54 -0
- package/lib/typescript/commonjs/initSDK.d.ts +72 -0
- package/lib/typescript/commonjs/initUserAuth.d.ts +41 -0
- package/lib/typescript/commonjs/logger/index.d.ts +81 -0
- package/lib/typescript/commonjs/network/index.d.ts +3 -0
- package/lib/typescript/commonjs/network/networkStatus.d.ts +43 -0
- package/lib/typescript/commonjs/package.json +1 -0
- package/lib/typescript/commonjs/permissions/calendar.d.ts +2 -0
- package/lib/typescript/commonjs/permissions/camera.d.ts +2 -0
- package/lib/typescript/commonjs/permissions/contacts.d.ts +2 -0
- package/lib/typescript/commonjs/permissions/index.d.ts +48 -0
- package/lib/typescript/commonjs/permissions/location.d.ts +2 -0
- package/lib/typescript/commonjs/permissions/mediaLibrary.d.ts +2 -0
- package/lib/typescript/commonjs/permissions/notifications.d.ts +2 -0
- package/lib/typescript/commonjs/permissions/photos.d.ts +2 -0
- package/lib/typescript/commonjs/phone/countries.d.ts +13 -0
- package/lib/typescript/commonjs/share/index.d.ts +29 -0
- package/lib/typescript/commonjs/smsRetriever/index.d.ts +30 -0
- package/lib/typescript/commonjs/specs/NativeSmsRetriever.d.ts +15 -0
- package/lib/typescript/commonjs/sqlite/adapters/expo.d.ts +30 -0
- package/lib/typescript/commonjs/sqlite/index.d.ts +113 -0
- package/lib/typescript/commonjs/storage/index.d.ts +64 -0
- package/lib/typescript/commonjs/utils/imageCompression.d.ts +152 -0
- package/lib/typescript/commonjs/utils/index.d.ts +3 -0
- package/lib/typescript/commonjs/validators/index.d.ts +51 -0
- package/lib/typescript/commonjs/versionCheck/index.d.ts +80 -0
- package/lib/typescript/module/api/baseUrl.d.ts +20 -0
- package/lib/typescript/module/api/curl.d.ts +18 -0
- package/lib/typescript/module/api/publicClient.d.ts +11 -0
- package/lib/typescript/module/api/retry.d.ts +27 -0
- package/lib/typescript/module/api/tokenRefresh.d.ts +43 -0
- package/lib/typescript/module/api/userClient.d.ts +37 -0
- package/lib/typescript/module/auth/authStore.d.ts +79 -0
- package/lib/typescript/module/auth/index.d.ts +5 -0
- package/lib/typescript/module/auth/jwt.d.ts +31 -0
- package/lib/typescript/module/config/index.d.ts +55 -0
- package/lib/typescript/module/deepLink/index.d.ts +54 -0
- package/lib/typescript/module/download/adapters/expoFs.d.ts +38 -0
- package/lib/typescript/module/download/adapters/shared.d.ts +3 -0
- package/lib/typescript/module/download/index.d.ts +86 -0
- package/lib/typescript/module/formatters/currency.d.ts +24 -0
- package/lib/typescript/module/formatters/date.d.ts +22 -0
- package/lib/typescript/module/formatters/dateMath.d.ts +88 -0
- package/lib/typescript/module/formatters/index.d.ts +10 -0
- package/lib/typescript/module/formatters/initials.d.ts +11 -0
- package/lib/typescript/module/formatters/number.d.ts +15 -0
- package/lib/typescript/module/formatters/phone.d.ts +133 -0
- package/lib/typescript/module/formatters/windowsToIanaTable.d.ts +18 -0
- package/lib/typescript/module/geolocation/adapters/expoLocation.d.ts +42 -0
- package/lib/typescript/module/geolocation/index.d.ts +90 -0
- package/lib/typescript/module/index.d.ts +54 -0
- package/lib/typescript/module/initSDK.d.ts +72 -0
- package/lib/typescript/module/initUserAuth.d.ts +41 -0
- package/lib/typescript/module/logger/index.d.ts +81 -0
- package/lib/typescript/module/network/index.d.ts +3 -0
- package/lib/typescript/module/network/networkStatus.d.ts +43 -0
- package/lib/typescript/module/package.json +1 -0
- package/lib/typescript/module/permissions/calendar.d.ts +2 -0
- package/lib/typescript/module/permissions/camera.d.ts +2 -0
- package/lib/typescript/module/permissions/contacts.d.ts +2 -0
- package/lib/typescript/module/permissions/index.d.ts +48 -0
- package/lib/typescript/module/permissions/location.d.ts +2 -0
- package/lib/typescript/module/permissions/mediaLibrary.d.ts +2 -0
- package/lib/typescript/module/permissions/notifications.d.ts +2 -0
- package/lib/typescript/module/permissions/photos.d.ts +2 -0
- package/lib/typescript/module/phone/countries.d.ts +13 -0
- package/lib/typescript/module/share/index.d.ts +29 -0
- package/lib/typescript/module/smsRetriever/index.d.ts +30 -0
- package/lib/typescript/module/specs/NativeSmsRetriever.d.ts +15 -0
- package/lib/typescript/module/sqlite/adapters/expo.d.ts +30 -0
- package/lib/typescript/module/sqlite/index.d.ts +113 -0
- package/lib/typescript/module/storage/index.d.ts +64 -0
- package/lib/typescript/module/utils/imageCompression.d.ts +152 -0
- package/lib/typescript/module/utils/index.d.ts +3 -0
- package/lib/typescript/module/validators/index.d.ts +51 -0
- package/lib/typescript/module/versionCheck/index.d.ts +80 -0
- package/package.json +298 -0
- package/src/specs/NativeSmsRetriever.ts +16 -0
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
import { type CountryCode } from 'libphonenumber-js/max';
|
|
2
|
+
export type { NumberType as PhoneNumberType, PhoneNumber } from 'libphonenumber-js/max';
|
|
3
|
+
export { AsYouType, getCountries, getCountryCallingCode, isSupportedCountry, isValidPhoneNumber, parsePhoneNumber, parsePhoneNumberFromString, validatePhoneNumberLength } from 'libphonenumber-js/max';
|
|
4
|
+
/**
|
|
5
|
+
* Re-exported under our own name rather than importing CountryCode directly
|
|
6
|
+
* everywhere, so a future need to diverge (or re-narrow) has one place to do
|
|
7
|
+
* it. Every ISO 3166-1 alpha-2 code libphonenumber-js recognises - formatPhone
|
|
8
|
+
* and detectPhoneCountry below are genuinely correct for all of them, not a
|
|
9
|
+
* curated subset.
|
|
10
|
+
*/
|
|
11
|
+
export type PhoneCountry = CountryCode;
|
|
12
|
+
export interface FormatPhoneOptions {
|
|
13
|
+
defaultCountryCode?: string;
|
|
14
|
+
country?: PhoneCountry;
|
|
15
|
+
includeCountryCode?: boolean;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Strip everything except digits and a leading `+` (preserved if present).
|
|
19
|
+
*/
|
|
20
|
+
export declare const normalizePhone: (input: string) => string;
|
|
21
|
+
/**
|
|
22
|
+
* Detect the country of a phone number: from its own `+` country code when
|
|
23
|
+
* present, otherwise from `defaultCountryCode`. Returns null when neither
|
|
24
|
+
* parses to a recognised country.
|
|
25
|
+
*/
|
|
26
|
+
export declare const detectPhoneCountry: (input: string, defaultCountryCode?: string) => PhoneCountry | null;
|
|
27
|
+
/**
|
|
28
|
+
* Format a phone number for human display, via libphonenumber-js's own
|
|
29
|
+
* per-country formatting rather than a hand-rolled grouping table - correct
|
|
30
|
+
* for every country it recognises, not a curated subset.
|
|
31
|
+
*
|
|
32
|
+
* - A number that already carries a `+` country code formats for that country.
|
|
33
|
+
* - A bare national number formats for `options.country` when given, else for
|
|
34
|
+
* the country implied by `defaultCountryCode` (default `+91`).
|
|
35
|
+
* - `includeCountryCode` controls international vs national format; defaults
|
|
36
|
+
* to international whenever the country was detected rather than passed in
|
|
37
|
+
* explicitly as `options.country`, and to national when it was.
|
|
38
|
+
* - Input libphonenumber-js can't parse into a valid number for the resolved
|
|
39
|
+
* country falls back to a best-effort `+CC NNNN NNNN…` digit grouping.
|
|
40
|
+
*/
|
|
41
|
+
export declare function formatPhone(input: string, defaultCountryCode?: string): string;
|
|
42
|
+
export declare function formatPhone(input: string, options?: FormatPhoneOptions): string;
|
|
43
|
+
/** Country calling code + national digits, the way a phone field stores them. */
|
|
44
|
+
export interface PhoneParts {
|
|
45
|
+
/** ISO 3166-1 alpha-2 of the country the number belongs to, when it can be told. */
|
|
46
|
+
country: PhoneCountry | null;
|
|
47
|
+
/** Dial prefix WITHOUT the plus, e.g. '91'. */
|
|
48
|
+
callingCode: string;
|
|
49
|
+
/** National digits only, no prefix, no formatting. */
|
|
50
|
+
nationalNumber: string;
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Which kinds of number count as valid. `'any'` is libphonenumber's own
|
|
54
|
+
* answer (a fixed line passes). `'mobile'` narrows to MOBILE and
|
|
55
|
+
* FIXED_LINE_OR_MOBILE, which is what an OTP or WhatsApp field wants: in India
|
|
56
|
+
* a 10-digit number starting with 1 to 5 is a real fixed line and passes
|
|
57
|
+
* `'any'`, but no SMS will ever reach it.
|
|
58
|
+
*/
|
|
59
|
+
export type PhoneValidationKind = 'any' | 'mobile';
|
|
60
|
+
/**
|
|
61
|
+
* Split a typed or pasted number into calling code + national digits.
|
|
62
|
+
* `'+919876543210'` resolves to IN / 91 / 9876543210 from its own prefix; a
|
|
63
|
+
* bare `'9876543210'` needs `defaultCountry` to resolve at all. Returns null
|
|
64
|
+
* when the input has no digits or no country can be told. A shared calling
|
|
65
|
+
* code (`+1` for US and CA) resolves to the country whose area code matches,
|
|
66
|
+
* which is why the country comes back as part of the answer rather than being
|
|
67
|
+
* looked up again from the code.
|
|
68
|
+
*/
|
|
69
|
+
export declare const splitPhoneNumber: (input: string, defaultCountry?: PhoneCountry) => PhoneParts | null;
|
|
70
|
+
/**
|
|
71
|
+
* Cut national digits that run past the longest number the country's plan
|
|
72
|
+
* allows, so a field stops accepting the impossible without a per-country
|
|
73
|
+
* length table. This is the PLAN's ceiling, not a mobile number's: India runs
|
|
74
|
+
* to 13 digits (toll-free 1800 numbers), the US to 10, Germany to 15. A field
|
|
75
|
+
* that should stop where a subscriber's number ends asks
|
|
76
|
+
* `maxNationalNumberLength` instead. Digits within range, including a number
|
|
77
|
+
* still too short, pass through untouched.
|
|
78
|
+
*/
|
|
79
|
+
export declare const clampNationalNumber: (nationalDigits: string, country: PhoneCountry) => string;
|
|
80
|
+
/**
|
|
81
|
+
* The most national digits a subscriber's number can have in a country, so a
|
|
82
|
+
* field can refuse the next digit as it is typed rather than trimming after.
|
|
83
|
+
* `'any'` (default) covers mobile and fixed lines, `'mobile'` mobiles only: India
|
|
84
|
+
* is 10 either way (its plan's 13 belongs to toll-free numbers), Germany is 15
|
|
85
|
+
* for `'any'` and 11 for `'mobile'`, the UAE 9. A country whose metadata lists
|
|
86
|
+
* no lengths by type falls back to the plan's longest number.
|
|
87
|
+
*/
|
|
88
|
+
export declare const maxNationalNumberLength: (country: PhoneCountry, kind?: PhoneValidationKind) => number;
|
|
89
|
+
/**
|
|
90
|
+
* National digits grouped the way the country writes them, updated on every
|
|
91
|
+
* keystroke: `'98765'` for IN is `'98765'`, `'9876543210'` is `'98765 43210'`,
|
|
92
|
+
* `'2025550123'` for US is `'(202) 555-0123'`. Output is for display only; the
|
|
93
|
+
* digits are what a value stores. Digits past the plan's longest possible
|
|
94
|
+
* number are dropped first, so an overflowing paste never formats as a longer
|
|
95
|
+
* number; digits that fit no pattern come back ungrouped rather than forced
|
|
96
|
+
* into a shape.
|
|
97
|
+
*
|
|
98
|
+
* Countries that write a leading 0 (the UAE, the UK, Australia, Saudi Arabia)
|
|
99
|
+
* only group in national mode when that 0 is typed, and a value never holds
|
|
100
|
+
* it. When national mode hands the digits back untouched, the grouping comes
|
|
101
|
+
* from the international form with the calling code removed: `'501234567'`
|
|
102
|
+
* for AE is `'50 123 4567'`. Countries that group nationally are unaffected.
|
|
103
|
+
*/
|
|
104
|
+
export declare const formatPhoneAsTyped: (nationalDigits: string, country: PhoneCountry) => string;
|
|
105
|
+
/**
|
|
106
|
+
* Whether national digits form a real number for the country, by the
|
|
107
|
+
* country's own numbering plan rather than a length check. `kind: 'mobile'`
|
|
108
|
+
* additionally rejects fixed lines; a number whose type the metadata cannot
|
|
109
|
+
* tell is accepted, since the metadata, not the number, is what is missing.
|
|
110
|
+
*/
|
|
111
|
+
export declare const isValidNationalNumber: (nationalDigits: string, country: PhoneCountry, kind?: PhoneValidationKind) => boolean;
|
|
112
|
+
/**
|
|
113
|
+
* The flag as an emoji built from the ISO code's two regional-indicator
|
|
114
|
+
* letters, so no font asset ships with the library: iOS and Android both draw
|
|
115
|
+
* these from the system font. An unknown or malformed code returns ''. (Windows
|
|
116
|
+
* browsers render the two letters instead of a flag; that is the platform, not
|
|
117
|
+
* the code.)
|
|
118
|
+
*/
|
|
119
|
+
export declare const countryFlagEmoji: (iso: string) => string;
|
|
120
|
+
/** Calling code + ISO for one country, the shape a country picker lists. */
|
|
121
|
+
export interface PhoneCountryEntry {
|
|
122
|
+
iso: PhoneCountry;
|
|
123
|
+
/** Dial prefix WITHOUT the plus, e.g. '91'. */
|
|
124
|
+
callingCode: string;
|
|
125
|
+
}
|
|
126
|
+
/**
|
|
127
|
+
* Every country libphonenumber-js knows, with its calling code, in metadata
|
|
128
|
+
* order. Names are deliberately not here: they are display data, in one
|
|
129
|
+
* language, and live on their own import path (`mobile-core/phone/countries`)
|
|
130
|
+
* so an app that never opens a full country list does not carry them.
|
|
131
|
+
*/
|
|
132
|
+
export declare const getPhoneCountries: () => ReadonlyArray<PhoneCountryEntry>;
|
|
133
|
+
//# sourceMappingURL=phone.d.ts.map
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* .NET-style Windows time zone ID → IANA time zone name, one entry per
|
|
3
|
+
* Windows zone, generated from CLDR's `windowsZones.xml` (the same
|
|
4
|
+
* upstream source the retired `windows-iana` npm package derived its own
|
|
5
|
+
* table from). Only the `territory="001"` (world-default) row is kept per
|
|
6
|
+
* Windows zone — `formatTimeInWindowsZone` only ever reads the first IANA
|
|
7
|
+
* candidate, and CLDR's `001` row is exactly that default candidate, so
|
|
8
|
+
* per-country territory variants (`US`, `CA`, `ZZ`, …) carry no information
|
|
9
|
+
* this table's one caller uses.
|
|
10
|
+
*
|
|
11
|
+
* Regenerate with `node packages/core/scripts/generate-windows-to-iana-table.mjs
|
|
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
|
+
* this is a committed, static table; nothing fetches CLDR at build or test
|
|
15
|
+
* time.
|
|
16
|
+
*/
|
|
17
|
+
export declare const WINDOWS_TO_IANA: Readonly<Record<string, string>>;
|
|
18
|
+
//# sourceMappingURL=windowsToIanaTable.d.ts.map
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import type { GeolocationLike } from '../index.js';
|
|
2
|
+
/**
|
|
3
|
+
* The slice of expo-location this adapter uses. Verified against 57.0.14.
|
|
4
|
+
*
|
|
5
|
+
* The REQUIRE lives in the entry point beside this file, never here.
|
|
6
|
+
*/
|
|
7
|
+
export interface ExpoLocationObject {
|
|
8
|
+
coords?: {
|
|
9
|
+
latitude?: number;
|
|
10
|
+
longitude?: number;
|
|
11
|
+
altitude?: number | null;
|
|
12
|
+
accuracy?: number | null;
|
|
13
|
+
heading?: number | null;
|
|
14
|
+
speed?: number | null;
|
|
15
|
+
} | null;
|
|
16
|
+
timestamp?: number;
|
|
17
|
+
}
|
|
18
|
+
export interface ExpoLocationSubscription {
|
|
19
|
+
remove: () => void;
|
|
20
|
+
}
|
|
21
|
+
export interface ExpoLocationLike {
|
|
22
|
+
getCurrentPositionAsync: (options?: Record<string, unknown>) => Promise<ExpoLocationObject>;
|
|
23
|
+
watchPositionAsync: (options: Record<string, unknown>, callback: (location: ExpoLocationObject) => void) => Promise<ExpoLocationSubscription>;
|
|
24
|
+
getForegroundPermissionsAsync?: () => Promise<{
|
|
25
|
+
granted: boolean;
|
|
26
|
+
}>;
|
|
27
|
+
hasServicesEnabledAsync?: () => Promise<boolean>;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Adapts expo-location to the library's geolocation seam.
|
|
31
|
+
*
|
|
32
|
+
* The interesting half is `watchPosition`. The seam must hand back a numeric
|
|
33
|
+
* watch id SYNCHRONOUSLY, while `watchPositionAsync` only resolves its
|
|
34
|
+
* subscription later. So the adapter mints its own id immediately and stores
|
|
35
|
+
* the subscription against it on arrival. `clearWatch` called during that
|
|
36
|
+
* window records the id as cancelled, and the subscription is removed the
|
|
37
|
+
* moment it lands — without that, a screen that unmounts before the watch
|
|
38
|
+
* starts leaks a live GPS listener for the rest of the session, which is a
|
|
39
|
+
* battery drain nobody would attribute to this code.
|
|
40
|
+
*/
|
|
41
|
+
export declare const adaptExpoLocation: (mod: ExpoLocationLike) => GeolocationLike;
|
|
42
|
+
//# sourceMappingURL=expoLocation.d.ts.map
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import '../permissions/location.js';
|
|
2
|
+
export interface GeoCoordinates {
|
|
3
|
+
latitude: number;
|
|
4
|
+
longitude: number;
|
|
5
|
+
accuracy: number;
|
|
6
|
+
altitude: number | null;
|
|
7
|
+
heading: number | null;
|
|
8
|
+
speed: number | null;
|
|
9
|
+
}
|
|
10
|
+
export interface GeoPosition {
|
|
11
|
+
coords: GeoCoordinates;
|
|
12
|
+
timestamp: number;
|
|
13
|
+
}
|
|
14
|
+
export type GeoErrorCode = 'permission-denied' | 'position-unavailable' | 'timeout' | 'services-disabled' | 'unsupported';
|
|
15
|
+
export declare class GeolocationError extends Error {
|
|
16
|
+
readonly code: GeoErrorCode;
|
|
17
|
+
constructor(code: GeoErrorCode, message: string);
|
|
18
|
+
}
|
|
19
|
+
export interface GeoOptions {
|
|
20
|
+
/** `fine` maps to the platform's high-accuracy (GPS) provider. Default `fine`. */
|
|
21
|
+
accuracy?: 'fine' | 'coarse';
|
|
22
|
+
timeoutMs?: number;
|
|
23
|
+
maximumAgeMs?: number;
|
|
24
|
+
/** Extra attempts after the first, used only for `timeout` / `position-unavailable`. */
|
|
25
|
+
retries?: number;
|
|
26
|
+
/** A fix with a worse (larger) accuracy radius counts as `position-unavailable`. */
|
|
27
|
+
minimumAccuracyM?: number;
|
|
28
|
+
/**
|
|
29
|
+
* Pause between retries. Android's fused provider is frequently not ready on
|
|
30
|
+
* the first request after the permission grant or after location is switched
|
|
31
|
+
* on, and retrying immediately just re-collects the same failure.
|
|
32
|
+
*/
|
|
33
|
+
retryDelayMs?: number;
|
|
34
|
+
}
|
|
35
|
+
export interface GeoWatchOptions extends GeoOptions {
|
|
36
|
+
/** Metres the device must move before the listener fires again. */
|
|
37
|
+
distanceFilterM?: number;
|
|
38
|
+
onError?: (error: GeolocationError) => void;
|
|
39
|
+
}
|
|
40
|
+
interface NativeGeoCoords {
|
|
41
|
+
latitude?: number | null;
|
|
42
|
+
longitude?: number | null;
|
|
43
|
+
accuracy?: number | null;
|
|
44
|
+
altitude?: number | null;
|
|
45
|
+
heading?: number | null;
|
|
46
|
+
speed?: number | null;
|
|
47
|
+
}
|
|
48
|
+
interface NativeGeoPosition {
|
|
49
|
+
coords?: NativeGeoCoords | null;
|
|
50
|
+
timestamp?: number | null;
|
|
51
|
+
}
|
|
52
|
+
interface NativeGeoError {
|
|
53
|
+
code?: number;
|
|
54
|
+
message?: string;
|
|
55
|
+
}
|
|
56
|
+
interface NativeGeoOptions {
|
|
57
|
+
enableHighAccuracy?: boolean;
|
|
58
|
+
timeout?: number;
|
|
59
|
+
maximumAge?: number;
|
|
60
|
+
distanceFilter?: number;
|
|
61
|
+
}
|
|
62
|
+
/** Minimal shape of the native geolocation module we depend on. */
|
|
63
|
+
export interface GeolocationLike {
|
|
64
|
+
getCurrentPosition: (onSuccess: (position: NativeGeoPosition) => void, onError?: (error: NativeGeoError) => void, options?: NativeGeoOptions) => void;
|
|
65
|
+
watchPosition: (onSuccess: (position: NativeGeoPosition) => void, onError?: (error: NativeGeoError) => void, options?: NativeGeoOptions) => number;
|
|
66
|
+
clearWatch: (watchId: number) => void;
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Replace the geolocation provider. Intended for TESTS and for the showcase,
|
|
70
|
+
* which injects a denying provider to demo the permission and services-off
|
|
71
|
+
* errors; an app gets expo-location without wiring anything. Pass `null` to
|
|
72
|
+
* restore it.
|
|
73
|
+
*/
|
|
74
|
+
export declare const setGeolocationImplementation: (impl: GeolocationLike | null) => void;
|
|
75
|
+
export declare const Geolocation: {
|
|
76
|
+
getCurrentPosition: (options?: GeoOptions) => Promise<GeoPosition>;
|
|
77
|
+
watchPosition: (listener: (position: GeoPosition) => void, options?: GeoWatchOptions) => (() => void);
|
|
78
|
+
isAvailable: () => boolean;
|
|
79
|
+
};
|
|
80
|
+
export interface UseCurrentPositionResult {
|
|
81
|
+
position: GeoPosition | null;
|
|
82
|
+
error: GeolocationError | null;
|
|
83
|
+
loading: boolean;
|
|
84
|
+
refresh: () => void;
|
|
85
|
+
}
|
|
86
|
+
export declare const useCurrentPosition: (options?: GeoOptions & {
|
|
87
|
+
enabled?: boolean;
|
|
88
|
+
}) => UseCurrentPositionResult;
|
|
89
|
+
export {};
|
|
90
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The main barrel deliberately does NOT re-export the modules that need a native
|
|
3
|
+
* package. Metro resolves requires statically, so anything reachable from here
|
|
4
|
+
* is resolved for every consumer, which would make an optional peer mandatory
|
|
5
|
+
* for anyone importing anything at all. Those live behind their own import
|
|
6
|
+
* paths instead:
|
|
7
|
+
*
|
|
8
|
+
* @webority/mobile-core/permissions per kind, its own Expo module
|
|
9
|
+
* @webority/mobile-core/compressor expo-image-manipulator + expo-file-system
|
|
10
|
+
* @webority/mobile-core/geolocation a geolocation provider
|
|
11
|
+
* @webority/mobile-core/sqlite expo-sqlite
|
|
12
|
+
* @webority/mobile-core/download a filesystem module
|
|
13
|
+
* @webority/mobile-core/share expo-sharing
|
|
14
|
+
* @webority/mobile-core/smsRetriever Android only, own TurboModule
|
|
15
|
+
*
|
|
16
|
+
* One more path is separate for size, not for a native package:
|
|
17
|
+
*
|
|
18
|
+
* @webority/mobile-core/phone/countries 245 English country names
|
|
19
|
+
*
|
|
20
|
+
* Token storage is the exception and IS on the main barrel, because the HTTP
|
|
21
|
+
* client reads the bearer token. It needs no optional peer: the backend is
|
|
22
|
+
* expo-secure-store, and `expo` is required anyway.
|
|
23
|
+
*/
|
|
24
|
+
export { buildCurl, logCurl } from './api/curl.js';
|
|
25
|
+
export { default as publicClient } from './api/publicClient.js';
|
|
26
|
+
export type { RetryPolicy } from './api/retry.js';
|
|
27
|
+
export { attachRetry, isRetryableStatus } from './api/retry.js';
|
|
28
|
+
export type { RefreshableStore, SessionTerminationCode } from './api/userClient.js';
|
|
29
|
+
export { default as userClient, injectStore, injectUserAuth, RequestOfflineError, resetRefreshState, SESSION_TERMINATION_CODES } from './api/userClient.js';
|
|
30
|
+
export type { KeychainLike, SecureCredentials, StoredToken } from './auth/authStore.js';
|
|
31
|
+
export { ACCESS_TOKEN_KEY, getToken, REFRESH_TOKEN_KEY, removeToken, setKeychainImplementation, storeToken } from './auth/authStore.js';
|
|
32
|
+
export type { JwtClaims } from './auth/jwt.js';
|
|
33
|
+
export { decodeJWT, getJWTExpiry, isJWTExpired } from './auth/jwt.js';
|
|
34
|
+
export type { Config, Environment, LogLevel } from './config/index.js';
|
|
35
|
+
export { getConfig, getConfigValue, resetConfig, setConfig } from './config/index.js';
|
|
36
|
+
export type { DeepLinkConfig, DeepLinkRoute, ParsedLink } from './deepLink/index.js';
|
|
37
|
+
export { DeepLink, parseDeepLink, useDeepLink } from './deepLink/index.js';
|
|
38
|
+
export type { DateInput, DateStyle, FormatCurrencyOptions, FormatPhoneOptions, PhoneCountry, PhoneCountryEntry, PhoneNumber, PhoneNumberType, PhoneParts, PhoneValidationKind, TimeStyle } from './formatters/index.js';
|
|
39
|
+
export { AsYouType, addDays, clampNationalNumber, countryFlagEmoji, detectPhoneCountry, diffMs, formatCompactNumber, formatCurrency, formatDate, formatDateDDMMMYYYY, formatDateISO, formatDatePattern, formatDateTime, formatNumber, formatPercent, formatPhone, formatPhoneAsTyped, formatRelativeTime, formatTime, formatTime12h, formatTimeInWindowsZone, formatTimeInZone, getCountries, getCountryCallingCode, getInitials, getPhoneCountries, isDateAfter, isDateBefore, isSameDay, isSupportedCountry, isValidNationalNumber, isValidPhoneNumber, maxNationalNumberLength, normalizePhone, parsePhoneNumber, parsePhoneNumberFromString, splitPhoneNumber, startOfDay, validatePhoneNumberLength } from './formatters/index.js';
|
|
40
|
+
export type { InitConfig } from './initSDK.js';
|
|
41
|
+
export { initWebority } from './initSDK.js';
|
|
42
|
+
export type { TokenRefreshConfig, TokenRefreshResult, UserAuthOptions } from './initUserAuth.js';
|
|
43
|
+
export { initUserAuth } from './initUserAuth.js';
|
|
44
|
+
export type { DeviceContext, LoggerOptions, LoggerType, RemoteLogger } from './logger/index.js';
|
|
45
|
+
export { configureLogger, getDeviceContext, Logger, setDeviceContext, setRemoteLogger } from './logger/index.js';
|
|
46
|
+
export type { NetworkConnectionType, NetworkStatus, NetworkStatusLike, NetworkStatusListener } from './network/index.js';
|
|
47
|
+
export { addNetworkStatusListener, getNetworkStatus, setNetworkStatusImplementation, useNetworkStatus } from './network/index.js';
|
|
48
|
+
export type { AsyncStorageLike, StorageApi } from './storage/index.js';
|
|
49
|
+
export { isStorageAvailable, Storage, setStorageImplementation } from './storage/index.js';
|
|
50
|
+
export type { PasswordRules } from './validators/index.js';
|
|
51
|
+
export { isAadhaar, isAlphanumeric, isBetween, isEmail, isGstin, isHexColor, isIfsc, isIndianMobile, isIndianPincode, isInteger, isNonEmpty, isNumeric, isPan, isPhone, isStrongPassword, isUrl, maxLength, minLength } from './validators/index.js';
|
|
52
|
+
export type { DeviceInfoLike, ParsedVersion, Platform, UpdateInfo, UpdateType, VersionCheckResult, VersionCheckType, VersionComparison, VersionData } from './versionCheck/index.js';
|
|
53
|
+
export { setDeviceInfoImplementation, useVersionCheck, VersionCheck } from './versionCheck/index.js';
|
|
54
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Simple initialization API for Webority packages
|
|
3
|
+
* One function to configure everything needed
|
|
4
|
+
*/
|
|
5
|
+
import { type KeychainLike } from './auth/authStore.js';
|
|
6
|
+
import { type Environment, type LogLevel } from './config/index.js';
|
|
7
|
+
import { type NetInfoLike } from './network/networkStatus.js';
|
|
8
|
+
import { setStorageImplementation } from './storage/index.js';
|
|
9
|
+
export interface InitConfig {
|
|
10
|
+
/** Your API base URL (required) */
|
|
11
|
+
baseUrl: string;
|
|
12
|
+
/** Enable/disable logging. Defaults to `true`. */
|
|
13
|
+
loggingEnabled?: boolean;
|
|
14
|
+
/** Log level. Defaults to `'info'`. */
|
|
15
|
+
logLevel?: LogLevel;
|
|
16
|
+
/** Environment. Defaults to `'Development'`. */
|
|
17
|
+
environment?: Environment;
|
|
18
|
+
/**
|
|
19
|
+
* ISO 3166-1 alpha-2 country code (lowercase) used for App Store / Play Store
|
|
20
|
+
* version checks. Defaults to `'in'`.
|
|
21
|
+
*/
|
|
22
|
+
country?: string;
|
|
23
|
+
/**
|
|
24
|
+
* The app's store identifier (Android package name / iOS bundle id) and its
|
|
25
|
+
* user-visible version, both needed by the version-check module. Every
|
|
26
|
+
* Webority app already has them in `appsettings.Compiled.json`, which is why
|
|
27
|
+
* they come from config rather than across the native bridge.
|
|
28
|
+
*/
|
|
29
|
+
appId?: string;
|
|
30
|
+
appVersion?: string;
|
|
31
|
+
/**
|
|
32
|
+
* Log a redacted curl line per request. Off by default; it is a debugging
|
|
33
|
+
* aid, not something to leave on.
|
|
34
|
+
*/
|
|
35
|
+
logCurl?: boolean;
|
|
36
|
+
/**
|
|
37
|
+
* The native modules that fill the seams the library does not import.
|
|
38
|
+
*
|
|
39
|
+
* Passing them here is strongly preferred over calling each setter, because
|
|
40
|
+
* forgetting one is silent: storage returns falsy and network status reports
|
|
41
|
+
* optimistic online, so an app looks like it works and simply never persists
|
|
42
|
+
* anything. The pilot migration wired NONE of them and nothing said so.
|
|
43
|
+
*
|
|
44
|
+
* Every value is whatever that surface's package exports, or an Expo adapter
|
|
45
|
+
* from its own import path. See docs/expo.md.
|
|
46
|
+
*/
|
|
47
|
+
backends?: {
|
|
48
|
+
storage?: Parameters<typeof setStorageImplementation>[0];
|
|
49
|
+
keychain?: KeychainLike | null;
|
|
50
|
+
network?: NetInfoLike | null;
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Initialize Webority packages with your project configuration.
|
|
55
|
+
*
|
|
56
|
+
* @example
|
|
57
|
+
* // Basic setup
|
|
58
|
+
* initWebority({
|
|
59
|
+
* baseUrl: 'https://api.myapp.com'
|
|
60
|
+
* });
|
|
61
|
+
*
|
|
62
|
+
* @example
|
|
63
|
+
* // Full configuration
|
|
64
|
+
* initWebority({
|
|
65
|
+
* baseUrl: 'https://api.myapp.com',
|
|
66
|
+
* loggingEnabled: __DEV__,
|
|
67
|
+
* logLevel: 'warn',
|
|
68
|
+
* environment: __DEV__ ? 'Development' : 'Production'
|
|
69
|
+
* });
|
|
70
|
+
*/
|
|
71
|
+
export declare const initWebority: (config: InitConfig) => void;
|
|
72
|
+
//# sourceMappingURL=initSDK.d.ts.map
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/** The tokens a refresh response carries, with their expiry timestamps. */
|
|
2
|
+
export interface TokenRefreshResult {
|
|
3
|
+
accessToken: string;
|
|
4
|
+
accessTokenExpiry: string;
|
|
5
|
+
refreshToken: string;
|
|
6
|
+
refreshTokenExpiry: string;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* How the library calls the app's refresh endpoint. The call goes through
|
|
10
|
+
* `publicClient`, and the new tokens are stored under the library's own keys.
|
|
11
|
+
*/
|
|
12
|
+
export interface TokenRefreshConfig {
|
|
13
|
+
/** The refresh endpoint, relative to the configured baseUrl, e.g. `/Account/RefreshToken`. */
|
|
14
|
+
path: string;
|
|
15
|
+
/** The request body; may return a promise. Defaults to `{ accessToken, refreshToken }`. */
|
|
16
|
+
body?: (tokens: {
|
|
17
|
+
accessToken: string | null;
|
|
18
|
+
refreshToken: string;
|
|
19
|
+
}) => unknown;
|
|
20
|
+
/**
|
|
21
|
+
* Reads the new tokens from the response body. Defaults to the Webority API's
|
|
22
|
+
* `{ accessToken, accessTokenExpiration, refreshToken, refreshTokenExpiration }`.
|
|
23
|
+
*/
|
|
24
|
+
readTokens?: (data: unknown) => TokenRefreshResult;
|
|
25
|
+
}
|
|
26
|
+
export interface UserAuthOptions {
|
|
27
|
+
/** Action creator dispatched when the session is over. */
|
|
28
|
+
logout: () => unknown;
|
|
29
|
+
refresh: TokenRefreshConfig;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Wire the user client to the app: the Redux store it dispatches `logout` to,
|
|
33
|
+
* and the refresh endpoint it calls when an access token expires or a request
|
|
34
|
+
* answers 401. Only a 400 or 401 from that endpoint, or a missing or expired
|
|
35
|
+
* refresh token, logs out; a network error, timeout or 5xx keeps the session.
|
|
36
|
+
*
|
|
37
|
+
* @example
|
|
38
|
+
* initUserAuth(store, { logout, refresh: { path: '/Account/RefreshToken' } });
|
|
39
|
+
*/
|
|
40
|
+
export declare const initUserAuth: <S>(store: S, options: UserAuthOptions) => void;
|
|
41
|
+
//# sourceMappingURL=initUserAuth.d.ts.map
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { type LogLevel } from '../config/index.js';
|
|
2
|
+
type LogFn = (message: string, ...optionalParams: unknown[]) => void;
|
|
3
|
+
/**
|
|
4
|
+
* Optional remote sink. Apps wire this via `setRemoteLogger()` to forward errors
|
|
5
|
+
* and breadcrumbs to Crashlytics, Sentry, Bugsnag, etc. — without making the
|
|
6
|
+
* library depend on any of them.
|
|
7
|
+
*
|
|
8
|
+
* Every method is optional; the library calls only what the adapter implements.
|
|
9
|
+
*/
|
|
10
|
+
export interface RemoteLogger {
|
|
11
|
+
/** Append a breadcrumb (small, non-error event) for crash context. */
|
|
12
|
+
breadcrumb?: (message: string, data?: Record<string, unknown>) => void;
|
|
13
|
+
/** Record a non-fatal error with optional context. */
|
|
14
|
+
recordError?: (error: unknown, context?: Record<string, unknown>) => void;
|
|
15
|
+
/** Bind a logical user to subsequent events. */
|
|
16
|
+
setUser?: (id: string | null, attrs?: Record<string, unknown>) => void;
|
|
17
|
+
/** Attach a custom attribute / tag (e.g. `release`, `env`). */
|
|
18
|
+
setAttribute?: (key: string, value: string | number | boolean | null) => void;
|
|
19
|
+
/** Forward a leveled console message. */
|
|
20
|
+
log?: (level: LogLevel, message: string, optionalParams: unknown[]) => void;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Inject a remote logger adapter (e.g. Firebase Crashlytics, Sentry).
|
|
24
|
+
* Pass `null` to detach. Safe to call before or after `initWebority`.
|
|
25
|
+
*/
|
|
26
|
+
export declare const setRemoteLogger: (impl: RemoteLogger | null) => void;
|
|
27
|
+
/**
|
|
28
|
+
* Device / app context attached once at boot (platform, OS version, app version,
|
|
29
|
+
* build number, device model, etc). Merged into every `recordError` context so
|
|
30
|
+
* every crash carries it without every call site repeating it.
|
|
31
|
+
*/
|
|
32
|
+
export interface DeviceContext {
|
|
33
|
+
platform: string;
|
|
34
|
+
osVersion?: string;
|
|
35
|
+
appVersion?: string;
|
|
36
|
+
buildNumber?: string;
|
|
37
|
+
deviceModel?: string;
|
|
38
|
+
isEmulator?: boolean;
|
|
39
|
+
locale?: string;
|
|
40
|
+
[key: string]: unknown;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Set (or clear, with `null`) the device/app context merged into every
|
|
44
|
+
* `recordError` call. Each key is also forwarded to `remote.setAttribute`
|
|
45
|
+
* once, at the moment it is set.
|
|
46
|
+
*/
|
|
47
|
+
export declare const setDeviceContext: (context: DeviceContext | null) => void;
|
|
48
|
+
export declare const getDeviceContext: () => DeviceContext | null;
|
|
49
|
+
/** Tuning knobs for screen history and duplicate-error suppression. */
|
|
50
|
+
export interface LoggerOptions {
|
|
51
|
+
/** Identical errors within this window are collapsed. Default 5000ms. 0 disables dedupe. */
|
|
52
|
+
dedupeWindowMs?: number;
|
|
53
|
+
/** Max identical errors forwarded per window before suppression. Default 1. */
|
|
54
|
+
dedupeMaxPerWindow?: number;
|
|
55
|
+
/** Cap on tracked screen history. Default 20. */
|
|
56
|
+
screenHistoryLimit?: number;
|
|
57
|
+
}
|
|
58
|
+
/** Configure dedupe window/threshold and screen history size. Merges with current options. */
|
|
59
|
+
export declare const configureLogger: (options: LoggerOptions) => void;
|
|
60
|
+
export interface LoggerType {
|
|
61
|
+
info: LogFn;
|
|
62
|
+
warn: LogFn;
|
|
63
|
+
error: LogFn;
|
|
64
|
+
/** Append a breadcrumb to the remote sink (and log at info level). */
|
|
65
|
+
breadcrumb: (message: string, data?: Record<string, unknown>) => void;
|
|
66
|
+
/** Record a non-fatal error with optional context. */
|
|
67
|
+
recordError: (error: unknown, context?: Record<string, unknown>) => void;
|
|
68
|
+
/** Bind a user identity for subsequent crash reports. */
|
|
69
|
+
setUser: (id: string | null, attrs?: Record<string, unknown>) => void;
|
|
70
|
+
/** Attach a custom attribute (release, build, env, role, etc.). */
|
|
71
|
+
setAttribute: (key: string, value: string | number | boolean | null) => void;
|
|
72
|
+
/** Record the active screen; attaches `screen` to subsequent `recordError` context. */
|
|
73
|
+
trackScreen: (name: string, params?: Record<string, unknown>) => void;
|
|
74
|
+
/** The most recently tracked screen name, or `null` if none was tracked yet. */
|
|
75
|
+
getCurrentScreen: () => string | null;
|
|
76
|
+
/** Bounded history of tracked screen names, oldest first. */
|
|
77
|
+
getScreenHistory: () => string[];
|
|
78
|
+
}
|
|
79
|
+
export declare const Logger: LoggerType;
|
|
80
|
+
export {};
|
|
81
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export type { NetworkConnectionType, NetworkStatus, NetworkStatusLike, NetworkStatusListener } from './networkStatus.js';
|
|
2
|
+
export { addNetworkStatusListener, getNetworkStatus, setNetworkStatusImplementation, useNetworkStatus } from './networkStatus.js';
|
|
3
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
export type NetworkConnectionType = 'unknown' | 'none' | 'wifi' | 'cellular' | 'bluetooth' | 'ethernet' | 'wimax' | 'vpn' | 'other';
|
|
2
|
+
export interface NetworkStatus {
|
|
3
|
+
/** True when the device has any network connection. */
|
|
4
|
+
isConnected: boolean;
|
|
5
|
+
/**
|
|
6
|
+
* True when the connection can reach the public internet
|
|
7
|
+
* (NetInfo's reachability probe). `null` when undetermined.
|
|
8
|
+
*/
|
|
9
|
+
isInternetReachable: boolean | null;
|
|
10
|
+
type: NetworkConnectionType;
|
|
11
|
+
}
|
|
12
|
+
export type NetworkStatusListener = (status: NetworkStatus) => void;
|
|
13
|
+
interface NetInfoStateLike {
|
|
14
|
+
isConnected: boolean | null;
|
|
15
|
+
isInternetReachable: boolean | null;
|
|
16
|
+
type?: string;
|
|
17
|
+
}
|
|
18
|
+
export interface NetInfoLike {
|
|
19
|
+
fetch: () => Promise<NetInfoStateLike>;
|
|
20
|
+
addEventListener: (cb: (state: NetInfoStateLike) => void) => () => void;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Replace the backend. Intended for TESTS and for the showcase, which uses it
|
|
24
|
+
* to reach error paths that a healthy device never takes; it is not the way an
|
|
25
|
+
* app is meant to configure the library. Pass `null` to restore expo-network.
|
|
26
|
+
*/
|
|
27
|
+
export declare const setNetworkStatusImplementation: (impl: NetInfoLike | null) => void;
|
|
28
|
+
/**
|
|
29
|
+
* Imperative one-shot fetch of current network status. Resolves to the default
|
|
30
|
+
* online status when NetInfo is unavailable so callers never crash.
|
|
31
|
+
*/
|
|
32
|
+
export declare const getNetworkStatus: () => Promise<NetworkStatus>;
|
|
33
|
+
/**
|
|
34
|
+
* Subscribe to network status changes. Returns an unsubscribe function.
|
|
35
|
+
*/
|
|
36
|
+
export declare const addNetworkStatusListener: (listener: NetworkStatusListener) => (() => void);
|
|
37
|
+
/**
|
|
38
|
+
* React hook that returns the current network status and re-renders on change.
|
|
39
|
+
* Reports an optimistic online default when NetInfo is not installed.
|
|
40
|
+
*/
|
|
41
|
+
export declare const useNetworkStatus: () => NetworkStatus;
|
|
42
|
+
export type { NetInfoLike as NetworkStatusLike };
|
|
43
|
+
//# sourceMappingURL=networkStatus.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"type":"module"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
export type PermissionKind = 'camera' | 'microphone' | 'photos' | 'photosAdd' | 'mediaLibrary' | 'location' | 'locationAlways' | 'contacts' | 'calendar' | 'reminders' | 'notifications' | 'bluetooth' | 'storage';
|
|
2
|
+
export type PermissionStatus = 'unavailable' | 'denied' | 'limited' | 'granted' | 'blocked';
|
|
3
|
+
/** The shared response shape every Expo permission function returns. */
|
|
4
|
+
interface ExpoPermissionResponse {
|
|
5
|
+
status: 'granted' | 'denied' | 'undetermined';
|
|
6
|
+
granted: boolean;
|
|
7
|
+
canAskAgain: boolean;
|
|
8
|
+
/** iOS partial photo access, from expo-image-picker's MediaLibraryPermissionResponse. */
|
|
9
|
+
accessPrivileges?: 'all' | 'limited' | 'none';
|
|
10
|
+
}
|
|
11
|
+
interface ExpoPermissionFns {
|
|
12
|
+
check: () => Promise<ExpoPermissionResponse>;
|
|
13
|
+
request: () => Promise<ExpoPermissionResponse>;
|
|
14
|
+
}
|
|
15
|
+
export interface PermissionsBackend {
|
|
16
|
+
check: (kind: PermissionKind) => Promise<PermissionStatus>;
|
|
17
|
+
request: (kind: PermissionKind) => Promise<PermissionStatus>;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Inject a custom permissions backend at runtime. Pass `null` to reset to the
|
|
21
|
+
* default per-kind Expo resolution.
|
|
22
|
+
*
|
|
23
|
+
* Two legitimate reasons to call this: tests/the showcase reaching a denied,
|
|
24
|
+
* blocked or unavailable path a healthy device never takes; and an app that
|
|
25
|
+
* genuinely needs `bluetooth` or `storage`, which no Expo module covers.
|
|
26
|
+
*/
|
|
27
|
+
export declare const setPermissionsImplementation: (impl: PermissionsBackend | null) => void;
|
|
28
|
+
/** Called by the per-package entry points to register their kind(s). Not for app code. */
|
|
29
|
+
export declare const registerPermissionAdapter: (kind: PermissionKind, fns: ExpoPermissionFns) => void;
|
|
30
|
+
/**
|
|
31
|
+
* Cross-platform permissions wrapper. Maps an abstract `PermissionKind`
|
|
32
|
+
* (camera, photos, location, notifications, …) to whichever Expo adapter an
|
|
33
|
+
* app has registered by importing that kind's entry point — expo-camera,
|
|
34
|
+
* expo-image-picker, expo-location, expo-contacts, expo-calendar,
|
|
35
|
+
* expo-notifications, expo-media-library. An app imports only the entry
|
|
36
|
+
* points for the kinds it actually asks for.
|
|
37
|
+
*/
|
|
38
|
+
export declare const Permissions: {
|
|
39
|
+
check: (kind: PermissionKind) => Promise<PermissionStatus>;
|
|
40
|
+
request: (kind: PermissionKind) => Promise<PermissionStatus>;
|
|
41
|
+
/** Convenience: returns true when the permission is `granted` or `limited`. */
|
|
42
|
+
isAuthorized: (kind: PermissionKind) => Promise<boolean>;
|
|
43
|
+
/** Convenience: check, and request only if not yet granted. */
|
|
44
|
+
ensure: (kind: PermissionKind) => Promise<PermissionStatus>;
|
|
45
|
+
openSettings: () => Promise<boolean>;
|
|
46
|
+
};
|
|
47
|
+
export {};
|
|
48
|
+
//# sourceMappingURL=index.d.ts.map
|