Skip to content

Commit

Permalink
feat(platforms) disable OAuth for the Civic integration. Change the C…
Browse files Browse the repository at this point in the history
…ivic CTA page to limit pass types to ones supported by Gitcoin. Also update Civic banner copy. (passportxyz#1493)
  • Loading branch information
flipscholtz authored Jul 19, 2023
1 parent 6c63259 commit 672133f
Showing 1 changed file with 7 additions and 22 deletions.
29 changes: 7 additions & 22 deletions platforms/src/Civic/App-Bindings.ts
Original file line number Diff line number Diff line change
@@ -1,20 +1,5 @@
import { PlatformOptions } from "../types";
import { AppContext, PlatformOptions, ProviderPayload } from "../types";
import { Platform } from "../utils/platform";
import { PROVIDER_ID } from "@gitcoin/passport-types";
import { providers } from "./Providers-config";
import { CivicPassProvider } from "./Providers/civic";
import { CivicPassType } from "./Providers/types";

const DEFAULT_SCOPE = "uniqueness";

const mapProviderIDToScope = (provider: PROVIDER_ID): string | undefined => {
const foundProvider = providers.find((p) => p.type === provider);
const passType = (foundProvider as CivicPassProvider)?.passType;
if (passType) {
return CivicPassType[passType].toLowerCase();
}
return undefined;
};

export class CivicPlatform extends Platform {
platformId = "Civic";
Expand All @@ -26,18 +11,18 @@ export class CivicPlatform extends Platform {
this.redirectUri = options.redirectUri as string;
}

getOAuthUrl(state?: string, providers?: PROVIDER_ID[]): Promise<string> {
const scope = providers?.length >= 1 ? mapProviderIDToScope(providers[0]) : DEFAULT_SCOPE;
return Promise.resolve(`https://getpass.civic.com?state=${state}&scope=${scope}&redirect_uri=${this.redirectUri}`);
async getProviderPayload(appContext: AppContext): Promise<ProviderPayload> {
const result = await Promise.resolve({});
return result;
}

banner = {
heading: "Choose a pass type and click Verify.",
heading: "Click on 'Get Civic Pass' to visit Civic and issue your passes.",
content:
"For the best experience, switch to your desired network in your wallet first. Alternatively, visit the link below to get multiple passes.",
"Once you have one or more Civic Passes, select them above and click 'Verify'. Note: Polygon is recommended for the lowest gas cost.",
cta: {
label: "Get Civic Pass",
url: "https://getpass.civic.com",
url: "https://getpass.civic.com?scope=uniqueness,captcha,liveness&chain=polygon,arbitrum%20one,xdc,ethereum",
},
};
}

0 comments on commit 672133f

Please sign in to comment.