@webority-technologies/mobile-core 0.0.2 → 0.0.3
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/lib/commonjs/formatters/index.js +18 -0
- package/lib/commonjs/formatters/phone.js +29 -0
- package/lib/commonjs/index.js +18 -0
- package/lib/commonjs/storage/index.js +1 -1
- package/lib/module/formatters/index.js +1 -1
- package/lib/module/formatters/phone.js +11 -0
- package/lib/module/index.js +1 -1
- package/lib/module/storage/index.js +1 -1
- package/lib/typescript/commonjs/formatters/index.d.ts +2 -2
- package/lib/typescript/commonjs/formatters/phone.d.ts +11 -0
- package/lib/typescript/commonjs/index.d.ts +2 -2
- package/lib/typescript/commonjs/storage/index.d.ts +1 -1
- package/lib/typescript/module/formatters/index.d.ts +2 -2
- package/lib/typescript/module/formatters/phone.d.ts +11 -0
- package/lib/typescript/module/index.d.ts +2 -2
- package/lib/typescript/module/storage/index.d.ts +1 -1
- package/package.json +3 -2
|
@@ -69,12 +69,30 @@ Object.defineProperty(exports, "getInitials", {
|
|
|
69
69
|
return _initials.getInitials;
|
|
70
70
|
}
|
|
71
71
|
});
|
|
72
|
+
Object.defineProperty(exports, "isValidPhoneNumber", {
|
|
73
|
+
enumerable: true,
|
|
74
|
+
get: function () {
|
|
75
|
+
return _phone.isValidPhoneNumber;
|
|
76
|
+
}
|
|
77
|
+
});
|
|
72
78
|
Object.defineProperty(exports, "normalizePhone", {
|
|
73
79
|
enumerable: true,
|
|
74
80
|
get: function () {
|
|
75
81
|
return _phone.normalizePhone;
|
|
76
82
|
}
|
|
77
83
|
});
|
|
84
|
+
Object.defineProperty(exports, "parsePhoneNumber", {
|
|
85
|
+
enumerable: true,
|
|
86
|
+
get: function () {
|
|
87
|
+
return _phone.parsePhoneNumber;
|
|
88
|
+
}
|
|
89
|
+
});
|
|
90
|
+
Object.defineProperty(exports, "parsePhoneNumberFromString", {
|
|
91
|
+
enumerable: true,
|
|
92
|
+
get: function () {
|
|
93
|
+
return _phone.parsePhoneNumberFromString;
|
|
94
|
+
}
|
|
95
|
+
});
|
|
78
96
|
var _currency = require("./currency.js");
|
|
79
97
|
var _date = require("./date.js");
|
|
80
98
|
var _initials = require("./initials.js");
|
|
@@ -5,7 +5,36 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.detectPhoneCountry = void 0;
|
|
7
7
|
exports.formatPhone = formatPhone;
|
|
8
|
+
Object.defineProperty(exports, "isValidPhoneNumber", {
|
|
9
|
+
enumerable: true,
|
|
10
|
+
get: function () {
|
|
11
|
+
return _libphonenumberJs.isValidPhoneNumber;
|
|
12
|
+
}
|
|
13
|
+
});
|
|
8
14
|
exports.normalizePhone = void 0;
|
|
15
|
+
Object.defineProperty(exports, "parsePhoneNumber", {
|
|
16
|
+
enumerable: true,
|
|
17
|
+
get: function () {
|
|
18
|
+
return _libphonenumberJs.parsePhoneNumber;
|
|
19
|
+
}
|
|
20
|
+
});
|
|
21
|
+
Object.defineProperty(exports, "parsePhoneNumberFromString", {
|
|
22
|
+
enumerable: true,
|
|
23
|
+
get: function () {
|
|
24
|
+
return _libphonenumberJs.parsePhoneNumberFromString;
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
var _libphonenumberJs = require("libphonenumber-js");
|
|
28
|
+
/**
|
|
29
|
+
* Real cross-country validation, re-exported rather than reimplemented.
|
|
30
|
+
* formatPhone/normalizePhone/detectPhoneCountry below are a fast, dependency-
|
|
31
|
+
* light DISPLAY formatter for a fixed set of countries; they are not a
|
|
32
|
+
* validator. Real phone number plans have country-specific area-code and
|
|
33
|
+
* mobile-prefix rules that only a maintained metadata table gets right -
|
|
34
|
+
* hand-rolling that risks silently-wrong validation for a country nobody
|
|
35
|
+
* tests against. Both live here so consumers get one phone module, not two.
|
|
36
|
+
*/
|
|
37
|
+
|
|
9
38
|
/**
|
|
10
39
|
* Strip everything except digits and a leading `+` (preserved if present).
|
|
11
40
|
*/
|
package/lib/commonjs/index.js
CHANGED
|
@@ -321,6 +321,12 @@ Object.defineProperty(exports, "isUrl", {
|
|
|
321
321
|
return _index7.isUrl;
|
|
322
322
|
}
|
|
323
323
|
});
|
|
324
|
+
Object.defineProperty(exports, "isValidPhoneNumber", {
|
|
325
|
+
enumerable: true,
|
|
326
|
+
get: function () {
|
|
327
|
+
return _index3.isValidPhoneNumber;
|
|
328
|
+
}
|
|
329
|
+
});
|
|
324
330
|
Object.defineProperty(exports, "logCurl", {
|
|
325
331
|
enumerable: true,
|
|
326
332
|
get: function () {
|
|
@@ -351,6 +357,18 @@ Object.defineProperty(exports, "parseDeepLink", {
|
|
|
351
357
|
return _index2.parseDeepLink;
|
|
352
358
|
}
|
|
353
359
|
});
|
|
360
|
+
Object.defineProperty(exports, "parsePhoneNumber", {
|
|
361
|
+
enumerable: true,
|
|
362
|
+
get: function () {
|
|
363
|
+
return _index3.parsePhoneNumber;
|
|
364
|
+
}
|
|
365
|
+
});
|
|
366
|
+
Object.defineProperty(exports, "parsePhoneNumberFromString", {
|
|
367
|
+
enumerable: true,
|
|
368
|
+
get: function () {
|
|
369
|
+
return _index3.parsePhoneNumberFromString;
|
|
370
|
+
}
|
|
371
|
+
});
|
|
354
372
|
Object.defineProperty(exports, "publicClient", {
|
|
355
373
|
enumerable: true,
|
|
356
374
|
get: function () {
|
|
@@ -196,7 +196,7 @@ const getAllKeys = async () => {
|
|
|
196
196
|
* All operations swallow errors (logging them) and return a falsy result
|
|
197
197
|
* so that storage problems never crash the app.
|
|
198
198
|
*
|
|
199
|
-
* Backed by
|
|
199
|
+
* Backed by `expo-sqlite/kv-store` by default;
|
|
200
200
|
* override with `setStorageImplementation()` for MMKV or custom adapters.
|
|
201
201
|
*/
|
|
202
202
|
const Storage = exports.Storage = {
|
|
@@ -4,5 +4,5 @@ export { formatCurrency } from "./currency.js";
|
|
|
4
4
|
export { formatDate, formatDateTime, formatRelativeTime, formatTime } from "./date.js";
|
|
5
5
|
export { getInitials } from "./initials.js";
|
|
6
6
|
export { formatCompactNumber, formatNumber, formatPercent } from "./number.js";
|
|
7
|
-
export { detectPhoneCountry, formatPhone, normalizePhone } from "./phone.js";
|
|
7
|
+
export { detectPhoneCountry, formatPhone, isValidPhoneNumber, normalizePhone, parsePhoneNumber, parsePhoneNumberFromString } from "./phone.js";
|
|
8
8
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,5 +1,16 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
/**
|
|
4
|
+
* Real cross-country validation, re-exported rather than reimplemented.
|
|
5
|
+
* formatPhone/normalizePhone/detectPhoneCountry below are a fast, dependency-
|
|
6
|
+
* light DISPLAY formatter for a fixed set of countries; they are not a
|
|
7
|
+
* validator. Real phone number plans have country-specific area-code and
|
|
8
|
+
* mobile-prefix rules that only a maintained metadata table gets right -
|
|
9
|
+
* hand-rolling that risks silently-wrong validation for a country nobody
|
|
10
|
+
* tests against. Both live here so consumers get one phone module, not two.
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
export { isValidPhoneNumber, parsePhoneNumber, parsePhoneNumberFromString } from 'libphonenumber-js';
|
|
3
14
|
/**
|
|
4
15
|
* Strip everything except digits and a leading `+` (preserved if present).
|
|
5
16
|
*/
|
package/lib/module/index.js
CHANGED
|
@@ -29,7 +29,7 @@ export { getConfig, getConfigValue, resetConfig, setConfig } from "./config/inde
|
|
|
29
29
|
// Deep links
|
|
30
30
|
export { DeepLink, parseDeepLink, useDeepLink } from "./deepLink/index.js";
|
|
31
31
|
// Formatters
|
|
32
|
-
export { detectPhoneCountry, formatCompactNumber, formatCurrency, formatDate, formatDateTime, formatNumber, formatPercent, formatPhone, formatRelativeTime, formatTime, getInitials, normalizePhone } from "./formatters/index.js";
|
|
32
|
+
export { detectPhoneCountry, formatCompactNumber, formatCurrency, formatDate, formatDateTime, formatNumber, formatPercent, formatPhone, formatRelativeTime, formatTime, getInitials, isValidPhoneNumber, normalizePhone, parsePhoneNumber, parsePhoneNumberFromString } from "./formatters/index.js";
|
|
33
33
|
// Initialization
|
|
34
34
|
export { initWebority } from "./initSDK.js";
|
|
35
35
|
export { initUserAuth } from "./initUserAuth.js";
|
|
@@ -190,7 +190,7 @@ const getAllKeys = async () => {
|
|
|
190
190
|
* All operations swallow errors (logging them) and return a falsy result
|
|
191
191
|
* so that storage problems never crash the app.
|
|
192
192
|
*
|
|
193
|
-
* Backed by
|
|
193
|
+
* Backed by `expo-sqlite/kv-store` by default;
|
|
194
194
|
* override with `setStorageImplementation()` for MMKV or custom adapters.
|
|
195
195
|
*/
|
|
196
196
|
export const Storage = {
|
|
@@ -4,6 +4,6 @@ export type { DateInput, DateStyle, TimeStyle } from './date';
|
|
|
4
4
|
export { formatDate, formatDateTime, formatRelativeTime, formatTime } from './date';
|
|
5
5
|
export { getInitials } from './initials';
|
|
6
6
|
export { formatCompactNumber, formatNumber, formatPercent } from './number';
|
|
7
|
-
export type { FormatPhoneOptions, PhoneCountry } from './phone';
|
|
8
|
-
export { detectPhoneCountry, formatPhone, normalizePhone } from './phone';
|
|
7
|
+
export type { FormatPhoneOptions, PhoneCountry, PhoneNumber } from './phone';
|
|
8
|
+
export { detectPhoneCountry, formatPhone, isValidPhoneNumber, normalizePhone, parsePhoneNumber, parsePhoneNumberFromString } from './phone';
|
|
9
9
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1,3 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Real cross-country validation, re-exported rather than reimplemented.
|
|
3
|
+
* formatPhone/normalizePhone/detectPhoneCountry below are a fast, dependency-
|
|
4
|
+
* light DISPLAY formatter for a fixed set of countries; they are not a
|
|
5
|
+
* validator. Real phone number plans have country-specific area-code and
|
|
6
|
+
* mobile-prefix rules that only a maintained metadata table gets right -
|
|
7
|
+
* hand-rolling that risks silently-wrong validation for a country nobody
|
|
8
|
+
* tests against. Both live here so consumers get one phone module, not two.
|
|
9
|
+
*/
|
|
10
|
+
export type { PhoneNumber } from 'libphonenumber-js';
|
|
11
|
+
export { isValidPhoneNumber, parsePhoneNumber, parsePhoneNumberFromString } from 'libphonenumber-js';
|
|
1
12
|
export type PhoneCountry = 'IN' | 'US' | 'GB' | 'AE' | 'AU' | 'SG' | 'CA';
|
|
2
13
|
export interface FormatPhoneOptions {
|
|
3
14
|
defaultCountryCode?: string;
|
|
@@ -28,8 +28,8 @@ export type { Config, Environment, LogLevel } from './config';
|
|
|
28
28
|
export { getConfig, getConfigValue, resetConfig, setConfig } from './config';
|
|
29
29
|
export type { DeepLinkConfig, DeepLinkRoute, ParsedLink } from './deepLink';
|
|
30
30
|
export { DeepLink, parseDeepLink, useDeepLink } from './deepLink';
|
|
31
|
-
export type { DateInput, DateStyle, FormatCurrencyOptions, FormatPhoneOptions, PhoneCountry, TimeStyle } from './formatters';
|
|
32
|
-
export { detectPhoneCountry, formatCompactNumber, formatCurrency, formatDate, formatDateTime, formatNumber, formatPercent, formatPhone, formatRelativeTime, formatTime, getInitials, normalizePhone } from './formatters';
|
|
31
|
+
export type { DateInput, DateStyle, FormatCurrencyOptions, FormatPhoneOptions, PhoneCountry, PhoneNumber, TimeStyle } from './formatters';
|
|
32
|
+
export { detectPhoneCountry, formatCompactNumber, formatCurrency, formatDate, formatDateTime, formatNumber, formatPercent, formatPhone, formatRelativeTime, formatTime, getInitials, isValidPhoneNumber, normalizePhone, parsePhoneNumber, parsePhoneNumberFromString } from './formatters';
|
|
33
33
|
export type { InitConfig } from './initSDK';
|
|
34
34
|
export { initWebority } from './initSDK';
|
|
35
35
|
export type { AuthActions } from './initUserAuth';
|
|
@@ -56,7 +56,7 @@ export interface StorageApi {
|
|
|
56
56
|
* All operations swallow errors (logging them) and return a falsy result
|
|
57
57
|
* so that storage problems never crash the app.
|
|
58
58
|
*
|
|
59
|
-
* Backed by
|
|
59
|
+
* Backed by `expo-sqlite/kv-store` by default;
|
|
60
60
|
* override with `setStorageImplementation()` for MMKV or custom adapters.
|
|
61
61
|
*/
|
|
62
62
|
export declare const Storage: StorageApi;
|
|
@@ -4,6 +4,6 @@ export type { DateInput, DateStyle, TimeStyle } from './date.js';
|
|
|
4
4
|
export { formatDate, formatDateTime, formatRelativeTime, formatTime } from './date.js';
|
|
5
5
|
export { getInitials } from './initials.js';
|
|
6
6
|
export { formatCompactNumber, formatNumber, formatPercent } from './number.js';
|
|
7
|
-
export type { FormatPhoneOptions, PhoneCountry } from './phone.js';
|
|
8
|
-
export { detectPhoneCountry, formatPhone, normalizePhone } from './phone.js';
|
|
7
|
+
export type { FormatPhoneOptions, PhoneCountry, PhoneNumber } from './phone.js';
|
|
8
|
+
export { detectPhoneCountry, formatPhone, isValidPhoneNumber, normalizePhone, parsePhoneNumber, parsePhoneNumberFromString } from './phone.js';
|
|
9
9
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1,3 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Real cross-country validation, re-exported rather than reimplemented.
|
|
3
|
+
* formatPhone/normalizePhone/detectPhoneCountry below are a fast, dependency-
|
|
4
|
+
* light DISPLAY formatter for a fixed set of countries; they are not a
|
|
5
|
+
* validator. Real phone number plans have country-specific area-code and
|
|
6
|
+
* mobile-prefix rules that only a maintained metadata table gets right -
|
|
7
|
+
* hand-rolling that risks silently-wrong validation for a country nobody
|
|
8
|
+
* tests against. Both live here so consumers get one phone module, not two.
|
|
9
|
+
*/
|
|
10
|
+
export type { PhoneNumber } from 'libphonenumber-js';
|
|
11
|
+
export { isValidPhoneNumber, parsePhoneNumber, parsePhoneNumberFromString } from 'libphonenumber-js';
|
|
1
12
|
export type PhoneCountry = 'IN' | 'US' | 'GB' | 'AE' | 'AU' | 'SG' | 'CA';
|
|
2
13
|
export interface FormatPhoneOptions {
|
|
3
14
|
defaultCountryCode?: string;
|
|
@@ -28,8 +28,8 @@ export type { Config, Environment, LogLevel } from './config/index.js';
|
|
|
28
28
|
export { getConfig, getConfigValue, resetConfig, setConfig } from './config/index.js';
|
|
29
29
|
export type { DeepLinkConfig, DeepLinkRoute, ParsedLink } from './deepLink/index.js';
|
|
30
30
|
export { DeepLink, parseDeepLink, useDeepLink } from './deepLink/index.js';
|
|
31
|
-
export type { DateInput, DateStyle, FormatCurrencyOptions, FormatPhoneOptions, PhoneCountry, TimeStyle } from './formatters/index.js';
|
|
32
|
-
export { detectPhoneCountry, formatCompactNumber, formatCurrency, formatDate, formatDateTime, formatNumber, formatPercent, formatPhone, formatRelativeTime, formatTime, getInitials, normalizePhone } from './formatters/index.js';
|
|
31
|
+
export type { DateInput, DateStyle, FormatCurrencyOptions, FormatPhoneOptions, PhoneCountry, PhoneNumber, TimeStyle } from './formatters/index.js';
|
|
32
|
+
export { detectPhoneCountry, formatCompactNumber, formatCurrency, formatDate, formatDateTime, formatNumber, formatPercent, formatPhone, formatRelativeTime, formatTime, getInitials, isValidPhoneNumber, normalizePhone, parsePhoneNumber, parsePhoneNumberFromString } from './formatters/index.js';
|
|
33
33
|
export type { InitConfig } from './initSDK.js';
|
|
34
34
|
export { initWebority } from './initSDK.js';
|
|
35
35
|
export type { AuthActions } from './initUserAuth.js';
|
|
@@ -56,7 +56,7 @@ export interface StorageApi {
|
|
|
56
56
|
* All operations swallow errors (logging them) and return a falsy result
|
|
57
57
|
* so that storage problems never crash the app.
|
|
58
58
|
*
|
|
59
|
-
* Backed by
|
|
59
|
+
* Backed by `expo-sqlite/kv-store` by default;
|
|
60
60
|
* override with `setStorageImplementation()` for MMKV or custom adapters.
|
|
61
61
|
*/
|
|
62
62
|
export declare const Storage: StorageApi;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@webority-technologies/mobile-core",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.3",
|
|
4
4
|
"description": "Platform layer for Webority React Native apps: HTTP clients, auth/token storage, config, logging, formatters, validators, network status, permissions, storage and version checks. No UI.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react-native",
|
|
@@ -133,7 +133,8 @@
|
|
|
133
133
|
"typecheck": "tsc --noEmit"
|
|
134
134
|
},
|
|
135
135
|
"dependencies": {
|
|
136
|
-
"axios": "^1.19.0"
|
|
136
|
+
"axios": "^1.19.0",
|
|
137
|
+
"libphonenumber-js": "^1.12.41"
|
|
137
138
|
},
|
|
138
139
|
"peerDependencies": {
|
|
139
140
|
"@op-engineering/op-sqlite": "*",
|