This commit is contained in:
payacom
2026-07-31 21:20:13 +03:30
parent 67f59eefdf
commit 5ecbcd1f26
50 changed files with 4793 additions and 116 deletions

View File

@@ -0,0 +1,10 @@
import { INSTAGRAM_OAUTH_CLIENT_ID } from "@/config/instagramAuth";
/** Instagram OAuth Client ID — env at runtime, then committed fallback (empty until configured) */
export function getInstagramClientId(): string {
return (
process.env.NEXT_PUBLIC_INSTAGRAM_CLIENT_ID ||
process.env.INSTAGRAM_CLIENT_ID ||
INSTAGRAM_OAUTH_CLIENT_ID
).trim();
}

View File

@@ -66,7 +66,9 @@ export function parseLoginResponse(raw: unknown): IVerifyOtp {
page,
id: obj.id != null ? String(obj.id) : undefined,
auth_provider:
obj.auth_provider === "google" || obj.auth_provider === "mobile"
obj.auth_provider === "google" ||
obj.auth_provider === "mobile" ||
obj.auth_provider === "instagram"
? obj.auth_provider
: undefined,
email:

View File

@@ -0,0 +1,15 @@
/** Standard Iranian national-code (کد ملی) checksum validator. */
export function isValidIranNationalCode(code: string): boolean {
const value = String(code || "");
if (!/^\d{10}$/.test(value)) return false;
if (/^(\d)\1{9}$/.test(value)) return false;
const digits = value.split("").map(Number);
const sum = digits
.slice(0, 9)
.reduce((acc, digit, index) => acc + digit * (10 - index), 0);
const remainder = sum % 11;
const checkDigit = remainder < 2 ? remainder : 11 - remainder;
return checkDigit === digits[9];
}