// Patch fetch to force HTTPS for api.manoonoils.com
const originalFetch = global.fetch;
global.fetch = async (input: RequestInfo | URL, init?: RequestInit) => {
  let url = input.toString();
  if (url.startsWith('http://api.manoonoils.com/')) {
    url = url.replace('http://', 'https://');
    input = url;
  }
  return originalFetch(input, init);
};

import { createAppRegisterHandler } from "@saleor/app-sdk/handlers/next";
import { saleorApp } from "@/saleor-app";

export default createAppRegisterHandler({
  apl: saleorApp.apl,
  allowedSaleorUrls: [
    "https://api.manoonoils.com/graphql/",
    "http://api.manoonoils.com/graphql/",
  ],
});