@hawcx/react-native-sdk 1.0.1 → 1.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/CHANGELOG.md +8 -1
- package/HawcxReactNative.podspec +2 -2
- package/LICENSE +48 -15
- package/README.md +155 -88
- package/docs/RELEASE.md +15 -4
- package/example/README.md +1 -1
- package/example/android/build.gradle +12 -0
- package/example/android/settings.gradle +34 -0
- package/example/ios/HawcxExampleApp.xcodeproj/project.pbxproj +57 -57
- package/example/ios/HawcxExampleApp.xcodeproj/project.xcworkspace/xcuserdata/agambhullar.xcuserdatad/UserInterfaceState.xcuserstate +0 -0
- package/example/ios/Podfile +24 -0
- package/example/ios/Podfile.lock +3 -3
- package/example/package-lock.json +3 -3
- package/example/package.json +1 -1
- package/example/src/App.tsx +211 -8
- package/example/src/hawcx.config.ts +10 -26
- package/ios/Frameworks/HawcxFramework.xcframework/Info.plist +5 -5
- package/ios/Frameworks/HawcxFramework.xcframework/ios-arm64/HawcxFramework.framework/HawcxFramework +0 -0
- package/ios/Frameworks/HawcxFramework.xcframework/ios-arm64/HawcxFramework.framework/Modules/HawcxFramework.swiftmodule/arm64-apple-ios.abi.json +185 -300
- package/ios/Frameworks/HawcxFramework.xcframework/ios-arm64/HawcxFramework.framework/Modules/HawcxFramework.swiftmodule/arm64-apple-ios.private.swiftinterface +11 -1
- package/ios/Frameworks/HawcxFramework.xcframework/ios-arm64/HawcxFramework.framework/Modules/HawcxFramework.swiftmodule/arm64-apple-ios.swiftdoc +0 -0
- package/ios/Frameworks/HawcxFramework.xcframework/ios-arm64/HawcxFramework.framework/Modules/HawcxFramework.swiftmodule/arm64-apple-ios.swiftinterface +11 -1
- package/ios/Frameworks/HawcxFramework.xcframework/ios-arm64_x86_64-simulator/HawcxFramework.framework/HawcxFramework +0 -0
- package/ios/Frameworks/HawcxFramework.xcframework/ios-arm64_x86_64-simulator/HawcxFramework.framework/Modules/HawcxFramework.swiftmodule/arm64-apple-ios-simulator.abi.json +185 -300
- package/ios/Frameworks/HawcxFramework.xcframework/ios-arm64_x86_64-simulator/HawcxFramework.framework/Modules/HawcxFramework.swiftmodule/arm64-apple-ios-simulator.private.swiftinterface +11 -1
- package/ios/Frameworks/HawcxFramework.xcframework/ios-arm64_x86_64-simulator/HawcxFramework.framework/Modules/HawcxFramework.swiftmodule/arm64-apple-ios-simulator.swiftdoc +0 -0
- package/ios/Frameworks/HawcxFramework.xcframework/ios-arm64_x86_64-simulator/HawcxFramework.framework/Modules/HawcxFramework.swiftmodule/arm64-apple-ios-simulator.swiftinterface +11 -1
- package/ios/Frameworks/HawcxFramework.xcframework/ios-arm64_x86_64-simulator/HawcxFramework.framework/Modules/HawcxFramework.swiftmodule/x86_64-apple-ios-simulator.abi.json +185 -300
- package/ios/Frameworks/HawcxFramework.xcframework/ios-arm64_x86_64-simulator/HawcxFramework.framework/Modules/HawcxFramework.swiftmodule/x86_64-apple-ios-simulator.private.swiftinterface +11 -1
- package/ios/Frameworks/HawcxFramework.xcframework/ios-arm64_x86_64-simulator/HawcxFramework.framework/Modules/HawcxFramework.swiftmodule/x86_64-apple-ios-simulator.swiftdoc +0 -0
- package/ios/Frameworks/HawcxFramework.xcframework/ios-arm64_x86_64-simulator/HawcxFramework.framework/Modules/HawcxFramework.swiftmodule/x86_64-apple-ios-simulator.swiftinterface +11 -1
- package/ios/Frameworks/HawcxFramework.xcframework/ios-arm64_x86_64-simulator/HawcxFramework.framework/_CodeSignature/CodeResources +20 -20
- package/ios/HawcxReactNative.swift +87 -1
- package/lib/commonjs/index.js +41 -1
- package/lib/commonjs/index.js.map +1 -1
- package/lib/module/index.js +40 -1
- package/lib/module/index.js.map +1 -1
- package/lib/typescript/index.d.ts +36 -0
- package/lib/typescript/index.d.ts.map +1 -1
- package/package.json +1 -1
- package/react_mobile_sdk_plan.md +2 -0
- package/src/__tests__/index.test.ts +44 -1
- package/src/index.ts +81 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [1.0.3] - YYYY-MM-DD
|
|
4
|
+
- TODO: add release notes
|
|
5
|
+
|
|
6
|
+
## [1.0.2] - YYYY-MM-DD
|
|
7
|
+
- OAuth flow update
|
|
8
|
+
- Android release prep
|
|
9
|
+
|
|
3
10
|
## [1.0.1] - 2025-11-17
|
|
4
11
|
- Point native Android/iOS SDKs at new production authentication endpoint
|
|
5
12
|
- Refresh bundled Hawcx Android/iOS binaries for the 1.0.1 cut
|
|
@@ -7,4 +14,4 @@
|
|
|
7
14
|
|
|
8
15
|
## [0.0.1] - 2025-11-15
|
|
9
16
|
- Initial React Native bridge for Hawcx V5 authentication
|
|
10
|
-
- Added HawcxClient helpers, hooks, push support, and example app
|
|
17
|
+
- Added HawcxClient helpers, hooks, push support, and example app
|
package/HawcxReactNative.podspec
CHANGED
|
@@ -9,10 +9,10 @@ Pod::Spec.new do |s|
|
|
|
9
9
|
Production-grade React Native bridge that wraps HawcxFramework (iOS) to expose
|
|
10
10
|
V5 authentication, OTP, push, and web session flows to JavaScript callers.
|
|
11
11
|
DESC
|
|
12
|
-
s.homepage = 'https://github.com/hawcx/
|
|
12
|
+
s.homepage = 'https://github.com/hawcx/reactnative_sdk'
|
|
13
13
|
s.license = { :type => 'MIT', :file => 'LICENSE' }
|
|
14
14
|
s.author = { 'Hawcx Engineering' => 'engineering@hawcx.com' }
|
|
15
|
-
s.source = { :git => 'https://github.com/hawcx/
|
|
15
|
+
s.source = { :git => 'https://github.com/hawcx/reactnative_sdk.git', :tag => "v#{s.version}" }
|
|
16
16
|
|
|
17
17
|
s.platform = :ios, '17.5'
|
|
18
18
|
s.swift_version = '5.9'
|
package/LICENSE
CHANGED
|
@@ -1,21 +1,54 @@
|
|
|
1
|
-
|
|
1
|
+
Hawcx Proprietary License
|
|
2
2
|
|
|
3
|
-
Copyright (c) 2025 Hawcx
|
|
3
|
+
Copyright (c) 2025 Hawcx, Inc. All Rights Reserved.
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
5
|
+
GRANT OF LICENSE
|
|
11
6
|
|
|
12
|
-
|
|
13
|
-
|
|
7
|
+
Subject to the terms and conditions of this License, Hawcx, Inc. ("Hawcx")
|
|
8
|
+
grants to authorized clients ("Licensee") a limited, non-exclusive,
|
|
9
|
+
non-transferable, non-sublicensable license to use this software and
|
|
10
|
+
associated documentation files (the "Software") solely for:
|
|
11
|
+
|
|
12
|
+
1. Proof of Concept (POC) evaluation purposes, or
|
|
13
|
+
2. Commercial use in production environments as explicitly authorized by Hawcx
|
|
14
|
+
|
|
15
|
+
RESTRICTIONS
|
|
16
|
+
|
|
17
|
+
Licensee shall NOT:
|
|
18
|
+
- Modify, alter, or create derivative works of the Software
|
|
19
|
+
- Distribute, sublicense, lease, rent, or transfer the Software to any third party
|
|
20
|
+
- Reverse engineer, decompile, or disassemble the Software
|
|
21
|
+
- Remove or alter any proprietary notices, labels, or marks on the Software
|
|
22
|
+
- Use the Software for any purpose other than as expressly authorized
|
|
23
|
+
|
|
24
|
+
AUTHORIZATION REQUIRED
|
|
25
|
+
|
|
26
|
+
Use of this Software requires explicit written authorization from Hawcx.
|
|
27
|
+
Unauthorized use, reproduction, or distribution is strictly prohibited and
|
|
28
|
+
may result in severe civil and criminal penalties.
|
|
29
|
+
|
|
30
|
+
OWNERSHIP
|
|
31
|
+
|
|
32
|
+
Hawcx retains all right, title, and interest in and to the Software,
|
|
33
|
+
including all intellectual property rights. This License does not grant
|
|
34
|
+
Licensee any ownership rights to the Software.
|
|
35
|
+
|
|
36
|
+
TERMINATION
|
|
37
|
+
|
|
38
|
+
This License is effective until terminated. Hawcx may terminate this License
|
|
39
|
+
immediately if Licensee fails to comply with any term hereof. Upon termination,
|
|
40
|
+
Licensee must destroy all copies of the Software.
|
|
41
|
+
|
|
42
|
+
WARRANTY DISCLAIMER
|
|
14
43
|
|
|
15
44
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
45
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
46
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
|
47
|
+
|
|
48
|
+
LIMITATION OF LIABILITY
|
|
49
|
+
|
|
50
|
+
IN NO EVENT SHALL HAWCX BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
|
51
|
+
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
|
|
52
|
+
IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
53
|
+
|
|
54
|
+
For licensing inquiries, contact: info@hawcx.com
|
package/README.md
CHANGED
|
@@ -1,109 +1,176 @@
|
|
|
1
|
-
# Hawcx React Native SDK
|
|
1
|
+
# Hawcx React Native SDK
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Official React Native bindings for the Hawcx V5 mobile authentication platform. The package wraps the production Hawcx iOS and Android SDKs so you can deliver Smart‑Connect (OTP + device trust + push approvals) inside a single cross‑platform API.
|
|
4
4
|
|
|
5
|
-
##
|
|
6
|
-
- `src/` – TypeScript entry point and public API surface.
|
|
7
|
-
- `ios/` – Native bridge sources (Swift) plus the Podspec that embeds `HawcxFramework`.
|
|
8
|
-
- `android/` – React Native Android bridge module (Gradle library) plus the bundled Hawcx SDK AAR.
|
|
9
|
-
- `example/` – Runnable React Native demo app using the SDK (`npm install` -> `npm run ios`).
|
|
10
|
-
- `react_mobile_sdk_plan.md` – Detailed delivery plan and progress tracker. **Always read and update this file when working on the SDK.**
|
|
5
|
+
## Requirements
|
|
11
6
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
| `npm run clean` | Removes the build output under `lib/`. |
|
|
16
|
-
| `npm run lint` | Runs ESLint using the React Native + TypeScript rules. |
|
|
17
|
-
| `npm run typecheck` | Executes the TypeScript compiler in `--noEmit` mode. |
|
|
18
|
-
| `npm run build` | Builds distributable bundles via `react-native-builder-bob`. |
|
|
7
|
+
* React Native ≥ 0.73 (Hermes enabled by default)
|
|
8
|
+
* iOS 17+ / Android 8+ (SDK requires API level 26 for Android)
|
|
9
|
+
* OAuth client credentials **must stay on your backend**.
|
|
19
10
|
|
|
20
|
-
|
|
11
|
+
## Installation
|
|
21
12
|
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
13
|
+
```bash
|
|
14
|
+
npm install @hawcx/react-native-sdk
|
|
15
|
+
# or yarn add @hawcx/react-native-sdk
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
### iOS
|
|
19
|
+
|
|
20
|
+
```
|
|
21
|
+
cd ios
|
|
22
|
+
pod install
|
|
23
|
+
cd ..
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
Open the workspace (`ios/*.xcworkspace`) in Xcode when you need to run on a device. The pod installs the vendored HawcxFramework.xcframework automatically.
|
|
27
|
+
|
|
28
|
+
### Android
|
|
29
|
+
|
|
30
|
+
No manual steps are required—Gradle picks up the bundled `hawcx-*.aar`. Make sure the Android SDK is installed and `ANDROID_HOME`/`adb` are on your path, then run `npm run android`.
|
|
31
|
+
|
|
32
|
+
## Quick Start
|
|
33
|
+
|
|
34
|
+
```tsx
|
|
35
|
+
import { useEffect } from 'react';
|
|
36
|
+
import { initialize, addAuthListener } from '@hawcx/react-native-sdk';
|
|
37
|
+
|
|
38
|
+
export function bootstrapHawcx() {
|
|
39
|
+
return initialize({
|
|
40
|
+
projectApiKey: 'YOUR_PROJECT_API_KEY',
|
|
41
|
+
baseUrl: 'https://your-hawcx-host.example.com',
|
|
42
|
+
}).then(() => {
|
|
43
|
+
const subscription = addAuthListener(event => {
|
|
44
|
+
if (event.type === 'auth_error') {
|
|
45
|
+
console.warn('Hawcx error', event.payload);
|
|
46
|
+
}
|
|
47
|
+
});
|
|
48
|
+
return () => subscription.remove();
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
```
|
|
27
52
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
53
|
+
Call `bootstrapHawcx()` once when your app starts (e.g., inside your root component or Redux saga). After that you can use hooks or imperative helpers to drive Smart‑Connect.
|
|
54
|
+
|
|
55
|
+
> **Note:** `baseUrl` must be the tenant-specific Hawcx host (e.g., `https://hawcx-api.hawcx.com`). The native SDK appends `/hc_auth` internally and routes all APIs through that cluster.
|
|
56
|
+
|
|
57
|
+
### Authentication flow (OTP + authorization code)
|
|
58
|
+
|
|
59
|
+
The SDK now always returns an authorization code. Your frontend must forward it to your backend, which redeems it with Hawcx using the OAuth client credentials we issued for your project.
|
|
60
|
+
|
|
61
|
+
```tsx
|
|
62
|
+
import React, { useEffect, useState } from 'react';
|
|
63
|
+
import { useHawcxAuth, storeBackendOAuthTokens } from '@hawcx/react-native-sdk';
|
|
64
|
+
|
|
65
|
+
export function SmartConnectScreen() {
|
|
66
|
+
const { state, authenticate, submitOtp, reset } = useHawcxAuth();
|
|
67
|
+
const [email, setEmail] = useState('');
|
|
68
|
+
const [otp, setOtp] = useState('');
|
|
69
|
+
|
|
70
|
+
useEffect(() => {
|
|
71
|
+
if (state.status === 'authorization_code') {
|
|
72
|
+
void exchangeCode(state.payload).finally(() => reset());
|
|
73
|
+
}
|
|
74
|
+
}, [state, reset]);
|
|
75
|
+
|
|
76
|
+
const exchangeCode = async ({ code, expiresIn }) => {
|
|
77
|
+
const response = await fetch('https://your-backend.example.com/api/hawcx/login', {
|
|
78
|
+
method: 'POST',
|
|
79
|
+
headers: { 'Content-Type': 'application/json' },
|
|
80
|
+
body: JSON.stringify({ email: email.trim(), code, expires_in: expiresIn }),
|
|
81
|
+
});
|
|
82
|
+
if (!response.ok) {
|
|
83
|
+
throw new Error('Backend verification failed');
|
|
84
|
+
}
|
|
85
|
+
const { access_token, refresh_token } = await response.json();
|
|
86
|
+
await storeBackendOAuthTokens(email.trim(), access_token, refresh_token);
|
|
87
|
+
};
|
|
88
|
+
|
|
89
|
+
return (
|
|
90
|
+
<>
|
|
91
|
+
{/* Collect identifier */}
|
|
92
|
+
<Button title="Continue" onPress={() => authenticate(email.trim())} />
|
|
93
|
+
|
|
94
|
+
{state.status === 'otp' && (
|
|
95
|
+
<>
|
|
96
|
+
<TextInput value={otp} onChangeText={setOtp} keyboardType="number-pad" />
|
|
97
|
+
<Button title="Verify OTP" onPress={() => submitOtp(otp)} />
|
|
98
|
+
</>
|
|
99
|
+
)}
|
|
100
|
+
|
|
101
|
+
{state.status === 'authorization_code' && <Text>Sending authorization code…</Text>}
|
|
102
|
+
{state.status === 'additional_verification_required' && (
|
|
103
|
+
<Text>Additional verification required: {state.payload.detail ?? state.payload.sessionId}</Text>
|
|
104
|
+
)}
|
|
105
|
+
{state.status === 'error' && <Text>{state.error.message}</Text>}
|
|
106
|
+
</>
|
|
107
|
+
);
|
|
108
|
+
}
|
|
109
|
+
```
|
|
32
110
|
|
|
33
|
-
|
|
111
|
+
### Backend exchange
|
|
112
|
+
|
|
113
|
+
Redeem the authorization code on your server using the hawcx/oauth-client package or your preferred language SDK. Never ship `clientId`, token endpoint, private keys, or Hawcx public keys inside your mobile app.
|
|
34
114
|
|
|
35
115
|
```ts
|
|
36
|
-
import
|
|
37
|
-
|
|
38
|
-
authenticate,
|
|
39
|
-
submitOtp,
|
|
40
|
-
addAuthListener,
|
|
41
|
-
hawcxClient,
|
|
42
|
-
useHawcxAuth,
|
|
43
|
-
useHawcxWebLogin,
|
|
44
|
-
} from '@hawcx/react-native-sdk';
|
|
45
|
-
|
|
46
|
-
await initialize({ projectApiKey: 'YOUR_PROJECT_KEY' });
|
|
47
|
-
|
|
48
|
-
const subscription = addAuthListener(event => {
|
|
49
|
-
switch (event.type) {
|
|
50
|
-
case 'otp_required':
|
|
51
|
-
// show OTP UI
|
|
52
|
-
break;
|
|
53
|
-
case 'auth_success':
|
|
54
|
-
console.log('Login success', event.payload);
|
|
55
|
-
break;
|
|
56
|
-
case 'auth_error':
|
|
57
|
-
console.error('Auth failed', event.payload.message);
|
|
58
|
-
break;
|
|
59
|
-
}
|
|
60
|
-
});
|
|
116
|
+
import express from 'express';
|
|
117
|
+
import { exchangeCodeForTokenAndClaims } from '@hawcx/oauth-client';
|
|
61
118
|
|
|
62
|
-
|
|
63
|
-
|
|
119
|
+
const app = express();
|
|
120
|
+
app.use(express.json());
|
|
64
121
|
|
|
65
|
-
|
|
122
|
+
app.post('/api/hawcx/login', async (req, res) => {
|
|
123
|
+
const { email, code, expires_in } = req.body ?? {};
|
|
124
|
+
if (!email || !code) {
|
|
125
|
+
return res.status(400).json({ success: false, error: 'Missing email or code' });
|
|
126
|
+
}
|
|
66
127
|
|
|
67
|
-
|
|
68
|
-
const
|
|
69
|
-
|
|
128
|
+
try {
|
|
129
|
+
const [claims, idToken] = await exchangeCodeForTokenAndClaims({
|
|
130
|
+
code,
|
|
131
|
+
oauthTokenUrl: process.env.HAWCX_OAUTH_TOKEN_ENDPOINT!,
|
|
132
|
+
clientId: process.env.HAWCX_OAUTH_CLIENT_ID!,
|
|
133
|
+
publicKey: process.env.HAWCX_OAUTH_PUBLIC_KEY_PEM!,
|
|
134
|
+
audience: process.env.HAWCX_OAUTH_CLIENT_ID,
|
|
135
|
+
issuer: process.env.HAWCX_OAUTH_ISSUER,
|
|
136
|
+
});
|
|
137
|
+
|
|
138
|
+
return res.json({
|
|
139
|
+
success: true,
|
|
140
|
+
message: `Verified ${claims.email}`,
|
|
141
|
+
access_token: idToken,
|
|
142
|
+
refresh_token: idToken,
|
|
143
|
+
});
|
|
144
|
+
} catch (error) {
|
|
145
|
+
return res.status(401).json({ success: false, error: error.message });
|
|
146
|
+
}
|
|
70
147
|
});
|
|
71
|
-
|
|
148
|
+
```
|
|
72
149
|
|
|
73
|
-
|
|
74
|
-
function AuthScreen() {
|
|
75
|
-
const { state, authenticate, submitOtp } = useHawcxAuth();
|
|
150
|
+
Once the backend responds, call `storeBackendOAuthTokens(userId, tokens)` so the Hawcx SDK saves them securely and can continue handling push registration and device sessions.
|
|
76
151
|
|
|
77
|
-
|
|
78
|
-
const sendOtp = (otp: string) => submitOtp(otp);
|
|
152
|
+
## Hooks & Helpers
|
|
79
153
|
|
|
80
|
-
|
|
81
|
-
|
|
154
|
+
* `useHawcxAuth()` – React hook that exposes the current auth state and helpers (`authenticate`, `submitOtp`, `reset`).
|
|
155
|
+
* `useHawcxWebLogin()` – Drive QR/PIN based approvals.
|
|
156
|
+
* `addAuthListener` / `addSessionListener` / `addPushListener` – Lower-level event APIs if you prefer an imperative approach.
|
|
157
|
+
* `setPushDeviceToken` / `notifyUserAuthenticated` – Wire push login approvals.
|
|
82
158
|
|
|
83
|
-
|
|
84
|
-
const { state, webLogin, webApprove, getDeviceDetails } = useHawcxWebLogin();
|
|
159
|
+
Refer to the updated [React Quickstart documentation](https://docs.hawcx.com/react/quickstart) for details on each API, push approvals, and device session management.
|
|
85
160
|
|
|
86
|
-
|
|
87
|
-
const approveSession = (token: string) => webApprove(token);
|
|
88
|
-
const refreshDevices = () => getDeviceDetails();
|
|
161
|
+
## Example App
|
|
89
162
|
|
|
90
|
-
|
|
91
|
-
|
|
163
|
+
`/example` contains a full React Native app wired to the SDK with logging, OTP UI, push harness, and a backend toggle. To run it:
|
|
164
|
+
|
|
165
|
+
```bash
|
|
166
|
+
cd example
|
|
167
|
+
npm install
|
|
168
|
+
npm run ios # or npm run android
|
|
92
169
|
```
|
|
93
170
|
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
Review `docs/RELEASE.md` before publishing. In short:
|
|
101
|
-
1. Run `npm run lint && npm run typecheck && npm test && npm run build`.
|
|
102
|
-
2. Update `package.json` + `CHANGELOG.md`.
|
|
103
|
-
3. Smoke test the example app.
|
|
104
|
-
4. `npm publish --access public` and `pod repo push trunk HawcxReactNative.podspec`.
|
|
105
|
-
5. Tag the repo (`git tag vX.Y.Z && git push origin --tags`).
|
|
106
|
-
|
|
107
|
-
## Next Steps
|
|
108
|
-
1. Follow `react_mobile_sdk_plan.md` Phase 1+ to implement the native bridge and JS API.
|
|
109
|
-
2. Keep this README updated with integration steps and release instructions as the SDK matures.
|
|
171
|
+
Add your Project API key in `example/src/hawcx.config.ts` or paste it into the in-app form. The **Authorization Code & Backend Exchange** card runs in demo mode by default (codes complete locally). Set `BACKEND_FLOW_ENABLED = true` in `example/src/App.tsx` when you have a tunnel or backend ready to receive `{ code, email, expires_in }`.
|
|
172
|
+
|
|
173
|
+
## Support
|
|
174
|
+
|
|
175
|
+
* Documentation: [React Quickstart](https://docs.hawcx.com/react/quickstart)
|
|
176
|
+
* Questions? Reach out to your Hawcx solutions engineer or info@hawcx.com.
|
package/docs/RELEASE.md
CHANGED
|
@@ -36,11 +36,13 @@ This document outlines every command, directory, and deliverable required to pub
|
|
|
36
36
|
npm test
|
|
37
37
|
npm run build # produces lib/
|
|
38
38
|
./gradlew -p android clean lintRelease testReleaseUnitTest assembleRelease publishToMavenLocal
|
|
39
|
+
Ensure to udpate api("api.hawcx:hawcx:5.1.1") version in dev_react/android/build.gradle if android aar file version changed
|
|
40
|
+
Then run ./gradlew clean assembleRelease --refresh-dependencies to test if android picks up new aar maven release
|
|
39
41
|
pod lib lint HawcxReactNative.podspec
|
|
40
42
|
```
|
|
41
43
|
- `./gradlew … publishToMavenLocal` validates the Android bridge (with the bundled Hawcx AAR) builds and can be published.
|
|
42
44
|
- `pod lib lint` confirms the Podspec + `HawcxFramework.xcframework` remain valid.
|
|
43
|
-
|
|
45
|
+
|
|
44
46
|
3. **Update version + changelog (repo root)**
|
|
45
47
|
- Edit `package.json` → bump `version` (run `npm install` afterward so `package-lock.json` picks up the new number).
|
|
46
48
|
- Update `android/build.gradle`’s fallback `version` string and `example/package.json` (re-run `npm install` inside `example/` so its lockfile updates).
|
|
@@ -50,14 +52,23 @@ This document outlines every command, directory, and deliverable required to pub
|
|
|
50
52
|
```bash
|
|
51
53
|
git add package.json package-lock.json android/build.gradle example/package.json example/package-lock.json example/ios/Podfile.lock CHANGELOG.md
|
|
52
54
|
git commit -m "chore: release vX.Y.Z"
|
|
53
|
-
|
|
55
|
+
```
|
|
54
56
|
Include refreshed native artifacts (`ios/Frameworks/*.xcframework`, `android/libs/*.aar`) in the same commit when they change.
|
|
55
57
|
|
|
56
58
|
4. **Smoke test the example app**
|
|
59
|
+
|
|
60
|
+
rm -rf ~/Library/Developer/Xcode/DerivedData/HawcxExampleApp*
|
|
61
|
+
|
|
57
62
|
```bash
|
|
58
63
|
cd example
|
|
59
64
|
npm install
|
|
60
|
-
|
|
65
|
+
For ios:
|
|
66
|
+
cd example/ios: pod install
|
|
67
|
+
cd ..
|
|
68
|
+
npm run ios or npm run ios -- --no-packager
|
|
69
|
+
For android:
|
|
70
|
+
cd example/android: ./gradlew clean
|
|
71
|
+
cd ..
|
|
61
72
|
npm run android
|
|
62
73
|
# Use your dev credentials in example/src/hawcx.config.ts
|
|
63
74
|
cd ..
|
|
@@ -73,7 +84,7 @@ This document outlines every command, directory, and deliverable required to pub
|
|
|
73
84
|
|
|
74
85
|
6. **Publish CocoaPods spec (repo root)**
|
|
75
86
|
```bash
|
|
76
|
-
pod
|
|
87
|
+
pod trunk push HawcxReactNative.podspec --allow-warnings
|
|
77
88
|
```
|
|
78
89
|
Ensure the command finishes without validation errors. If you have trouble with trunk authentication, re-run `pod trunk register`.
|
|
79
90
|
|
package/example/README.md
CHANGED
|
@@ -9,7 +9,7 @@ This example demonstrates the cross-platform APIs exported by `@hawcx/react-nati
|
|
|
9
9
|
cd example
|
|
10
10
|
npm install
|
|
11
11
|
```
|
|
12
|
-
2. Configure credentials in `src/hawcx.config.ts`. The file ships with dev defaults—replace the API key and
|
|
12
|
+
2. Configure credentials in `src/hawcx.config.ts`. The file ships with dev defaults—replace the API key **and** `HAWCX_BASE_URL` host with your tenant’s values.
|
|
13
13
|
3. **iOS only:** install pods:
|
|
14
14
|
```bash
|
|
15
15
|
cd ios && pod install && cd ..
|
|
@@ -21,3 +21,15 @@ buildscript {
|
|
|
21
21
|
}
|
|
22
22
|
|
|
23
23
|
apply plugin: "com.facebook.react.rootproject"
|
|
24
|
+
|
|
25
|
+
subprojects { subproject ->
|
|
26
|
+
subproject.configurations.all { config ->
|
|
27
|
+
config.resolutionStrategy.eachDependency { details ->
|
|
28
|
+
if (details.requested.group == "androidx.core" &&
|
|
29
|
+
(details.requested.name == "core" || details.requested.name == "core-ktx")) {
|
|
30
|
+
details.useVersion("1.13.1")
|
|
31
|
+
details.because("core-ktx 1.16.0 requires compileSdk/AGP 35+, but the demo targets 34/AGP 8.1.1")
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
}
|
|
@@ -1,3 +1,37 @@
|
|
|
1
|
+
import org.gradle.api.initialization.resolve.RepositoriesMode
|
|
2
|
+
|
|
3
|
+
dependencyResolutionManagement {
|
|
4
|
+
repositoriesMode.set(RepositoriesMode.PREFER_SETTINGS)
|
|
5
|
+
repositories {
|
|
6
|
+
google()
|
|
7
|
+
mavenCentral()
|
|
8
|
+
maven { url = uri("https://www.jitpack.io") }
|
|
9
|
+
maven {
|
|
10
|
+
url = uri("https://raw.githubusercontent.com/hawcx/hawcx_android_sdk/main/maven")
|
|
11
|
+
content {
|
|
12
|
+
includeGroup("api.hawcx")
|
|
13
|
+
}
|
|
14
|
+
metadataSources {
|
|
15
|
+
mavenPom()
|
|
16
|
+
artifact()
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
def localHawcxRepo = new File(rootDir, "../../../prod_android/hawcx_android_sdk/maven")
|
|
20
|
+
if (localHawcxRepo.exists()) {
|
|
21
|
+
maven {
|
|
22
|
+
url = localHawcxRepo.toURI()
|
|
23
|
+
content {
|
|
24
|
+
includeGroup("api.hawcx")
|
|
25
|
+
}
|
|
26
|
+
metadataSources {
|
|
27
|
+
mavenPom()
|
|
28
|
+
artifact()
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
|
|
1
35
|
rootProject.name = 'com.hawcx.example'
|
|
2
36
|
apply from: file("../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesSettingsGradle(settings)
|
|
3
37
|
include ':app'
|