/*
 * Copyright (c) 2023-2025 Datalayer, Inc.
 * Distributed under the terms of the Modified BSD License.
 */
export function asContactIAMProvider(iamProvider) {
    return {
        iamProviderName: iamProvider.iamProviderName,
        linkedAccount: iamProvider.linkedAccount ?? '',
        linkedAccountUrl: iamProvider.linkedAccountUrl,
        linkedAccountId: iamProvider.linkedAccountId ?? '',
        isConnected: iamProvider.isConnected ?? false,
    };
}
export const getSocialUrl = (iamProviderName, contact) => {
    if (contact) {
        const iamProvider = contact?.iamProviders.find(i => i.iamProviderName === iamProviderName);
        return iamProvider?.linkedAccountUrl;
    }
    return undefined;
};
