Skip to content

Commit

Permalink
Change development environment to point to premium staging
Browse files Browse the repository at this point in the history
  • Loading branch information
DJAndries committed Jul 10, 2024
1 parent 9447363 commit 719cb61
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
5 changes: 5 additions & 0 deletions src/services.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
export const env = process.env.ENVIRONMENT ?? "local";

export function resolveService(
servicePrefix: string,
baseHost: string = window.location.host,
): string {
if (env.startsWith("development") && servicePrefix === "account") {
return "https://account.bravesoftware.com";
}
return `https://${servicePrefix}.${secondLevelDomain(baseHost)}`;
}

Expand Down
10 changes: 7 additions & 3 deletions src/subscriptions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ const loadRewardsSdk = async (): Promise<Rewards.JSSDK> => {

log(`calling initialize(${env}, false)...`);
const sdk = await Rewards.initialize(
isDevelopment ? "development" : env,
isDevelopment ? "staging" : env,
false,
isProduction ? "error" : "info",
);
Expand Down Expand Up @@ -68,12 +68,16 @@ export async function recoverCredsIfRequired(orderId: string): Promise<void> {
}
}

function getCredentialHostname(): string | undefined {
return isDevelopment ? "talk.bravesoftware.com" : undefined;
}

export async function checkSubscribedUsingSDK(): Promise<boolean> {
try {
const sdk = await loadRewardsSdk();
log(`calling credential_summary...`);

const result = await sdk.credential_summary();
const result = await sdk.credential_summary(getCredentialHostname());
log("credential_summary returns", result);
if (result && result.active) {
return true;
Expand All @@ -91,7 +95,7 @@ export async function setTemporaryCredentialCookie(): Promise<boolean> {

log(`calling present_credentials...`);

const result = await sdk.present_credentials();
const result = await sdk.present_credentials(getCredentialHostname());
log("present_credentials returns", result);
if (result) {
return true;
Expand Down

0 comments on commit 719cb61

Please sign in to comment.