feat: replace hardcoded free-access shop with API check

Loader now calls GET /free-access/:shop on the backend instead of
comparing against a hardcoded shop domain. This lets the admin panel
control which shops get free access without frontend deploys.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
MOHAN 2026-06-11 13:19:12 +05:30
parent 6b46600fff
commit ec2bbad4a2

View File

@ -81,7 +81,15 @@ export const loader = async ({ request }) => {
currencyCode: recurringPricing?.price?.currencyCode || "USD",
} : null;
if (shop === "racewerksengg.myshopify.com") {
// Check server-side free-access whitelist
let hasFreeAccess = false;
try {
const far = await fetch(`https://backend.data4autos.com/free-access/${encodeURIComponent(shop)}`);
const fad = await far.json();
hasFreeAccess = fad.allowed === true;
} catch {}
if (hasFreeAccess) {
return json({ redirectToBilling: false, shop, isSubscribed: true, subscription: subscriptionDetails, allSubscriptions: subscriptions });
}