@croacroa/react-native-template 1.0.0 → 2.0.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.
Files changed (69) hide show
  1. package/.github/workflows/ci.yml +187 -184
  2. package/.github/workflows/eas-build.yml +55 -55
  3. package/.github/workflows/eas-update.yml +50 -50
  4. package/CHANGELOG.md +106 -106
  5. package/CONTRIBUTING.md +377 -377
  6. package/README.md +399 -399
  7. package/__tests__/components/snapshots.test.tsx +131 -0
  8. package/__tests__/integration/auth-api.test.tsx +227 -0
  9. package/__tests__/performance/VirtualizedList.perf.test.tsx +362 -0
  10. package/app/(public)/onboarding.tsx +5 -5
  11. package/app.config.ts +45 -2
  12. package/assets/images/.gitkeep +7 -7
  13. package/components/onboarding/OnboardingScreen.tsx +370 -370
  14. package/components/onboarding/index.ts +2 -2
  15. package/components/providers/SuspenseBoundary.tsx +357 -0
  16. package/components/providers/index.ts +13 -0
  17. package/components/ui/Avatar.tsx +316 -316
  18. package/components/ui/Badge.tsx +416 -416
  19. package/components/ui/BottomSheet.tsx +307 -307
  20. package/components/ui/Checkbox.tsx +261 -261
  21. package/components/ui/OptimizedImage.tsx +369 -369
  22. package/components/ui/Select.tsx +240 -240
  23. package/components/ui/VirtualizedList.tsx +285 -0
  24. package/components/ui/index.ts +23 -18
  25. package/constants/config.ts +97 -54
  26. package/docs/adr/001-state-management.md +79 -79
  27. package/docs/adr/002-styling-approach.md +130 -130
  28. package/docs/adr/003-data-fetching.md +155 -155
  29. package/docs/adr/004-auth-adapter-pattern.md +144 -144
  30. package/docs/adr/README.md +78 -78
  31. package/hooks/index.ts +27 -25
  32. package/hooks/useApi.ts +102 -5
  33. package/hooks/useAuth.tsx +82 -0
  34. package/hooks/useBiometrics.ts +295 -295
  35. package/hooks/useDeepLinking.ts +256 -256
  36. package/hooks/useMFA.ts +499 -0
  37. package/hooks/useNotifications.ts +39 -0
  38. package/hooks/useOffline.ts +32 -2
  39. package/hooks/usePerformance.ts +434 -434
  40. package/hooks/useTheme.tsx +76 -0
  41. package/hooks/useUpdates.ts +358 -358
  42. package/i18n/index.ts +194 -77
  43. package/i18n/locales/ar.json +101 -0
  44. package/i18n/locales/de.json +101 -0
  45. package/i18n/locales/en.json +101 -101
  46. package/i18n/locales/es.json +101 -0
  47. package/i18n/locales/fr.json +101 -101
  48. package/jest.config.js +4 -4
  49. package/maestro/README.md +113 -113
  50. package/maestro/config.yaml +35 -35
  51. package/maestro/flows/login.yaml +62 -62
  52. package/maestro/flows/mfa-login.yaml +92 -0
  53. package/maestro/flows/mfa-setup.yaml +86 -0
  54. package/maestro/flows/navigation.yaml +68 -68
  55. package/maestro/flows/offline-conflict.yaml +101 -0
  56. package/maestro/flows/offline-sync.yaml +128 -0
  57. package/maestro/flows/offline.yaml +60 -60
  58. package/maestro/flows/register.yaml +94 -94
  59. package/package.json +175 -170
  60. package/services/analytics.ts +428 -428
  61. package/services/api.ts +340 -340
  62. package/services/authAdapter.ts +333 -333
  63. package/services/backgroundSync.ts +626 -0
  64. package/services/index.ts +54 -22
  65. package/services/security.ts +229 -0
  66. package/tailwind.config.js +47 -47
  67. package/utils/accessibility.ts +446 -446
  68. package/utils/index.ts +52 -43
  69. package/utils/withAccessibility.tsx +272 -0
@@ -1,184 +1,187 @@
1
- name: CI
2
-
3
- on:
4
- push:
5
- branches: [main, develop]
6
- pull_request:
7
- branches: [main, develop]
8
-
9
- concurrency:
10
- group: ${{ github.workflow }}-${{ github.ref }}
11
- cancel-in-progress: true
12
-
13
- env:
14
- NODE_VERSION: '18'
15
-
16
- jobs:
17
- # ============================================
18
- # Lint & Type Check
19
- # ============================================
20
- lint:
21
- name: Lint & Type Check
22
- runs-on: ubuntu-latest
23
- steps:
24
- - name: Checkout
25
- uses: actions/checkout@v4
26
-
27
- - name: Setup Node.js
28
- uses: actions/setup-node@v4
29
- with:
30
- node-version: ${{ env.NODE_VERSION }}
31
- cache: 'npm'
32
-
33
- - name: Install dependencies
34
- run: npm ci
35
-
36
- - name: Run ESLint
37
- run: npm run lint
38
-
39
- - name: Run TypeScript check
40
- run: npm run typecheck
41
-
42
- # ============================================
43
- # Unit Tests
44
- # ============================================
45
- test:
46
- name: Unit Tests
47
- runs-on: ubuntu-latest
48
- steps:
49
- - name: Checkout
50
- uses: actions/checkout@v4
51
-
52
- - name: Setup Node.js
53
- uses: actions/setup-node@v4
54
- with:
55
- node-version: ${{ env.NODE_VERSION }}
56
- cache: 'npm'
57
-
58
- - name: Install dependencies
59
- run: npm ci
60
-
61
- - name: Run tests with coverage
62
- run: npm run test:coverage
63
-
64
- - name: Upload coverage to Codecov
65
- uses: codecov/codecov-action@v4
66
- with:
67
- token: ${{ secrets.CODECOV_TOKEN }}
68
- files: ./coverage/lcov.info
69
- fail_ci_if_error: false
70
-
71
- # ============================================
72
- # Build Check (Expo)
73
- # ============================================
74
- build-check:
75
- name: Build Check
76
- runs-on: ubuntu-latest
77
- steps:
78
- - name: Checkout
79
- uses: actions/checkout@v4
80
-
81
- - name: Setup Node.js
82
- uses: actions/setup-node@v4
83
- with:
84
- node-version: ${{ env.NODE_VERSION }}
85
- cache: 'npm'
86
-
87
- - name: Setup Expo
88
- uses: expo/expo-github-action@v8
89
- with:
90
- expo-version: latest
91
- eas-version: latest
92
- token: ${{ secrets.EXPO_TOKEN }}
93
-
94
- - name: Install dependencies
95
- run: npm ci
96
-
97
- - name: Check Expo config
98
- run: npx expo config --type public
99
-
100
- - name: Export for web (validates build)
101
- run: npx expo export --platform web
102
-
103
- # ============================================
104
- # E2E Tests with Maestro Cloud
105
- # ============================================
106
- e2e:
107
- name: E2E Tests (Maestro)
108
- runs-on: ubuntu-latest
109
- needs: [lint, test]
110
- if: github.event_name == 'push' && github.ref == 'refs/heads/main'
111
- steps:
112
- - name: Checkout
113
- uses: actions/checkout@v4
114
-
115
- - name: Setup Node.js
116
- uses: actions/setup-node@v4
117
- with:
118
- node-version: ${{ env.NODE_VERSION }}
119
- cache: 'npm'
120
-
121
- - name: Install dependencies
122
- run: npm ci
123
-
124
- - name: Setup Expo
125
- uses: expo/expo-github-action@v8
126
- with:
127
- expo-version: latest
128
- eas-version: latest
129
- token: ${{ secrets.EXPO_TOKEN }}
130
-
131
- # Build for Android (or use existing build)
132
- - name: Build Android APK
133
- run: eas build --platform android --profile preview --non-interactive --local
134
- env:
135
- EXPO_TOKEN: ${{ secrets.EXPO_TOKEN }}
136
- continue-on-error: true
137
-
138
- # Run Maestro Cloud tests
139
- - name: Run Maestro Cloud Tests
140
- uses: mobile-dev-inc/action-maestro-cloud@v1
141
- with:
142
- api-key: ${{ secrets.MAESTRO_CLOUD_API_KEY }}
143
- app-file: ./build/*.apk
144
- flows: ./maestro/flows/
145
- env: |
146
- APP_ID=com.croacroa.app
147
- continue-on-error: true
148
-
149
- # ============================================
150
- # Security Audit
151
- # ============================================
152
- security:
153
- name: Security Audit
154
- runs-on: ubuntu-latest
155
- steps:
156
- - name: Checkout
157
- uses: actions/checkout@v4
158
-
159
- - name: Setup Node.js
160
- uses: actions/setup-node@v4
161
- with:
162
- node-version: ${{ env.NODE_VERSION }}
163
- cache: 'npm'
164
-
165
- - name: Install dependencies
166
- run: npm ci
167
-
168
- - name: Run npm audit
169
- run: npm audit --audit-level=high
170
- continue-on-error: true
171
-
172
- # ============================================
173
- # Notify on failure
174
- # ============================================
175
- notify:
176
- name: Notify
177
- runs-on: ubuntu-latest
178
- needs: [lint, test, build-check]
179
- if: failure()
180
- steps:
181
- - name: Send notification
182
- run: |
183
- echo "CI failed for ${{ github.repository }}"
184
- # Add Slack/Discord webhook notification here if needed
1
+ name: CI
2
+
3
+ on:
4
+ push:
5
+ branches: [main, develop]
6
+ pull_request:
7
+ branches: [main, develop]
8
+
9
+ concurrency:
10
+ group: ${{ github.workflow }}-${{ github.ref }}
11
+ cancel-in-progress: true
12
+
13
+ env:
14
+ NODE_VERSION: '18'
15
+
16
+ jobs:
17
+ # ============================================
18
+ # Lint & Type Check
19
+ # ============================================
20
+ lint:
21
+ name: Lint & Type Check
22
+ runs-on: ubuntu-latest
23
+ steps:
24
+ - name: Checkout
25
+ uses: actions/checkout@v4
26
+
27
+ - name: Setup Node.js
28
+ uses: actions/setup-node@v4
29
+ with:
30
+ node-version: ${{ env.NODE_VERSION }}
31
+ cache: 'npm'
32
+
33
+ - name: Install dependencies
34
+ run: npm ci
35
+
36
+ - name: Run ESLint
37
+ run: npm run lint
38
+
39
+ - name: Run TypeScript check
40
+ run: npm run typecheck
41
+
42
+ # ============================================
43
+ # Unit Tests
44
+ # ============================================
45
+ test:
46
+ name: Unit Tests
47
+ runs-on: ubuntu-latest
48
+ steps:
49
+ - name: Checkout
50
+ uses: actions/checkout@v4
51
+
52
+ - name: Setup Node.js
53
+ uses: actions/setup-node@v4
54
+ with:
55
+ node-version: ${{ env.NODE_VERSION }}
56
+ cache: 'npm'
57
+
58
+ - name: Install dependencies
59
+ run: npm ci
60
+
61
+ - name: Run tests with coverage
62
+ run: npm run test:coverage
63
+
64
+ - name: Upload coverage to Codecov
65
+ uses: codecov/codecov-action@v4
66
+ with:
67
+ token: ${{ secrets.CODECOV_TOKEN }}
68
+ files: ./coverage/lcov.info
69
+ fail_ci_if_error: false
70
+
71
+ # ============================================
72
+ # Build Check (Expo)
73
+ # ============================================
74
+ build-check:
75
+ name: Build Check
76
+ runs-on: ubuntu-latest
77
+ steps:
78
+ - name: Checkout
79
+ uses: actions/checkout@v4
80
+
81
+ - name: Setup Node.js
82
+ uses: actions/setup-node@v4
83
+ with:
84
+ node-version: ${{ env.NODE_VERSION }}
85
+ cache: 'npm'
86
+
87
+ - name: Setup Expo
88
+ uses: expo/expo-github-action@v8
89
+ with:
90
+ expo-version: latest
91
+ eas-version: latest
92
+ token: ${{ secrets.EXPO_TOKEN }}
93
+
94
+ - name: Install dependencies
95
+ run: npm ci
96
+
97
+ - name: Check Expo config
98
+ run: npx expo config --type public
99
+
100
+ - name: Export for web (validates build)
101
+ run: npx expo export --platform web
102
+
103
+ # ============================================
104
+ # E2E Tests with Maestro Cloud
105
+ # ============================================
106
+ e2e:
107
+ name: E2E Tests (Maestro)
108
+ runs-on: ubuntu-latest
109
+ needs: [lint, test]
110
+ if: github.event_name == 'push' && github.ref == 'refs/heads/main'
111
+ steps:
112
+ - name: Checkout
113
+ uses: actions/checkout@v4
114
+
115
+ - name: Setup Node.js
116
+ uses: actions/setup-node@v4
117
+ with:
118
+ node-version: ${{ env.NODE_VERSION }}
119
+ cache: 'npm'
120
+
121
+ - name: Install dependencies
122
+ run: npm ci
123
+
124
+ - name: Setup Expo
125
+ uses: expo/expo-github-action@v8
126
+ with:
127
+ expo-version: latest
128
+ eas-version: latest
129
+ token: ${{ secrets.EXPO_TOKEN }}
130
+
131
+ # Build for Android (or use existing build)
132
+ - name: Build Android APK
133
+ run: eas build --platform android --profile preview --non-interactive --local
134
+ env:
135
+ EXPO_TOKEN: ${{ secrets.EXPO_TOKEN }}
136
+ continue-on-error: true
137
+
138
+ # Run Maestro Cloud tests
139
+ - name: Run Maestro Cloud Tests
140
+ uses: mobile-dev-inc/action-maestro-cloud@v1
141
+ with:
142
+ api-key: ${{ secrets.MAESTRO_CLOUD_API_KEY }}
143
+ app-file: ./build/*.apk
144
+ flows: ./maestro/flows/
145
+ env: |
146
+ APP_ID=com.croacroa.app
147
+ continue-on-error: true
148
+
149
+ # ============================================
150
+ # Security Audit
151
+ # ============================================
152
+ security:
153
+ name: Security Audit
154
+ runs-on: ubuntu-latest
155
+ steps:
156
+ - name: Checkout
157
+ uses: actions/checkout@v4
158
+
159
+ - name: Setup Node.js
160
+ uses: actions/setup-node@v4
161
+ with:
162
+ node-version: ${{ env.NODE_VERSION }}
163
+ cache: 'npm'
164
+
165
+ - name: Install dependencies
166
+ run: npm ci
167
+
168
+ - name: Run npm audit (production dependencies)
169
+ run: npm audit --audit-level=high --omit=dev
170
+
171
+ - name: Run npm audit (all dependencies - non-blocking)
172
+ run: npm audit --audit-level=critical
173
+ continue-on-error: true
174
+
175
+ # ============================================
176
+ # Notify on failure
177
+ # ============================================
178
+ notify:
179
+ name: Notify
180
+ runs-on: ubuntu-latest
181
+ needs: [lint, test, build-check]
182
+ if: failure()
183
+ steps:
184
+ - name: Send notification
185
+ run: |
186
+ echo "CI failed for ${{ github.repository }}"
187
+ # Add Slack/Discord webhook notification here if needed
@@ -1,55 +1,55 @@
1
- name: EAS Build
2
-
3
- on:
4
- workflow_dispatch:
5
- inputs:
6
- platform:
7
- description: 'Platform to build'
8
- required: true
9
- default: 'all'
10
- type: choice
11
- options:
12
- - all
13
- - ios
14
- - android
15
- profile:
16
- description: 'Build profile'
17
- required: true
18
- default: 'preview'
19
- type: choice
20
- options:
21
- - development
22
- - preview
23
- - production
24
-
25
- jobs:
26
- build:
27
- name: Build ${{ github.event.inputs.platform }} (${{ github.event.inputs.profile }})
28
- runs-on: ubuntu-latest
29
- steps:
30
- - name: Checkout
31
- uses: actions/checkout@v4
32
-
33
- - name: Setup Node.js
34
- uses: actions/setup-node@v4
35
- with:
36
- node-version: '18'
37
- cache: 'npm'
38
-
39
- - name: Setup Expo
40
- uses: expo/expo-github-action@v8
41
- with:
42
- expo-version: latest
43
- eas-version: latest
44
- token: ${{ secrets.EXPO_TOKEN }}
45
-
46
- - name: Install dependencies
47
- run: npm ci
48
-
49
- - name: Build iOS
50
- if: ${{ github.event.inputs.platform == 'ios' || github.event.inputs.platform == 'all' }}
51
- run: eas build --platform ios --profile ${{ github.event.inputs.profile }} --non-interactive
52
-
53
- - name: Build Android
54
- if: ${{ github.event.inputs.platform == 'android' || github.event.inputs.platform == 'all' }}
55
- run: eas build --platform android --profile ${{ github.event.inputs.profile }} --non-interactive
1
+ name: EAS Build
2
+
3
+ on:
4
+ workflow_dispatch:
5
+ inputs:
6
+ platform:
7
+ description: 'Platform to build'
8
+ required: true
9
+ default: 'all'
10
+ type: choice
11
+ options:
12
+ - all
13
+ - ios
14
+ - android
15
+ profile:
16
+ description: 'Build profile'
17
+ required: true
18
+ default: 'preview'
19
+ type: choice
20
+ options:
21
+ - development
22
+ - preview
23
+ - production
24
+
25
+ jobs:
26
+ build:
27
+ name: Build ${{ github.event.inputs.platform }} (${{ github.event.inputs.profile }})
28
+ runs-on: ubuntu-latest
29
+ steps:
30
+ - name: Checkout
31
+ uses: actions/checkout@v4
32
+
33
+ - name: Setup Node.js
34
+ uses: actions/setup-node@v4
35
+ with:
36
+ node-version: '18'
37
+ cache: 'npm'
38
+
39
+ - name: Setup Expo
40
+ uses: expo/expo-github-action@v8
41
+ with:
42
+ expo-version: latest
43
+ eas-version: latest
44
+ token: ${{ secrets.EXPO_TOKEN }}
45
+
46
+ - name: Install dependencies
47
+ run: npm ci
48
+
49
+ - name: Build iOS
50
+ if: ${{ github.event.inputs.platform == 'ios' || github.event.inputs.platform == 'all' }}
51
+ run: eas build --platform ios --profile ${{ github.event.inputs.profile }} --non-interactive
52
+
53
+ - name: Build Android
54
+ if: ${{ github.event.inputs.platform == 'android' || github.event.inputs.platform == 'all' }}
55
+ run: eas build --platform android --profile ${{ github.event.inputs.profile }} --non-interactive
@@ -1,50 +1,50 @@
1
- name: EAS Update (OTA)
2
-
3
- on:
4
- push:
5
- branches: [main]
6
- paths-ignore:
7
- - '**.md'
8
- - '.github/**'
9
- - 'maestro/**'
10
- - 'docs/**'
11
-
12
- jobs:
13
- update:
14
- name: Publish OTA Update
15
- runs-on: ubuntu-latest
16
- steps:
17
- - name: Checkout
18
- uses: actions/checkout@v4
19
-
20
- - name: Setup Node.js
21
- uses: actions/setup-node@v4
22
- with:
23
- node-version: '18'
24
- cache: 'npm'
25
-
26
- - name: Setup Expo
27
- uses: expo/expo-github-action@v8
28
- with:
29
- expo-version: latest
30
- eas-version: latest
31
- token: ${{ secrets.EXPO_TOKEN }}
32
-
33
- - name: Install dependencies
34
- run: npm ci
35
-
36
- - name: Publish update
37
- run: eas update --auto --non-interactive
38
- env:
39
- EXPO_TOKEN: ${{ secrets.EXPO_TOKEN }}
40
-
41
- - name: Comment on commit
42
- uses: actions/github-script@v7
43
- with:
44
- script: |
45
- github.rest.repos.createCommitComment({
46
- owner: context.repo.owner,
47
- repo: context.repo.repo,
48
- commit_sha: context.sha,
49
- body: '🚀 OTA update published successfully!'
50
- })
1
+ name: EAS Update (OTA)
2
+
3
+ on:
4
+ push:
5
+ branches: [main]
6
+ paths-ignore:
7
+ - '**.md'
8
+ - '.github/**'
9
+ - 'maestro/**'
10
+ - 'docs/**'
11
+
12
+ jobs:
13
+ update:
14
+ name: Publish OTA Update
15
+ runs-on: ubuntu-latest
16
+ steps:
17
+ - name: Checkout
18
+ uses: actions/checkout@v4
19
+
20
+ - name: Setup Node.js
21
+ uses: actions/setup-node@v4
22
+ with:
23
+ node-version: '18'
24
+ cache: 'npm'
25
+
26
+ - name: Setup Expo
27
+ uses: expo/expo-github-action@v8
28
+ with:
29
+ expo-version: latest
30
+ eas-version: latest
31
+ token: ${{ secrets.EXPO_TOKEN }}
32
+
33
+ - name: Install dependencies
34
+ run: npm ci
35
+
36
+ - name: Publish update
37
+ run: eas update --auto --non-interactive
38
+ env:
39
+ EXPO_TOKEN: ${{ secrets.EXPO_TOKEN }}
40
+
41
+ - name: Comment on commit
42
+ uses: actions/github-script@v7
43
+ with:
44
+ script: |
45
+ github.rest.repos.createCommitComment({
46
+ owner: context.repo.owner,
47
+ repo: context.repo.repo,
48
+ commit_sha: context.sha,
49
+ body: '🚀 OTA update published successfully!'
50
+ })