@safercity/sdk-react 0.1.2 → 0.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/dist/index.d.cts CHANGED
@@ -1,4 +1,4 @@
1
- import { ProxyModeConfig, DirectModeConfig, CookieModeConfig, SaferCityClientOptions, SaferCityClient, AuthMode, ApiResponse, SaferCityApiError, ServerSentEvent } from '@safercity/sdk';
1
+ import { ProxyModeConfig, DirectModeConfig, CookieModeConfig, SaferCityClientOptions, SaferCityClient, AuthMode, ApiResponse, SaferCityApiError, PanicInformationRecord, ServerSentEvent } from '@safercity/sdk';
2
2
  export * from '@safercity/sdk';
3
3
  import * as react_jsx_runtime from 'react/jsx-runtime';
4
4
  import { ReactNode } from 'react';
@@ -46,11 +46,13 @@ interface ProxyModeProviderProps extends BaseProviderProps, ProxyModeConfig {
46
46
  * Props for direct mode
47
47
  */
48
48
  interface DirectModeProviderProps extends BaseProviderProps, DirectModeConfig {
49
+ userId?: string;
49
50
  }
50
51
  /**
51
52
  * Props for cookie mode
52
53
  */
53
54
  interface CookieModeProviderProps extends BaseProviderProps, CookieModeConfig {
55
+ userId?: string;
54
56
  }
55
57
  /**
56
58
  * Legacy props (for backward compatibility)
@@ -127,20 +129,34 @@ declare const saferCityKeys: {
127
129
  auth: () => readonly ["safercity", "auth"];
128
130
  authWhoami: () => readonly ["safercity", "auth", "whoami"];
129
131
  users: () => readonly ["safercity", "users"];
130
- usersList: (filters?: Record<string, unknown>) => readonly ["safercity", "users", "list", Record<string, unknown> | undefined];
131
132
  usersDetail: (userId: string) => readonly ["safercity", "users", "detail", string];
132
133
  panics: () => readonly ["safercity", "panics"];
133
134
  panicsList: (filters?: Record<string, unknown>) => readonly ["safercity", "panics", "list", Record<string, unknown> | undefined];
134
135
  panicsDetail: (panicId: string) => readonly ["safercity", "panics", "detail", string];
136
+ panicTypes: (userId: string) => readonly ["safercity", "panics", "types", string];
137
+ panicInformation: () => readonly ["safercity", "panicInformation"];
138
+ panicInformationDetail: (id: string) => readonly ["safercity", "panicInformation", "detail", string];
139
+ panicInformationByUser: (userId: string) => readonly ["safercity", "panicInformation", "byUser", string];
140
+ panicEligibility: (userId: string) => readonly ["safercity", "panicInformation", "eligibility", string];
135
141
  subscriptions: () => readonly ["safercity", "subscriptions"];
136
142
  subscriptionsList: (filters?: Record<string, unknown>) => readonly ["safercity", "subscriptions", "list", Record<string, unknown> | undefined];
137
143
  subscriptionsTypes: () => readonly ["safercity", "subscriptions", "types"];
138
144
  subscriptionsStats: () => readonly ["safercity", "subscriptions", "stats"];
139
145
  locationSafety: (lat: number, lng: number) => readonly ["safercity", "location-safety", number, number];
146
+ banner: (body: {
147
+ latitude: number;
148
+ longitude: number;
149
+ radius?: number;
150
+ }) => readonly ["safercity", "banner", {
151
+ latitude: number;
152
+ longitude: number;
153
+ radius?: number;
154
+ }];
140
155
  crimes: () => readonly ["safercity", "crimes"];
141
156
  crimesList: (filters?: Record<string, unknown>) => readonly ["safercity", "crimes", "list", Record<string, unknown> | undefined];
142
157
  crimesCategories: () => readonly ["safercity", "crimes", "categories"];
143
158
  crimesTypes: () => readonly ["safercity", "crimes", "types"];
159
+ crimeCategoriesWithTypes: () => readonly ["safercity", "crimes", "categoriesWithTypes"];
144
160
  };
145
161
  declare function useHealthCheck(options?: Omit<UseQueryOptions<ApiResponse<{
146
162
  status: string;
@@ -160,29 +176,6 @@ declare function useWhoAmI(options?: Omit<UseQueryOptions<ApiResponse<{
160
176
  scopes: string[];
161
177
  sessionId: string;
162
178
  }>, SaferCityApiError>;
163
- declare function useUsers(filters?: {
164
- limit?: number;
165
- cursor?: string;
166
- status?: string;
167
- }, options?: Omit<UseQueryOptions<ApiResponse<{
168
- users: Array<{
169
- id: string;
170
- email?: string;
171
- phone?: string;
172
- status: string;
173
- }>;
174
- hasNext: boolean;
175
- cursor?: string;
176
- }>, SaferCityApiError>, 'queryKey' | 'queryFn'>): _tanstack_react_query.UseQueryResult<ApiResponse<{
177
- users: Array<{
178
- id: string;
179
- email?: string;
180
- phone?: string;
181
- status: string;
182
- }>;
183
- hasNext: boolean;
184
- cursor?: string;
185
- }>, SaferCityApiError>;
186
179
  declare function useUser(userId: string, options?: Omit<UseQueryOptions<ApiResponse<{
187
180
  id: string;
188
181
  email?: string;
@@ -244,35 +237,6 @@ declare function useUpdateUser(options?: UseMutationOptions<ApiResponse<{
244
237
  metadata?: Record<string, unknown>;
245
238
  };
246
239
  }, unknown>;
247
- declare function useDeleteUser(options?: UseMutationOptions<ApiResponse<{
248
- success: boolean;
249
- }>, SaferCityApiError, string>): _tanstack_react_query.UseMutationResult<ApiResponse<{
250
- success: boolean;
251
- }>, SaferCityApiError, string, unknown>;
252
- declare function usePanics(filters?: {
253
- userId?: string;
254
- status?: string;
255
- limit?: number;
256
- cursor?: string;
257
- }, options?: Omit<UseQueryOptions<ApiResponse<{
258
- panics: Array<{
259
- id: string;
260
- userId: string;
261
- status: string;
262
- createdAt: string;
263
- }>;
264
- hasNext: boolean;
265
- cursor?: string;
266
- }>, SaferCityApiError>, 'queryKey' | 'queryFn'>): _tanstack_react_query.UseQueryResult<ApiResponse<{
267
- panics: Array<{
268
- id: string;
269
- userId: string;
270
- status: string;
271
- createdAt: string;
272
- }>;
273
- hasNext: boolean;
274
- cursor?: string;
275
- }>, SaferCityApiError>;
276
240
  declare function usePanic(panicId: string, query?: {
277
241
  userId?: string;
278
242
  }, options?: Omit<UseQueryOptions<ApiResponse<{
@@ -361,6 +325,137 @@ declare function useCancelPanic(options?: UseMutationOptions<ApiResponse<{
361
325
  reason?: string;
362
326
  };
363
327
  }, unknown>;
328
+ declare function usePanicTypes(userId: string, options?: Omit<UseQueryOptions<ApiResponse<{
329
+ types: Array<{
330
+ id: string;
331
+ name: string;
332
+ description?: string;
333
+ }>;
334
+ }>, SaferCityApiError>, 'queryKey' | 'queryFn'>): _tanstack_react_query.UseQueryResult<ApiResponse<{
335
+ types: Array<{
336
+ id: string;
337
+ name: string;
338
+ description?: string;
339
+ }>;
340
+ }>, SaferCityApiError>;
341
+ declare function usePanicInformation(id: string, options?: Omit<UseQueryOptions<ApiResponse<{
342
+ success: boolean;
343
+ data: PanicInformationRecord;
344
+ }>, SaferCityApiError>, 'queryKey' | 'queryFn'>): _tanstack_react_query.UseQueryResult<ApiResponse<{
345
+ success: boolean;
346
+ data: PanicInformationRecord;
347
+ }>, SaferCityApiError>;
348
+ declare function usePanicInformationByUser(userId: string, options?: Omit<UseQueryOptions<ApiResponse<{
349
+ success: boolean;
350
+ data: PanicInformationRecord;
351
+ }>, SaferCityApiError>, 'queryKey' | 'queryFn'>): _tanstack_react_query.UseQueryResult<ApiResponse<{
352
+ success: boolean;
353
+ data: PanicInformationRecord;
354
+ }>, SaferCityApiError>;
355
+ declare function usePanicEligibility(userId: string, options?: Omit<UseQueryOptions<ApiResponse<{
356
+ success: boolean;
357
+ data: {
358
+ eligible: boolean;
359
+ subscriptionActive: boolean;
360
+ profileComplete: boolean;
361
+ reasons: string[];
362
+ panicInformation: PanicInformationRecord | null;
363
+ subscriptionDetails: {
364
+ usedSeats: number;
365
+ userHasActiveSubscription: boolean;
366
+ } | null;
367
+ };
368
+ }>, SaferCityApiError>, 'queryKey' | 'queryFn'>): _tanstack_react_query.UseQueryResult<ApiResponse<{
369
+ success: boolean;
370
+ data: {
371
+ eligible: boolean;
372
+ subscriptionActive: boolean;
373
+ profileComplete: boolean;
374
+ reasons: string[];
375
+ panicInformation: PanicInformationRecord | null;
376
+ subscriptionDetails: {
377
+ usedSeats: number;
378
+ userHasActiveSubscription: boolean;
379
+ } | null;
380
+ };
381
+ }>, SaferCityApiError>;
382
+ declare function useCreatePanicInformation(options?: UseMutationOptions<ApiResponse<{
383
+ success: boolean;
384
+ data: PanicInformationRecord;
385
+ message: string;
386
+ }>, SaferCityApiError, {
387
+ userId: string;
388
+ phoneNumber: string;
389
+ firstName: string;
390
+ lastName: string;
391
+ idNumber: string;
392
+ duressCode?: string;
393
+ emergencyContacts?: Array<{
394
+ name: string;
395
+ phoneNumber: string;
396
+ relationship?: string;
397
+ }>;
398
+ }>): _tanstack_react_query.UseMutationResult<ApiResponse<{
399
+ success: boolean;
400
+ data: PanicInformationRecord;
401
+ message: string;
402
+ }>, SaferCityApiError, {
403
+ userId: string;
404
+ phoneNumber: string;
405
+ firstName: string;
406
+ lastName: string;
407
+ idNumber: string;
408
+ duressCode?: string;
409
+ emergencyContacts?: Array<{
410
+ name: string;
411
+ phoneNumber: string;
412
+ relationship?: string;
413
+ }>;
414
+ }, unknown>;
415
+ declare function useUpdatePanicInformation(options?: UseMutationOptions<ApiResponse<{
416
+ success: boolean;
417
+ data: PanicInformationRecord;
418
+ message: string;
419
+ }>, SaferCityApiError, {
420
+ id: string;
421
+ data: {
422
+ phoneNumber?: string;
423
+ firstName?: string;
424
+ lastName?: string;
425
+ idNumber?: string;
426
+ duressCode?: string;
427
+ emergencyContacts?: Array<{
428
+ name: string;
429
+ phoneNumber: string;
430
+ relationship?: string;
431
+ }>;
432
+ };
433
+ }>): _tanstack_react_query.UseMutationResult<ApiResponse<{
434
+ success: boolean;
435
+ data: PanicInformationRecord;
436
+ message: string;
437
+ }>, SaferCityApiError, {
438
+ id: string;
439
+ data: {
440
+ phoneNumber?: string;
441
+ firstName?: string;
442
+ lastName?: string;
443
+ idNumber?: string;
444
+ duressCode?: string;
445
+ emergencyContacts?: Array<{
446
+ name: string;
447
+ phoneNumber: string;
448
+ relationship?: string;
449
+ }>;
450
+ };
451
+ }, unknown>;
452
+ declare function useDeletePanicInformation(options?: UseMutationOptions<ApiResponse<{
453
+ success: boolean;
454
+ message: string;
455
+ }>, SaferCityApiError, string>): _tanstack_react_query.UseMutationResult<ApiResponse<{
456
+ success: boolean;
457
+ message: string;
458
+ }>, SaferCityApiError, string, unknown>;
364
459
  declare function useSubscriptionTypes(options?: Omit<UseQueryOptions<ApiResponse<{
365
460
  types: Array<{
366
461
  id: string;
@@ -395,15 +490,6 @@ declare function useSubscriptions(filters?: {
395
490
  status: string;
396
491
  }>;
397
492
  }>, SaferCityApiError>;
398
- declare function useSubscriptionStats(options?: Omit<UseQueryOptions<ApiResponse<{
399
- total: number;
400
- active: number;
401
- byType: Record<string, number>;
402
- }>, SaferCityApiError>, 'queryKey' | 'queryFn'>): _tanstack_react_query.UseQueryResult<ApiResponse<{
403
- total: number;
404
- active: number;
405
- byType: Record<string, number>;
406
- }>, SaferCityApiError>;
407
493
  declare function useCreateSubscription(options?: UseMutationOptions<ApiResponse<{
408
494
  id: string;
409
495
  userId: string;
@@ -423,6 +509,38 @@ declare function useCreateSubscription(options?: UseMutationOptions<ApiResponse<
423
509
  subscriptionTypeId: string;
424
510
  status?: string;
425
511
  }, unknown>;
512
+ declare function useSubscribeUser(options?: UseMutationOptions<ApiResponse<{
513
+ id: string;
514
+ userId: string;
515
+ subscriptionTypeId: string;
516
+ status: string;
517
+ }>, SaferCityApiError, {
518
+ userId: string;
519
+ subscriptionTypeId: string;
520
+ }>): _tanstack_react_query.UseMutationResult<ApiResponse<{
521
+ id: string;
522
+ userId: string;
523
+ subscriptionTypeId: string;
524
+ status: string;
525
+ }>, SaferCityApiError, {
526
+ userId: string;
527
+ subscriptionTypeId: string;
528
+ }, unknown>;
529
+ declare function useBulkTriggerNotifications(options?: UseMutationOptions<ApiResponse<{
530
+ transactionIds: string[];
531
+ status: string;
532
+ }>, SaferCityApiError, {
533
+ userIds: string[];
534
+ workflowId: string;
535
+ payload?: Record<string, unknown>;
536
+ }>): _tanstack_react_query.UseMutationResult<ApiResponse<{
537
+ transactionIds: string[];
538
+ status: string;
539
+ }>, SaferCityApiError, {
540
+ userIds: string[];
541
+ workflowId: string;
542
+ payload?: Record<string, unknown>;
543
+ }, unknown>;
426
544
  declare function useLocationSafety(latitude: number, longitude: number, radius?: number, options?: Omit<UseQueryOptions<ApiResponse<{
427
545
  safetyScore: number;
428
546
  riskLevel: string;
@@ -438,6 +556,31 @@ declare function useLocationSafety(latitude: number, longitude: number, radius?:
438
556
  impact: number;
439
557
  }>;
440
558
  }>, SaferCityApiError>;
559
+ declare function useBanner(body: {
560
+ latitude: number;
561
+ longitude: number;
562
+ radius?: number;
563
+ }, options?: Omit<UseQueryOptions<ApiResponse<{
564
+ success: boolean;
565
+ data: {
566
+ totalCrimes: number;
567
+ categories: Array<{
568
+ name: string;
569
+ count: number;
570
+ }>;
571
+ period: string;
572
+ };
573
+ }>, SaferCityApiError>, 'queryKey' | 'queryFn'>): _tanstack_react_query.UseQueryResult<ApiResponse<{
574
+ success: boolean;
575
+ data: {
576
+ totalCrimes: number;
577
+ categories: Array<{
578
+ name: string;
579
+ count: number;
580
+ }>;
581
+ period: string;
582
+ };
583
+ }>, SaferCityApiError>;
441
584
  declare function useCrimes(filters?: {
442
585
  latitude?: number;
443
586
  longitude?: number;
@@ -487,6 +630,25 @@ declare function useCrimeTypes(options?: Omit<UseQueryOptions<ApiResponse<{
487
630
  categoryId: string;
488
631
  }>;
489
632
  }>, SaferCityApiError>;
633
+ declare function useCrimeCategoriesWithTypes(options?: Omit<UseQueryOptions<ApiResponse<{
634
+ categories: Array<{
635
+ id: string;
636
+ name: string;
637
+ types: Array<{
638
+ id: string;
639
+ name: string;
640
+ }>;
641
+ }>;
642
+ }>, SaferCityApiError>, 'queryKey' | 'queryFn'>): _tanstack_react_query.UseQueryResult<ApiResponse<{
643
+ categories: Array<{
644
+ id: string;
645
+ name: string;
646
+ types: Array<{
647
+ id: string;
648
+ name: string;
649
+ }>;
650
+ }>;
651
+ }>, SaferCityApiError>;
490
652
 
491
653
  /**
492
654
  * State for streaming hooks
@@ -619,4 +781,4 @@ declare function useStream<T = ServerSentEvent>(createStream: () => AsyncIterabl
619
781
  error: Error | null;
620
782
  };
621
783
 
622
- export { type CookieModeProviderProps, type DirectModeProviderProps, type ProxyModeProviderProps, SaferCityProvider, type SaferCityProviderProps, type SessionState, type StreamState, type UseStreamOptions, saferCityKeys, useAuthMode, useCancelPanic, useCreatePanic, useCreateSubscription, useCreateUser, useCrimeCategories, useCrimeTypes, useCrimes, useDeleteUser, useHealthCheck, useLocationSafety, usePanic, usePanicStream, usePanics, useSaferCity, useSaferCityClient, useSession, useSessionManager, useStream, useSubscriptionStats, useSubscriptionTypes, useSubscriptions, useUpdatePanicLocation, useUpdateUser, useUser, useUsers, useWhoAmI };
784
+ export { type CookieModeProviderProps, type DirectModeProviderProps, type ProxyModeProviderProps, SaferCityProvider, type SaferCityProviderProps, type SessionState, type StreamState, type UseStreamOptions, saferCityKeys, useAuthMode, useBanner, useBulkTriggerNotifications, useCancelPanic, useCreatePanic, useCreatePanicInformation, useCreateSubscription, useCreateUser, useCrimeCategories, useCrimeCategoriesWithTypes, useCrimeTypes, useCrimes, useDeletePanicInformation, useHealthCheck, useLocationSafety, usePanic, usePanicEligibility, usePanicInformation, usePanicInformationByUser, usePanicStream, usePanicTypes, useSaferCity, useSaferCityClient, useSession, useSessionManager, useStream, useSubscribeUser, useSubscriptionTypes, useSubscriptions, useUpdatePanicInformation, useUpdatePanicLocation, useUpdateUser, useUser, useWhoAmI };