feat(auth): rename external ids to asid psid
This commit is contained in:
@@ -32,12 +32,12 @@ function makeAuthStorageMock(input: {
|
||||
),
|
||||
setRefreshToken: vi.fn(async () => Result.ok(undefined)),
|
||||
clearRefreshToken: vi.fn(async () => Result.ok(undefined)),
|
||||
getFacebookId: vi.fn(async () => Result.ok(null)),
|
||||
setFacebookId: vi.fn(async () => Result.ok(undefined)),
|
||||
clearFacebookId: vi.fn(async () => Result.ok(undefined)),
|
||||
getFacebookAppId: vi.fn(async () => Result.ok(null)),
|
||||
setFacebookAppId: vi.fn(async () => Result.ok(undefined)),
|
||||
clearFacebookAppId: vi.fn(async () => Result.ok(undefined)),
|
||||
getAsid: vi.fn(async () => Result.ok(null)),
|
||||
setAsid: vi.fn(async () => Result.ok(undefined)),
|
||||
clearAsid: vi.fn(async () => Result.ok(undefined)),
|
||||
getPsid: vi.fn(async () => Result.ok(null)),
|
||||
setPsid: vi.fn(async () => Result.ok(undefined)),
|
||||
clearPsid: vi.fn(async () => Result.ok(undefined)),
|
||||
clearBusinessAuthData: vi.fn(async () => Result.ok(undefined)),
|
||||
clearAuthData: vi.fn(async () => Result.ok(undefined)),
|
||||
};
|
||||
|
||||
@@ -8,26 +8,26 @@ import { UrlLauncherUtil } from "@/utils";
|
||||
export async function openChatInExternalBrowser(): Promise<void> {
|
||||
const authStorage = AuthStorage.getInstance();
|
||||
const userStorage = UserStorage.getInstance();
|
||||
const [deviceIdR, facebookIdR, facebookAppIdR, avatarUrlR] =
|
||||
const [deviceIdR, asidR, psidR, avatarUrlR] =
|
||||
await Promise.all([
|
||||
authStorage.getDeviceId(),
|
||||
authStorage.getFacebookId(),
|
||||
authStorage.getFacebookAppId(),
|
||||
authStorage.getAsid(),
|
||||
authStorage.getPsid(),
|
||||
userStorage.getAvatarUrl(),
|
||||
]);
|
||||
|
||||
const deviceId = deviceIdR.success ? deviceIdR.data : null;
|
||||
const facebookId = facebookIdR.success ? facebookIdR.data : null;
|
||||
const facebookAppId = facebookAppIdR.success ? facebookAppIdR.data : null;
|
||||
const asid = asidR.success ? asidR.data : null;
|
||||
const psid = psidR.success ? psidR.data : null;
|
||||
const avatarUrl = avatarUrlR.success ? avatarUrlR.data : null;
|
||||
|
||||
if (deviceId && facebookId) {
|
||||
if (deviceId && asid) {
|
||||
UrlLauncherUtil.openUrlWithExternalBrowser(ROUTES.externalEntry, {
|
||||
queryParams: {
|
||||
target: "chat",
|
||||
deviceId,
|
||||
fbid: facebookId,
|
||||
...(facebookAppId ? { fb_app_id: facebookAppId } : {}),
|
||||
asid,
|
||||
...(psid ? { psid } : {}),
|
||||
...(avatarUrl ? { avatarUrl } : {}),
|
||||
},
|
||||
});
|
||||
|
||||
@@ -11,8 +11,8 @@ export type ExternalEntryTarget =
|
||||
|
||||
export interface ExternalEntryPayload {
|
||||
deviceId?: string | null;
|
||||
facebookId?: string | null;
|
||||
facebookAppId?: string | null;
|
||||
asid?: string | null;
|
||||
psid?: string | null;
|
||||
avatarUrl?: string | null;
|
||||
}
|
||||
|
||||
@@ -37,8 +37,8 @@ export function resolveExternalEntryTarget({
|
||||
|
||||
export async function persistExternalEntryPayload({
|
||||
deviceId,
|
||||
facebookId,
|
||||
facebookAppId,
|
||||
asid,
|
||||
psid,
|
||||
avatarUrl,
|
||||
}: ExternalEntryPayload): Promise<void> {
|
||||
const authStorage = AuthStorage.getInstance();
|
||||
@@ -48,11 +48,11 @@ export async function persistExternalEntryPayload({
|
||||
if (hasValue(deviceId)) {
|
||||
tasks.push(authStorage.setDeviceId(deviceId));
|
||||
}
|
||||
if (hasValue(facebookId)) {
|
||||
tasks.push(authStorage.setFacebookId(facebookId));
|
||||
if (hasValue(asid)) {
|
||||
tasks.push(authStorage.setAsid(asid));
|
||||
}
|
||||
if (hasValue(facebookAppId)) {
|
||||
tasks.push(authStorage.setFacebookAppId(facebookAppId));
|
||||
if (hasValue(psid)) {
|
||||
tasks.push(authStorage.setPsid(psid));
|
||||
}
|
||||
if (hasValue(avatarUrl)) {
|
||||
tasks.push(userStorage.setAvatarUrl(avatarUrl));
|
||||
|
||||
Reference in New Issue
Block a user