feat(auth): implement Facebook identity binding on external entry
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
import { AuthStorage } from "@/data/storage/auth/auth_storage";
|
||||
import { UserStorage } from "@/data/storage/user/user_storage";
|
||||
import type { PendingChatPromotionType } from "@/data/storage/navigation";
|
||||
import type { LoginStatus } from "@/data/dto/auth";
|
||||
import { ROUTES } from "@/router/routes";
|
||||
|
||||
export type ExternalEntryTarget =
|
||||
@@ -26,6 +27,33 @@ export interface ExternalEntryPromotionInput {
|
||||
promotionType?: string | null;
|
||||
}
|
||||
|
||||
export interface ExternalFacebookIdentityBindingInput {
|
||||
hasInitialized: boolean;
|
||||
isLoading: boolean;
|
||||
loginStatus: LoginStatus;
|
||||
asid?: string | null;
|
||||
psid?: string | null;
|
||||
}
|
||||
|
||||
export function shouldBindExternalFacebookIdentity({
|
||||
hasInitialized,
|
||||
isLoading,
|
||||
loginStatus,
|
||||
asid,
|
||||
psid,
|
||||
}: ExternalFacebookIdentityBindingInput): boolean {
|
||||
const isRealUser =
|
||||
loginStatus === "email" ||
|
||||
loginStatus === "google" ||
|
||||
loginStatus === "facebook";
|
||||
return (
|
||||
hasInitialized &&
|
||||
!isLoading &&
|
||||
isRealUser &&
|
||||
(hasValue(asid) || hasValue(psid))
|
||||
);
|
||||
}
|
||||
|
||||
export function resolveExternalEntryPromotionType({
|
||||
mode,
|
||||
promotionType,
|
||||
|
||||
Reference in New Issue
Block a user