331 lines
12 KiB
TypeScript
331 lines
12 KiB
TypeScript
// Metro module 4996 (f4997).
|
|
import GuildRoleStore from "../../stores/GuildRoleStore";
|
|
import GuildStore from "../../stores/GuildStore";
|
|
import PermissionStore from "../../stores/PermissionStore";
|
|
import { MetadataFields, OperatorTypes } from "./Constants";
|
|
import { Permissions, PlatformTypes } from "../../Constants";
|
|
import URLUtils from "../../utils/URLUtils";
|
|
import Module38 from "../../_bundle/Module38";
|
|
import { t, intl } from "../../intl/index.native";
|
|
import Module12 from "../../_bundle/Module12";
|
|
import getConnectionsRoles from "../channel/getConnectionsRoles";
|
|
import { useStateFromStores } from "../../_bundle/Module589";
|
|
import { UNSAFE_isDismissibleContentDismissed } from "../dismissible_content/DismissibleContentUnsafeUtils";
|
|
import { DismissibleContent } from "../../_bundle/Module1358";
|
|
const r27 = {
|
|
AND: 0,
|
|
0: "AND",
|
|
OR: 1,
|
|
1: "OR"
|
|
};
|
|
export const officialApplicationIds = ["426537812993638400", "1042836142560645130", "296023718839451649", "979802510766268446", "1031611223235637258", "512333785338216465"];
|
|
export { r27 as ConnectionConfigurationRuleOperator };
|
|
export function getCallbackParamsFromURL(a0) {
|
|
let r17 = URLUtils.toURLSafe(a0);
|
|
if (r17 == null) {
|
|
r17 = {
|
|
searchParams: new URLSearchParams()
|
|
};
|
|
}
|
|
const r27 = Object.fromEntries(r17.searchParams);
|
|
const { code, state, error, error_description } = r27;
|
|
Module38(!Array.isArray(code), "Received multiple query param values for code");
|
|
Module38(!Array.isArray(state), "Received multiple query param values for state");
|
|
Module38(!Array.isArray(error), "Received multiple query param values for error");
|
|
Module38(!Array.isArray(error_description), "Received multiple query param values for error_description");
|
|
return {
|
|
code,
|
|
state,
|
|
error,
|
|
errorDescription: error_description
|
|
};
|
|
}
|
|
export function getConnectionsCheckText(a0) {
|
|
let r26, connectionMetadataField, connectionType, operator, operatorText;
|
|
let days;
|
|
L14: {
|
|
connectionType = a0.connectionType;
|
|
connectionMetadataField = a0.connectionMetadataField;
|
|
operator = a0.operator;
|
|
operatorText = a0.operatorText;
|
|
const value = a0.value;
|
|
days = void 0;
|
|
days = Math.round(Number(value));
|
|
if (OperatorTypes.EQUAL === operator) {
|
|
const H97H4S = t.H97H4S;
|
|
r26 = connectionType === PlatformTypes.PAYPAL && connectionMetadataField === MetadataFields.PAYPAL_VERIFIED ? t["N95b+f"] : H97H4S;
|
|
} else if (OperatorTypes.NOT_EQUAL === operator) {
|
|
r26 = t["D9B/q2"];
|
|
} else if (OperatorTypes.LESS_THAN === operator) {
|
|
r26 = t["3ru8/N"];
|
|
days = Math.max(0, days - 1);
|
|
} else {
|
|
if (OperatorTypes.GREATER_THAN !== operator) {
|
|
if (operator !== void 0) {
|
|
r26 = null;
|
|
if (operator !== null) {
|
|
break L14;
|
|
}
|
|
}
|
|
return null;
|
|
}
|
|
r26 = t.wCVDHn;
|
|
days = Math.max(0, days + 1);
|
|
}
|
|
}
|
|
if (operatorText != null) {
|
|
r26 = operatorText;
|
|
}
|
|
let r65 = r26;
|
|
if (r65 != null) {
|
|
r65 = r26;
|
|
if (operator != null) {
|
|
if (PlatformTypes.REDDIT === connectionType) {
|
|
if (MetadataFields.CREATED_AT === connectionMetadataField) {
|
|
r65 = intl.format(r26, {
|
|
platformQuantityHook: () => intl.formatToPlainString(t.TPbtEu, {
|
|
days
|
|
})
|
|
});
|
|
} else if (MetadataFields.REDDIT_TOTAL_KARMA === connectionMetadataField) {
|
|
r65 = intl.format(r26, {
|
|
platformQuantityHook: () => intl.formatToPlainString(t.P2JAEc, {
|
|
karma: days
|
|
})
|
|
});
|
|
} else if (MetadataFields.REDDIT_GOLD === connectionMetadataField) {
|
|
r65 = intl.format(r26, {
|
|
platformQuantityHook: () => intl.string(t["+/5TCx"])
|
|
});
|
|
} else {
|
|
if (MetadataFields.REDDIT_MOD !== connectionMetadataField) {
|
|
return null;
|
|
}
|
|
r65 = intl.format(r26, {
|
|
platformQuantityHook: () => intl.string(t["9rPbEs"])
|
|
});
|
|
}
|
|
} else if (PlatformTypes.STEAM === connectionType) {
|
|
if (MetadataFields.CREATED_AT === connectionMetadataField) {
|
|
r65 = intl.format(r26, {
|
|
platformQuantityHook: () => intl.formatToPlainString(t.TPbtEu, {
|
|
days
|
|
})
|
|
});
|
|
} else if (MetadataFields.STEAM_GAME_COUNT === connectionMetadataField) {
|
|
r65 = intl.format(r26, {
|
|
platformQuantityHook: () => intl.formatToPlainString(t.H9eLoe, {
|
|
count: days
|
|
})
|
|
});
|
|
} else if (MetadataFields.STEAM_ITEM_COUNT_TF2 === connectionMetadataField) {
|
|
r65 = intl.format(r26, {
|
|
platformQuantityHook: () => intl.formatToPlainString(t.MceZJ6, {
|
|
count: days
|
|
})
|
|
});
|
|
} else {
|
|
if (MetadataFields.STEAM_ITEM_COUNT_DOTA2 !== connectionMetadataField) {
|
|
return null;
|
|
}
|
|
r65 = intl.format(r26, {
|
|
platformQuantityHook: () => intl.formatToPlainString(t.dMnRar, {
|
|
count: days
|
|
})
|
|
});
|
|
}
|
|
} else if (PlatformTypes.BLUESKY === connectionType) {
|
|
if (MetadataFields.CREATED_AT === connectionMetadataField) {
|
|
r65 = intl.format(r26, {
|
|
platformQuantityHook: () => intl.formatToPlainString(t.TPbtEu, {
|
|
days
|
|
})
|
|
});
|
|
} else if (MetadataFields.BLUESKY_FOLLOWERS_COUNT === connectionMetadataField) {
|
|
r65 = intl.format(r26, {
|
|
platformQuantityHook: () => intl.formatToPlainString(t.xIdKU8, {
|
|
count: days
|
|
})
|
|
});
|
|
} else {
|
|
if (MetadataFields.BLUESKY_STATUSES_COUNT !== connectionMetadataField) {
|
|
return null;
|
|
}
|
|
r65 = intl.format(r26, {
|
|
platformQuantityHook: () => intl.formatToPlainString(t["dy3+NR"], {
|
|
count: days
|
|
})
|
|
});
|
|
}
|
|
} else if (PlatformTypes.TWITTER === connectionType) {
|
|
if (MetadataFields.CREATED_AT === connectionMetadataField) {
|
|
r65 = intl.format(r26, {
|
|
platformQuantityHook: () => intl.formatToPlainString(t.TPbtEu, {
|
|
days
|
|
})
|
|
});
|
|
} else if (MetadataFields.TWITTER_VERIFIED === connectionMetadataField) {
|
|
r65 = intl.format(r26, {
|
|
platformQuantityHook: () => intl.string(t.xRygZL)
|
|
});
|
|
} else if (MetadataFields.TWITTER_FOLLOWERS_COUNT === connectionMetadataField) {
|
|
r65 = intl.format(r26, {
|
|
platformQuantityHook: () => intl.formatToPlainString(t.bkajar, {
|
|
count: days
|
|
})
|
|
});
|
|
} else {
|
|
if (MetadataFields.TWITTER_STATUSES_COUNT !== connectionMetadataField) {
|
|
return null;
|
|
}
|
|
r65 = intl.format(r26, {
|
|
platformQuantityHook: () => intl.formatToPlainString(t.MI7NKi, {
|
|
count: days
|
|
})
|
|
});
|
|
}
|
|
} else if (PlatformTypes.PAYPAL === connectionType) {
|
|
if (MetadataFields.CREATED_AT === connectionMetadataField) {
|
|
r65 = intl.format(r26, {
|
|
platformQuantityHook: () => intl.formatToPlainString(t.TPbtEu, {
|
|
days
|
|
})
|
|
});
|
|
} else {
|
|
if (MetadataFields.PAYPAL_VERIFIED !== connectionMetadataField) {
|
|
return null;
|
|
}
|
|
r65 = intl.format(r26, {
|
|
platformQuantityHook: () => intl.string(t.slSQuB)
|
|
});
|
|
}
|
|
} else if (PlatformTypes.EBAY === connectionType) {
|
|
if (MetadataFields.CREATED_AT === connectionMetadataField) {
|
|
r65 = intl.format(r26, {
|
|
platformQuantityHook: () => intl.formatToPlainString(t.TPbtEu, {
|
|
days
|
|
})
|
|
});
|
|
} else if (MetadataFields.EBAY_TOP_RATED_SELLER === connectionMetadataField) {
|
|
r65 = intl.format(r26, {
|
|
platformQuantityHook: () => intl.string(t.TEEYwa)
|
|
});
|
|
} else if (MetadataFields.EBAY_POSITIVE_FEEDBACK_PERCENTAGE === connectionMetadataField) {
|
|
r65 = intl.format(r26, {
|
|
platformQuantityHook: () => intl.formatToPlainString(t.rl9Vgy, {
|
|
value: days
|
|
})
|
|
});
|
|
} else if (MetadataFields.EBAY_UNIQUE_POSITIVE_FEEDBACK_COUNT === connectionMetadataField) {
|
|
r65 = intl.format(r26, {
|
|
platformQuantityHook: () => intl.formatToPlainString(t.QP5W1R, {
|
|
count: days
|
|
})
|
|
});
|
|
} else {
|
|
if (MetadataFields.EBAY_UNIQUE_NEGATIVE_FEEDBACK_COUNT !== connectionMetadataField) {
|
|
return null;
|
|
}
|
|
r65 = intl.format(r26, {
|
|
platformQuantityHook: () => intl.formatToPlainString(t["6ZFYdK"], {
|
|
count: days
|
|
})
|
|
});
|
|
}
|
|
} else {
|
|
if (PlatformTypes.TIKTOK !== connectionType) {
|
|
return null;
|
|
}
|
|
if (MetadataFields.TIKTOK_VERIFIED === connectionMetadataField) {
|
|
r65 = intl.format(r26, {
|
|
platformQuantityHook: () => intl.string(t.uv7ety)
|
|
});
|
|
} else if (MetadataFields.TIKTOK_FOLLOWER_COUNT === connectionMetadataField) {
|
|
r65 = intl.format(r26, {
|
|
platformQuantityHook: () => intl.formatToPlainString(t.qIPDRy, {
|
|
count: days
|
|
})
|
|
});
|
|
} else if (MetadataFields.TIKTOK_FOLLOWING_COUNT === connectionMetadataField) {
|
|
r65 = intl.format(r26, {
|
|
platformQuantityHook: () => intl.formatToPlainString(t.zRta4X, {
|
|
count: days
|
|
})
|
|
});
|
|
} else {
|
|
if (MetadataFields.TIKTOK_LIKES_COUNT !== connectionMetadataField) {
|
|
return null;
|
|
}
|
|
r65 = intl.format(r26, {
|
|
platformQuantityHook: () => intl.formatToPlainString(t["ar0WW+"], {
|
|
count: days
|
|
})
|
|
});
|
|
}
|
|
}
|
|
}
|
|
}
|
|
return r65;
|
|
}
|
|
export function isVerifiedRolesChannelVisible(a0) {
|
|
return a0.some((item) => item.tags.guild_connections === null);
|
|
}
|
|
export function getVisibleConnectionsRole(a0) {
|
|
let r33;
|
|
const guildMember = a0.guildMember;
|
|
let guild = a0.guild;
|
|
let sortedGuildRoles = a0.sortedGuildRoles;
|
|
const { channel, onlyChannelConnectionRoles = false } = a0;
|
|
if (guildMember == null) {
|
|
return null;
|
|
}
|
|
if (guild == null && channel != null) {
|
|
guild = GuildStore.getGuild(channel.getGuildId());
|
|
}
|
|
if (guild == null) {
|
|
return null;
|
|
}
|
|
const id = guild.id;
|
|
if (sortedGuildRoles == null) {
|
|
sortedGuildRoles = GuildRoleStore.getSortedRoles(id);
|
|
}
|
|
const r22 = sortedGuildRoles.filter((sortedGuildRole) => sortedGuildRole.tags.guild_connections === null && guildMember.roles.includes(sortedGuildRole.id));
|
|
const r31 = Module12.intersection(r22, getConnectionsRoles(channel));
|
|
if (r31.length > 0) {
|
|
let r35 = r31[0];
|
|
if (r35 == null) {
|
|
r35 = null;
|
|
}
|
|
r33 = r35;
|
|
} else {
|
|
r33 = null;
|
|
if (!onlyChannelConnectionRoles) {
|
|
let r34 = r22[0];
|
|
if (r34 == null) {
|
|
r34 = null;
|
|
}
|
|
r33 = r34;
|
|
}
|
|
}
|
|
return r33;
|
|
}
|
|
export function getCreatedAtDate(a0, a1) {
|
|
if (a0 != null && a0 !== "") {
|
|
const date = new Date(a0);
|
|
return date instanceof Date ? isNaN(date.getTime()) ? null : date.toLocaleDateString(a1, {
|
|
month: "short",
|
|
day: "numeric",
|
|
year: "numeric"
|
|
}) : null;
|
|
}
|
|
return null;
|
|
}
|
|
export function useShowLinkedRolesAdminNux(c14498_0) {
|
|
return useStateFromStores([GuildRoleStore, PermissionStore], () => {
|
|
const r12 = GuildRoleStore.getSortedRoles(c14498_0.id).some((item) => item.tags.guild_connections === null);
|
|
const r20 = UNSAFE_isDismissibleContentDismissed(DismissibleContent.CONNECTIONS_NUX);
|
|
const r25 = PermissionStore.can(Permissions.MANAGE_ROLES, c14498_0);
|
|
return (r12 ? !r12 : r20) && r25;
|
|
});
|
|
}
|