feat: implement Stripe checkout flow, update profile settings UI for subscriptions, and add agent profile editing.

This commit is contained in:
pradeepkumar
2026-03-09 06:04:54 +05:30
parent e129be5a59
commit 0102617dc7
16 changed files with 2597 additions and 183 deletions

View File

@@ -299,6 +299,53 @@ class ProfileRepository {
}
}
/// Get sections for an agent type: GET /profile-sections/agent-type/{agentTypeId}
/// Returns { agentType: {...}, sections: [...] }
Future<Map<String, dynamic>> getSectionsForAgentType(
String agentTypeId) async {
try {
final response =
await _dio.get('/profile-sections/agent-type/$agentTypeId');
return response.data['data'] as Map<String, dynamic>;
} on DioException catch (e) {
if (e.error is ApiException) throw e.error as ApiException;
throw ApiException(
message: e.message ?? 'Failed to fetch profile sections',
statusCode: e.response?.statusCode,
);
}
}
/// Get field values: GET /agents/profile/field-values
/// Returns { agentProfileId: "...", fieldValues: [...] }
Future<Map<String, dynamic>> getFieldValues() async {
try {
final response = await _dio.get('/agents/profile/field-values');
return response.data['data'] as Map<String, dynamic>;
} on DioException catch (e) {
if (e.error is ApiException) throw e.error as ApiException;
throw ApiException(
message: e.message ?? 'Failed to fetch field values',
statusCode: e.response?.statusCode,
);
}
}
/// Save field values: PUT /agents/profile/field-values
Future<void> saveFieldValues(List<Map<String, dynamic>> fieldValues) async {
try {
await _dio.put('/agents/profile/field-values', data: {
'fieldValues': fieldValues,
});
} on DioException catch (e) {
if (e.error is ApiException) throw e.error as ApiException;
throw ApiException(
message: e.message ?? 'Failed to save field values',
statusCode: e.response?.statusCode,
);
}
}
/// Cancel subscription: POST /stripe/cancel-subscription
Future<void> cancelSubscription() async {
try {