apps-sdk 2.1.3 → 2.1.4

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/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import {NotificationsPush, Networking, Storage, Session, Utils, PayWallLogic, Rating, AdJust, TrackingTransparency, Voice, MixPanel, Adapty, HomeActions, Facebook, Legal, Authentication} from "./src/libraries";
1
+ import {NotificationsPush, Networking, Storage, Session, Utils, PayWallLogic, Rating, AdJust, TrackingTransparency, Voice, MixPanel, Adapty, HomeActions, Facebook, Legal, Authentication,Firebase} from "./src/libraries";
2
2
  // import PayWall from "./src/components/PayWall"; // DEPRECATED: Use SDK.adaptyOnboarding or SDK.adapty.showPaywall() instead
3
3
  import AdaptyOnboarding from "./src/components/AdaptyOnboarding";
4
4
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "apps-sdk",
3
- "version": "2.1.3",
3
+ "version": "2.1.4",
4
4
  "description": "Apps SDK - Compatible with Expo SDK 54 + React 19 - add rating flow, auth modules",
5
5
  "main": "index.js",
6
6
  "author": "ASD",
package/types/index.d.ts CHANGED
@@ -343,6 +343,269 @@ declare module 'apps-sdk' {
343
343
  setUserProperty(name: string, value: string): Promise<void>;
344
344
  }
345
345
 
346
+ // ─── Authentication ────────────────────────────────────────────────────────
347
+
348
+ export interface AuthApiResult<T = any> {
349
+ success: boolean;
350
+ data?: T;
351
+ error?: string;
352
+ code?: number;
353
+ message?: string;
354
+ raw?: any;
355
+ }
356
+
357
+ export interface AuthLoginPayload {
358
+ /** Email or username */
359
+ login?: string;
360
+ /** Credential (alias for login) */
361
+ credential?: string;
362
+ /** Password */
363
+ password: string;
364
+ /** Optional website ID (defaults to config value) */
365
+ websiteid?: string;
366
+ }
367
+
368
+ export interface AuthRegisterPayload {
369
+ /** Email or username */
370
+ login?: string;
371
+ /** Email (alias for login) */
372
+ email?: string;
373
+ /** Password */
374
+ password: string;
375
+ /** Optional website ID (defaults to config value) */
376
+ websiteid?: string;
377
+ }
378
+
379
+ export interface AuthRegisterAndLinkPayload {
380
+ email: string;
381
+ password: string;
382
+ }
383
+
384
+ export interface AuthLinkUserPayload {
385
+ /** Web user ID */
386
+ user_id: string;
387
+ /** Mobile app user ID */
388
+ app_user_id: string;
389
+ }
390
+
391
+ export interface AuthCheckLinkPayload {
392
+ user_id: string;
393
+ app_user_id: string;
394
+ }
395
+
396
+ export interface AuthCheckSubscriptionPayload {
397
+ user_id: string;
398
+ app_user_id: string;
399
+ }
400
+
401
+ export interface AuthValidatePhonePayload {
402
+ phoneNumber: string;
403
+ countryCode: string;
404
+ }
405
+
406
+ export interface AuthRequestPasswordResetPayload {
407
+ credential: string;
408
+ }
409
+
410
+ export interface AuthVerifyResetCodePayload {
411
+ code: string;
412
+ }
413
+
414
+ export interface AuthResetPasswordPayload {
415
+ resetToken: string;
416
+ newPassword: string;
417
+ }
418
+
419
+ export interface AuthResendCodePayload {
420
+ credential: string;
421
+ }
422
+
423
+ export interface AuthValidateQrCodePayload {
424
+ qrData: string;
425
+ }
426
+
427
+ export interface AuthLinkWithQrCodePayload {
428
+ user_id: string;
429
+ }
430
+
431
+ export interface AuthUserData {
432
+ us_id: string | number;
433
+ us_login?: string;
434
+ login?: string;
435
+ metadata?: Record<string, any> | any[];
436
+ subscription_data?: AuthSubscriptionData;
437
+ success?: number;
438
+ }
439
+
440
+ export interface AuthSubscriptionData {
441
+ subscription_active?: boolean;
442
+ [key: string]: any;
443
+ }
444
+
445
+ export interface AuthLinkedUserData {
446
+ success: number;
447
+ linked: boolean;
448
+ items?: AuthUserData[];
449
+ }
450
+
451
+ export interface AuthRegisterAndLinkResult {
452
+ success: boolean;
453
+ user?: AuthUserData;
454
+ linked?: boolean;
455
+ error?: string;
456
+ code?: number;
457
+ }
458
+
459
+ export interface AuthQrValidationData {
460
+ valid: boolean;
461
+ user_id?: string;
462
+ }
463
+
464
+ export interface AuthQrLinkData {
465
+ linked: boolean;
466
+ message?: string;
467
+ subscriptionActive?: boolean;
468
+ }
469
+
470
+ export interface AuthCallApiOptions {
471
+ retries?: number;
472
+ timeoutMs?: number;
473
+ silent?: boolean;
474
+ }
475
+
476
+ export class Authentication {
477
+ AUTH_API_BASE_URL: string;
478
+ USER_API_BASE_URL: string;
479
+ CHATCONNECT_API_BASE_URL: string;
480
+
481
+ /** Get website ID from config */
482
+ getWebsiteId(): string;
483
+
484
+ /** Get app user ID from session */
485
+ getAppUserId(): string;
486
+
487
+ /**
488
+ * Generic API call helper with retry logic.
489
+ */
490
+ callApi(url: string, payload: object, opts?: AuthCallApiOptions): Promise<AuthApiResult>;
491
+
492
+ /**
493
+ * Login with credentials.
494
+ * POST /auth/auth-user
495
+ */
496
+ login(payload: AuthLoginPayload): Promise<AuthApiResult<AuthUserData>>;
497
+
498
+ /**
499
+ * Register a new user account.
500
+ * POST /chatconnect/create-user
501
+ */
502
+ register(payload: AuthRegisterPayload): Promise<AuthApiResult<{ user: AuthUserData }>>;
503
+
504
+ /**
505
+ * Complete registration flow: create-user → link-user.
506
+ */
507
+ registerAndLinkAccount(payload: AuthRegisterAndLinkPayload): Promise<AuthRegisterAndLinkResult>;
508
+
509
+ /**
510
+ * Link a user account.
511
+ * POST /user/link
512
+ */
513
+ linkUser(payload: AuthLinkUserPayload): Promise<AuthApiResult<AuthLinkedUserData>>;
514
+
515
+ /**
516
+ * Fetch authenticated user profile using stored credentials.
517
+ */
518
+ fetchUserProfile(): Promise<AuthApiResult<AuthUserData>>;
519
+
520
+ /**
521
+ * Check if user account is linked (using stored data).
522
+ */
523
+ isAccountLinked(): Promise<boolean>;
524
+
525
+ /**
526
+ * Get stored auth user login (email).
527
+ */
528
+ getStoredUserLogin(): Promise<string | null>;
529
+
530
+ /**
531
+ * Check if user is linked.
532
+ * POST /user/check-link
533
+ */
534
+ checkLink(payload: AuthCheckLinkPayload): Promise<AuthApiResult>;
535
+
536
+ /**
537
+ * Check user subscription status.
538
+ * POST /user/check-subs
539
+ */
540
+ checkSubscription(payload: AuthCheckSubscriptionPayload): Promise<AuthApiResult>;
541
+
542
+ /**
543
+ * Check if a credential exists (stub for backward compatibility).
544
+ */
545
+ checkCredential(payload: { credentialType: string; [key: string]: any }): Promise<AuthApiResult<{ exists: boolean; credentialType: string; requiresPhone: boolean }>>;
546
+
547
+ /**
548
+ * Validate phone number (client-side).
549
+ */
550
+ validatePhone(payload: AuthValidatePhonePayload): Promise<AuthApiResult<{ valid: boolean; formattedPhone?: string }>>;
551
+
552
+ /**
553
+ * Request password reset (stub).
554
+ */
555
+ requestPasswordReset(payload: AuthRequestPasswordResetPayload): Promise<AuthApiResult<{ sent: boolean; destination: string; expiresIn: number }>>;
556
+
557
+ /**
558
+ * Verify reset code (stub).
559
+ */
560
+ verifyResetCode(payload: AuthVerifyResetCodePayload): Promise<AuthApiResult<{ valid: boolean; resetToken: string }>>;
561
+
562
+ /**
563
+ * Reset password (stub).
564
+ */
565
+ resetPassword(payload: AuthResetPasswordPayload): Promise<AuthApiResult<{ success: boolean; message: string }>>;
566
+
567
+ /**
568
+ * Resend verification code (stub).
569
+ */
570
+ resendCode(payload: AuthResendCodePayload): Promise<AuthApiResult<{ sent: boolean; canResendAt: string }>>;
571
+
572
+ /**
573
+ * Validate QR code data.
574
+ */
575
+ validateQrCode(payload: AuthValidateQrCodePayload): Promise<AuthApiResult<AuthQrValidationData>>;
576
+
577
+ /**
578
+ * Link account using QR code.
579
+ * POST /user/link
580
+ */
581
+ linkWithQrCode(payload: AuthLinkWithQrCodePayload): Promise<AuthApiResult<AuthQrLinkData>>;
582
+
583
+ /**
584
+ * Logout current user (clears stored auth data).
585
+ */
586
+ logout(): Promise<AuthApiResult<{ success: boolean }>>;
587
+
588
+ /**
589
+ * Check if user is currently authenticated (has stored user ID).
590
+ */
591
+ isAuthenticated(): Promise<boolean>;
592
+
593
+ /**
594
+ * Get stored user ID.
595
+ */
596
+ getStoredUserId(): Promise<string | null>;
597
+
598
+ /**
599
+ * Get stored user metadata.
600
+ */
601
+ getStoredUserMetadata(): Promise<Record<string, any> | null>;
602
+
603
+ /**
604
+ * Get stored subscription data.
605
+ */
606
+ getStoredSubscription(): Promise<AuthSubscriptionData | null>;
607
+ }
608
+
346
609
  export class AppsSDK {
347
610
  initializePushNotifications(): Promise<string>;
348
611
  }
@@ -361,13 +624,16 @@ declare module 'apps-sdk' {
361
624
  mixpanel : MixPanel;
362
625
  tracking : TrackingTransparency;
363
626
  paywallLogic : PayWallLogic;
627
+ /** @deprecated Use `notifications` instead */
364
628
  notificationsPush : NotificationsPush;
629
+ notifications : NotificationsPush;
365
630
  voice : Voice;
366
631
  adapty : Adapty;
367
632
  homeActions : HomeActions;
368
633
  facebook : Facebook;
369
634
  firebase : Firebase;
370
635
  legal : Legal;
636
+ authentication : Authentication;
371
637
  }
372
638
 
373
639
  const Core: AppsSDK;