@koolbase/react-native 12.0.0 → 12.2.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/CHANGELOG.md CHANGED
@@ -7,6 +7,48 @@ adheres to [Semantic Versioning][semver].
7
7
  [kac]: https://keepachangelog.com/en/1.1.0/
8
8
  [semver]: https://semver.org/
9
9
 
10
+ ## 12.2.0
11
+
12
+ ### Added
13
+
14
+ - **Two-step sign-in (MFA).** Every sign-in method now throws `MfaRequiredError`
15
+ carrying a `challengeToken` when the person's account has an authenticator on
16
+ — including phone, Google and Apple, whose error parsers all map it, enforced
17
+ by a source test for any parser added later. `verifyMfa({ challengeToken, code
18
+ })` and `verifyRecoveryCode({ challengeToken, code })` finish sign-in and
19
+ store the session, returning `{ session, recoveryCodesRemaining }` for the
20
+ latter.
21
+ - `enrollMfa()`, `confirmMfaEnrollment(code)`, `mfaStatus()`, `stepUpMfa(…)`,
22
+ `disableMfa()`, and `regenerateRecoveryCodes()` manage it. Six new error
23
+ classes in the mapping table and fidelity list.
24
+
25
+ ## 12.1.0
26
+
27
+ ### Added
28
+
29
+ - **Sign in with an emailed code.** `auth.requestEmailCode({ email })` sends a
30
+ six-digit code; `auth.signInWithEmailCode({ email, code })` signs in and
31
+ stores the session exactly as `login()` does. An unknown address becomes an
32
+ account only while the project accepts sign-ups. Each code works once and
33
+ allows three attempts. The request resolves the same way whether or not the
34
+ address has an account. A project can switch this off; requests then throw
35
+ `EmailCodeDisabledError`.
36
+ - **Fiscal.** `KoolbaseFiscal` with `submit()` and `status()`, and
37
+ `KoolbaseFiscalError`. A timeout on `submit` means poll `status()` with the
38
+ same `clientRef` — do not submit again, or the sale may be recorded twice.
39
+ - **Reference errors are catchable.** `KoolbaseReferenceInvalidError`,
40
+ `KoolbaseReferenceInUseError`, `KoolbaseDanglingReferencesError` (carrying
41
+ the offending records) and `KoolbaseCollectionReferencedError`.
42
+
43
+ ### Changed
44
+
45
+ - The OTP errors (`OtpInvalidError`, `OtpExpiredError`,
46
+ `OtpMaxAttemptsError`) now come from the shared error mapping, so every path
47
+ that returns them throws the class an app catches.
48
+ - `oauthLogin()`'s deprecation now points to `signInWithGoogle()` and
49
+ `signInWithApple()`. It said OAuth was not yet shipped and to use email and
50
+ password instead, which had long stopped being true.
51
+
10
52
  ## 12.0.0
11
53
 
12
54
  ### Breaking
@@ -1,11 +1,12 @@
1
1
  export * from '@koolbase/core';
2
2
  export { reactNativePlatform } from './platform.js';
3
- import { KoolbaseAuth, KoolbaseDatabase, KoolbaseStorage, KoolbaseRealtime, KoolbaseFunctions, KoolbaseAnalytics, KoolbaseMessaging, type KoolbaseConfig, type VersionCheckResult } from '@koolbase/core';
3
+ import { KoolbaseAuth, KoolbaseDatabase, KoolbaseFiscal, KoolbaseStorage, KoolbaseRealtime, KoolbaseFunctions, KoolbaseAnalytics, KoolbaseMessaging, type KoolbaseConfig, type VersionCheckResult } from '@koolbase/core';
4
4
  export declare const Koolbase: {
5
5
  initialize(config: KoolbaseConfig): Promise<void>;
6
6
  readonly auth: KoolbaseAuth;
7
7
  readonly db: KoolbaseDatabase;
8
8
  readonly storage: KoolbaseStorage;
9
+ readonly fiscal: KoolbaseFiscal;
9
10
  readonly realtime: KoolbaseRealtime;
10
11
  readonly functions: KoolbaseFunctions;
11
12
  isEnabled(key: string): boolean;
package/dist/cjs/index.js CHANGED
@@ -29,6 +29,7 @@ const platform_js_2 = require("./platform.js");
29
29
  let _auth = null;
30
30
  let _db = null;
31
31
  let _storage = null;
32
+ let _fiscal = null;
32
33
  let _realtime = null;
33
34
  let _functions = null;
34
35
  let _flags = null;
@@ -66,6 +67,7 @@ exports.Koolbase = {
66
67
  // route to login, rather than looping on a dead token.
67
68
  async () => { await _auth?.clearStoredSession(); });
68
69
  _storage = new core_1.KoolbaseStorage(config, () => _auth?.validAccessToken() ?? Promise.resolve(null), async () => { await _auth?.clearStoredSession(); });
70
+ _fiscal = new core_1.KoolbaseFiscal(config, () => _auth?.validAccessToken() ?? Promise.resolve(null), async () => { await _auth?.clearStoredSession(); });
69
71
  _realtime = new core_1.KoolbaseRealtime(config, () => _auth?.validAccessToken() ?? Promise.resolve(null), () => _auth?.currentUser?.id ?? null);
70
72
  _functions = new core_1.KoolbaseFunctions(config, () => _auth?.validAccessToken() ?? Promise.resolve(null), async () => { await _auth?.clearStoredSession(); });
71
73
  // One anonymous device id for the whole SDK — bucketing (flags), targeting
@@ -105,6 +107,10 @@ exports.Koolbase = {
105
107
  ensureInitialized();
106
108
  return _storage;
107
109
  },
110
+ get fiscal() {
111
+ ensureInitialized();
112
+ return _fiscal;
113
+ },
108
114
  get realtime() {
109
115
  ensureInitialized();
110
116
  return _realtime;
@@ -1,11 +1,12 @@
1
1
  export * from '@koolbase/core';
2
2
  export { reactNativePlatform } from './platform.js';
3
- import { KoolbaseAuth, KoolbaseDatabase, KoolbaseStorage, KoolbaseRealtime, KoolbaseFunctions, KoolbaseAnalytics, KoolbaseMessaging, type KoolbaseConfig, type VersionCheckResult } from '@koolbase/core';
3
+ import { KoolbaseAuth, KoolbaseDatabase, KoolbaseFiscal, KoolbaseStorage, KoolbaseRealtime, KoolbaseFunctions, KoolbaseAnalytics, KoolbaseMessaging, type KoolbaseConfig, type VersionCheckResult } from '@koolbase/core';
4
4
  export declare const Koolbase: {
5
5
  initialize(config: KoolbaseConfig): Promise<void>;
6
6
  readonly auth: KoolbaseAuth;
7
7
  readonly db: KoolbaseDatabase;
8
8
  readonly storage: KoolbaseStorage;
9
+ readonly fiscal: KoolbaseFiscal;
9
10
  readonly realtime: KoolbaseRealtime;
10
11
  readonly functions: KoolbaseFunctions;
11
12
  isEnabled(key: string): boolean;
package/dist/esm/index.js CHANGED
@@ -6,11 +6,12 @@
6
6
  // React Native platform adapter and keychain-backed session storage.
7
7
  export * from '@koolbase/core';
8
8
  export { reactNativePlatform } from './platform.js';
9
- import { KoolbaseAuth, KoolbaseDatabase, KoolbaseStorage, KoolbaseRealtime, KoolbaseFunctions, KoolbaseFlags, KoolbaseAnalytics, KoolbaseMessaging, getOrCreateDeviceId, setPlatform, } from '@koolbase/core';
9
+ import { KoolbaseAuth, KoolbaseDatabase, KoolbaseFiscal, KoolbaseStorage, KoolbaseRealtime, KoolbaseFunctions, KoolbaseFlags, KoolbaseAnalytics, KoolbaseMessaging, getOrCreateDeviceId, setPlatform, } from '@koolbase/core';
10
10
  import { reactNativePlatform } from './platform.js';
11
11
  let _auth = null;
12
12
  let _db = null;
13
13
  let _storage = null;
14
+ let _fiscal = null;
14
15
  let _realtime = null;
15
16
  let _functions = null;
16
17
  let _flags = null;
@@ -48,6 +49,7 @@ export const Koolbase = {
48
49
  // route to login, rather than looping on a dead token.
49
50
  async () => { await _auth?.clearStoredSession(); });
50
51
  _storage = new KoolbaseStorage(config, () => _auth?.validAccessToken() ?? Promise.resolve(null), async () => { await _auth?.clearStoredSession(); });
52
+ _fiscal = new KoolbaseFiscal(config, () => _auth?.validAccessToken() ?? Promise.resolve(null), async () => { await _auth?.clearStoredSession(); });
51
53
  _realtime = new KoolbaseRealtime(config, () => _auth?.validAccessToken() ?? Promise.resolve(null), () => _auth?.currentUser?.id ?? null);
52
54
  _functions = new KoolbaseFunctions(config, () => _auth?.validAccessToken() ?? Promise.resolve(null), async () => { await _auth?.clearStoredSession(); });
53
55
  // One anonymous device id for the whole SDK — bucketing (flags), targeting
@@ -87,6 +89,10 @@ export const Koolbase = {
87
89
  ensureInitialized();
88
90
  return _storage;
89
91
  },
92
+ get fiscal() {
93
+ ensureInitialized();
94
+ return _fiscal;
95
+ },
90
96
  get realtime() {
91
97
  ensureInitialized();
92
98
  return _realtime;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@koolbase/react-native",
3
- "version": "12.0.0",
3
+ "version": "12.2.0",
4
4
  "description": "React Native SDK for Koolbase \u2014 auth, database, storage, realtime, feature flags, and functions in one package.",
5
5
  "main": "./dist/cjs/index.js",
6
6
  "types": "./dist/esm/index.d.ts",
@@ -24,7 +24,7 @@
24
24
  "url": "https://github.com/koolbase/koolbase-react-native"
25
25
  },
26
26
  "dependencies": {
27
- "@koolbase/core": "12.0.0"
27
+ "@koolbase/core": "12.2.0"
28
28
  },
29
29
  "peerDependencies": {
30
30
  "@react-native-async-storage/async-storage": "^3.0.2",