@djangocfg/api 1.2.1 → 1.2.2
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/dist/index.cjs +13 -13
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +13 -13
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
- package/src/cfg/services_deprecated/README.md +53 -0
- package/src/index.ts +2 -2
- /package/src/cfg/{services → services_deprecated}/auth/AuthService.ts +0 -0
- /package/src/cfg/{services → services_deprecated}/auth/index.ts +0 -0
- /package/src/cfg/{services → services_deprecated}/index.ts +0 -0
- /package/src/cfg/{services → services_deprecated}/leads/LeadsService.ts +0 -0
- /package/src/cfg/{services → services_deprecated}/leads/index.ts +0 -0
- /package/src/cfg/{services → services_deprecated}/newsletter/BulkEmailService.ts +0 -0
- /package/src/cfg/{services → services_deprecated}/newsletter/CampaignsService.ts +0 -0
- /package/src/cfg/{services → services_deprecated}/newsletter/NewsletterService.ts +0 -0
- /package/src/cfg/{services → services_deprecated}/newsletter/NewslettersListService.ts +0 -0
- /package/src/cfg/{services → services_deprecated}/newsletter/index.ts +0 -0
- /package/src/cfg/{services → services_deprecated}/payments/ApiKeysService.ts +0 -0
- /package/src/cfg/{services → services_deprecated}/payments/DashboardService.ts +0 -0
- /package/src/cfg/{services → services_deprecated}/payments/PaymentsService.ts +0 -0
- /package/src/cfg/{services → services_deprecated}/payments/SubscriptionsService.ts +0 -0
- /package/src/cfg/{services → services_deprecated}/payments/index.ts +0 -0
- /package/src/cfg/{services → services_deprecated}/support/SupportService.ts +0 -0
- /package/src/cfg/{services → services_deprecated}/support/index.ts +0 -0
- /package/src/cfg/{services → services_deprecated}/tasks/TasksService.ts +0 -0
- /package/src/cfg/{services → services_deprecated}/tasks/index.ts +0 -0
- /package/src/cfg/{services → services_deprecated}/webhooks/WebhooksService.ts +0 -0
- /package/src/cfg/{services → services_deprecated}/webhooks/index.ts +0 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@djangocfg/api",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.2",
|
|
4
4
|
"author": {
|
|
5
5
|
"name": "DjangoCFG",
|
|
6
6
|
"url": "https://djangocfg.com"
|
|
@@ -68,7 +68,7 @@
|
|
|
68
68
|
"@types/node": "^22.15.3",
|
|
69
69
|
"@types/react": "19.2.2",
|
|
70
70
|
"@types/react-dom": "19.2.1",
|
|
71
|
-
"@djangocfg/typescript-config": "^1.2.
|
|
71
|
+
"@djangocfg/typescript-config": "^1.2.2",
|
|
72
72
|
"react": "^19.1.0",
|
|
73
73
|
"react-dom": "^19.1.0",
|
|
74
74
|
"tsup": "^8.5.0",
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
# ⚠️ DEPRECATED: Services
|
|
2
|
+
|
|
3
|
+
This directory contains **deprecated** service implementations.
|
|
4
|
+
|
|
5
|
+
## Migration Guide
|
|
6
|
+
|
|
7
|
+
**Old approach (deprecated):**
|
|
8
|
+
```typescript
|
|
9
|
+
import { AuthService } from '@djangocfg/api';
|
|
10
|
+
|
|
11
|
+
// Direct service calls
|
|
12
|
+
const result = await AuthService.verifyOTP(email, code);
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
**New approach (recommended):**
|
|
16
|
+
```typescript
|
|
17
|
+
import { AccountsProvider, useAccountsContext } from '@djangocfg/api/cfg/contexts';
|
|
18
|
+
|
|
19
|
+
function MyComponent() {
|
|
20
|
+
return (
|
|
21
|
+
<AccountsProvider>
|
|
22
|
+
<ProfileComponent />
|
|
23
|
+
</AccountsProvider>
|
|
24
|
+
);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
function ProfileComponent() {
|
|
28
|
+
const { profile, isLoading, error } = useAccountsContext();
|
|
29
|
+
// Use context data with SWR caching
|
|
30
|
+
}
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
## Why migrate?
|
|
34
|
+
|
|
35
|
+
1. **SWR Integration**: Contexts use SWR for automatic caching, revalidation, and optimistic updates
|
|
36
|
+
2. **React-first**: Built for React components with hooks
|
|
37
|
+
3. **Type-safe**: Full TypeScript support with generated types
|
|
38
|
+
4. **Better UX**: Automatic loading states, error handling, and data synchronization
|
|
39
|
+
|
|
40
|
+
## Available Contexts
|
|
41
|
+
|
|
42
|
+
- `AccountsProvider` / `useAccountsContext` - User profile management
|
|
43
|
+
- More contexts coming soon...
|
|
44
|
+
|
|
45
|
+
## Deprecation Timeline
|
|
46
|
+
|
|
47
|
+
- ✅ **Now**: Both services and contexts are available
|
|
48
|
+
- 🔄 **Future**: Services will be removed in next major version
|
|
49
|
+
- 📝 **Action**: Migrate to contexts before upgrading
|
|
50
|
+
|
|
51
|
+
## Need Help?
|
|
52
|
+
|
|
53
|
+
Check the contexts documentation in `/packages/api/src/cfg/contexts/README.md`
|
package/src/index.ts
CHANGED
|
@@ -31,8 +31,8 @@ export * from './cfg/generated';
|
|
|
31
31
|
export { api } from './cfg/BaseClient';
|
|
32
32
|
export { api as default } from './cfg/BaseClient';
|
|
33
33
|
|
|
34
|
-
// Export all services (
|
|
35
|
-
export * from './cfg/
|
|
34
|
+
// Export all services (deprecated - use contexts instead)
|
|
35
|
+
export * from './cfg/services_deprecated';
|
|
36
36
|
|
|
37
37
|
// Export all contexts (React contexts for data management)
|
|
38
38
|
export * from './cfg/contexts';
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|